actual final fixes for new version

This commit is contained in:
2026-08-31 22:30:24 -07:00
parent 71b6280cc2
commit 2fe6f42c48
2 changed files with 7 additions and 2 deletions
+4 -1
View File
@@ -1365,12 +1365,15 @@ def calculate_peak_power(data: BaseRaw, time_window: int = 3, threshold: float =
psp = scores.mean(axis=1)
bad_channels = list(compress(cast(list[str], data.ch_names), psp < threshold))
plot_data = data.copy()
plot_data.info["bads"] = bad_channels
existing_bads = set(data.info.get("bads", []))
data.info["bads"] = list(existing_bads | set(bad_channels))
# Determine the colors based on the threshold, and create the figures
color_stops = ([0.0, threshold, threshold+0.1, threshold+0.2, 1.0], [0.0, threshold, threshold, 1.0])
psp1, psp2 = plot_timechannel_quality_metrics(data, scores, times, color_stops, threshold, "Peak Spectral Power")
psp1, psp2 = plot_timechannel_quality_metrics(plot_data, scores, times, color_stops, threshold, "Peak Spectral Power")
return list(compress(cast(list[str], getattr(data, "ch_names")), psp < threshold)), psp1, psp2