Skip to content

Commit

Permalink
empty features should be None
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed May 21, 2024
1 parent 8df6372 commit 4aa06d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions efel/pyfeatures/pyfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def spikes_per_burst():
burst_begin_indices = get_cpp_feature("burst_begin_indices")
burst_end_indices = get_cpp_feature("burst_end_indices")

if burst_begin_indices is None:
if burst_begin_indices is None or len(burst_begin_indices) < 1:
return None

ap_per_bursts = []
Expand All @@ -304,7 +304,7 @@ def spikes_per_burst():
def spikes_per_burst_diff():
"""Calculate the diff between the spikes in each burst and the next one"""
spikes_per_burst_values = spikes_per_burst()
if spikes_per_burst_values is None:
if spikes_per_burst_values is None or len(spikes_per_burst_values) < 2:
return None

return spikes_per_burst_values[:-1] - spikes_per_burst_values[1:]
Expand Down
16 changes: 8 additions & 8 deletions tests/testdata/allfeatures/expectedresults.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@
"interburst_60percent_indices": null,
"interburst_60percent_values": null,
"interburst_duration": null,
"interburst_min_indices": [],
"interburst_min_values": [],
"interburst_min_indices": null,
"interburst_min_values": null,
"interburst_voltage": [
-38.820613862535545
],
Expand Down Expand Up @@ -624,7 +624,7 @@
"strict_burst_number": [
1
],
"strict_interburst_voltage": [],
"strict_interburst_voltage": null,
"time": [
0.0,
0.1,
Expand Down Expand Up @@ -30632,7 +30632,7 @@
"time_to_first_spike": [
8.000000000092427
],
"time_to_interburst_min": [],
"time_to_interburst_min": null,
"time_to_last_spike": [
1937.7999999986964
],
Expand Down Expand Up @@ -60680,7 +60680,7 @@
"spikes_per_burst": [
2
],
"spikes_per_burst_diff": [],
"spikes_per_burst_diff": null,
"spikes_in_burst1_burst2_diff": null,
"spikes_in_burst1_burstlast_diff": null,
"depol_block": null,
Expand Down Expand Up @@ -60723,7 +60723,7 @@
"strict_burst_mean_freq": [
7.99041151
],
"strict_interburst_voltage": [],
"strict_interburst_voltage": null,
"ADP_peak_amplitude": [
0.0,
2.6873666528663236,
Expand All @@ -60748,8 +60748,8 @@
-41.12299346923828,
-38.12341871769886
],
"interburst_min_indices": [],
"interburst_min_values": [],
"interburst_min_indices": null,
"interburst_min_values": null,
"postburst_min_indices": [
26465
],
Expand Down

0 comments on commit 4aa06d6

Please sign in to comment.