From c5734386d11642f50efe6c59f5f988ffa46642aa Mon Sep 17 00:00:00 2001 From: Thomas Samuel Binns Date: Mon, 13 Jan 2025 20:59:46 +0000 Subject: [PATCH] Fix error checking --- mne/time_frequency/spectrum.py | 12 ++++++------ mne/time_frequency/tfr.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mne/time_frequency/spectrum.py b/mne/time_frequency/spectrum.py index f7a61e3e57e..167e7eea6d3 100644 --- a/mne/time_frequency/spectrum.py +++ b/mne/time_frequency/spectrum.py @@ -1689,12 +1689,12 @@ def combine_spectrum(all_spectrum, weights="nave"): ch_names = spectrum.ch_names for s_ in all_spectrum[1:]: - assert s_.ch_names == ch_names, ValueError( - f"{spectrum} and {s_} do not contain the same channels" - ) - assert np.max(np.abs(s_.freqs - spectrum.freqs)) < 1e-7, ValueError( - f"{spectrum} and {s_} do not contain the same frequencies" - ) + assert ( + s_.ch_names == ch_names + ), f"{spectrum} and {s_} do not contain the same channels" + assert ( + np.max(np.abs(s_.freqs - spectrum.freqs)) < 1e-7 + ), f"{spectrum} and {s_} do not contain the same frequencies" # use union of bad channels bads = list( diff --git a/mne/time_frequency/tfr.py b/mne/time_frequency/tfr.py index 918fea1a33f..b1736f151d2 100644 --- a/mne/time_frequency/tfr.py +++ b/mne/time_frequency/tfr.py @@ -3960,12 +3960,12 @@ def combine_tfr(all_tfr, weights="nave"): ch_names = tfr.ch_names for t_ in all_tfr[1:]: - assert t_.ch_names == ch_names, ValueError( - f"{tfr} and {t_} do not contain the same channels" - ) - assert np.max(np.abs(t_.times - tfr.times)) < 1e-7, ValueError( - f"{tfr} and {t_} do not contain the same time instants" - ) + assert ( + t_.ch_names == ch_names + ), f"{tfr} and {t_} do not contain the same channels" + assert ( + np.max(np.abs(t_.times - tfr.times)) < 1e-7 + ), f"{tfr} and {t_} do not contain the same time instants" # use union of bad channels bads = list(set(tfr.info["bads"]).union(*(t_.info["bads"] for t_ in all_tfr[1:])))