Skip to content

Commit 7c35a99

Browse files
committed
Explicitly handle NaNs in metric evaluation
1 parent 61fd50e commit 7c35a99

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

erdetect/core/metrics/metric_cross_proj.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def evaluate_callback(channel_index, stimpair_index, metric_values):
8585
# (double) The threshold which needs to be exceeded to detect a peak
8686
cross_proj_threshold = config('detection', 'cross_proj', 'threshold')
8787

88+
if metric_values[channel_index, stimpair_index, 0] == np.nan:
89+
return False
8890
return metric_values[channel_index, stimpair_index, 0] > cross_proj_threshold
8991

9092
@staticmethod

erdetect/core/metrics/metric_waveform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def evaluate_callback(channel_index, stimpair_index, metric_values):
9898
# (double) The threshold which needs to be exceeded to detect a peak
9999
waveform_threshold = config('detection', 'waveform', 'threshold')
100100

101+
# evaluate
102+
if metric_values[channel_index, stimpair_index] == np.nan:
103+
return False
101104
return metric_values[channel_index, stimpair_index] > waveform_threshold
102105

103106
@staticmethod

0 commit comments

Comments
 (0)