Skip to content

Commit 75116b6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 373cf64 commit 75116b6

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/spikeinterface/qualitymetrics/misc_metrics.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,16 @@ def compute_noise_cutoffs(sorting_analyzer, high_quantile=0.25, low_quantile=0.1
8888
amplitude_extension = sorting_analyzer.get_extension("spike_amplitudes")
8989
peak_sign = amplitude_extension.params["peak_sign"]
9090
if peak_sign == "both":
91-
raise TypeError('`peak_sign` should either be "pos" or "neg". You can set `peak_sign` as an argument when you compute spike_amplitudes.')
91+
raise TypeError(
92+
'`peak_sign` should either be "pos" or "neg". You can set `peak_sign` as an argument when you compute spike_amplitudes.'
93+
)
9294

9395
amplitudes_by_units = _get_amplitudes_by_units(sorting_analyzer, unit_ids, peak_sign)
9496

9597
for unit_id in unit_ids:
9698
amplitudes = amplitudes_by_units[unit_id]
9799

98-
# We assume the noise (zero values) is on the lower tail of the amplitude distribution.
100+
# We assume the noise (zero values) is on the lower tail of the amplitude distribution.
99101
# But if peak_sign == 'neg', the noise will be on the higher tail, so we flip the distribution.
100102
if peak_sign == "neg":
101103
amplitudes = -amplitudes
@@ -169,18 +171,18 @@ def _noise_cutoff(amps, high_quantile=0.25, low_quantile=0.1, n_bins=100):
169171
return np.nan, ratio
170172

171173
if len(high_indices) == 1:
172-
warnings.warn("Only one bin is selected as the reference region, and thus the standard deviation cannot be computed. " \
173-
"Please increase high_quantile.")
174+
warnings.warn(
175+
"Only one bin is selected as the reference region, and thus the standard deviation cannot be computed. "
176+
"Please increase high_quantile."
177+
)
174178
return np.nan, ratio
175179

176180
# compute cutoff from low-amplitude and high-amplitude bins
177181
high_counts = n_per_bin[high_indices]
178182
mean_high_counts = np.mean(high_counts)
179183
std_high_counts = np.std(high_counts)
180184
if std_high_counts == 0:
181-
warnings.warn(
182-
"All the high-amplitude bins have the same size. Please consider changing n_bins."
183-
)
185+
warnings.warn("All the high-amplitude bins have the same size. Please consider changing n_bins.")
184186
return np.nan, ratio
185187

186188
cutoff = (mean_low_counts - mean_high_counts) / std_high_counts

0 commit comments

Comments
 (0)