diff --git a/doc/changes/devel/12612.bugfix.rst b/doc/changes/devel/12612.bugfix.rst new file mode 100644 index 00000000000..5868fb93a2a --- /dev/null +++ b/doc/changes/devel/12612.bugfix.rst @@ -0,0 +1 @@ +Fix overflow when plotting source estimates where data is all zero (or close to zero), and fix the range of allowed values for the colorbar sliders, by `Marijn van Vliet`_. diff --git a/mne/viz/_brain/_brain.py b/mne/viz/_brain/_brain.py index 8c891969ad8..1832c1b74ff 100644 --- a/mne/viz/_brain/_brain.py +++ b/mne/viz/_brain/_brain.py @@ -869,8 +869,8 @@ def set_orientation(value, orientation_data=orientation_data): ) def _configure_dock_colormap_widget(self, name): - fmin, fmax, fscale, fscale_power = _get_range(self) - rng = [fmin * fscale, fmax * fscale] + fmax, fscale, fscale_power = _get_range(self) + rng = [0, fmax * fscale] self._data["fscale"] = fscale layout = self._renderer._dock_add_group_box(name) @@ -4157,16 +4157,15 @@ def _get_range(brain): multiplied by the scaling factor and when getting a value, this value should be divided by the scaling factor. """ - val = np.abs(np.concatenate(list(brain._current_act_data.values()))) - fmin, fmax = np.min(val), np.max(val) + fmax = brain._data["fmax"] if 1e-02 <= fmax <= 1e02: fscale_power = 0 else: - fscale_power = int(np.log10(fmax)) + fscale_power = int(np.log10(max(fmax, np.finfo("float32").min))) if fscale_power < 0: fscale_power -= 1 fscale = 10**-fscale_power - return fmin, fmax, fscale, fscale_power + return fmax, fscale, fscale_power class _FakeIren: diff --git a/tools/install_pre_requirements.sh b/tools/install_pre_requirements.sh index 280c5f60867..ac90a38612c 100755 --- a/tools/install_pre_requirements.sh +++ b/tools/install_pre_requirements.sh @@ -67,7 +67,9 @@ echo "joblib" pip install $STD_ARGS git+https://github.com/joblib/joblib echo "edfio" -pip install $STD_ARGS git+https://github.com/the-siesta-group/edfio +# Disable protection for Azure, see +# https://github.com/mne-tools/mne-python/pull/12609#issuecomment-2115639369 +GIT_CLONE_PROTECTION_ACTIVE=false pip install $STD_ARGS git+https://github.com/the-siesta-group/edfio if [[ "${PLATFORM}" == "Linux" ]]; then echo "h5io" diff --git a/tutorials/time-freq/50_ssvep.py b/tutorials/time-freq/50_ssvep.py index 706841fefac..96a2bf39ca8 100644 --- a/tutorials/time-freq/50_ssvep.py +++ b/tutorials/time-freq/50_ssvep.py @@ -641,7 +641,7 @@ def snr_spectrum(psd, noise_n_neighbor_freqs=1, noise_skip_neighbor_freqs=1): ].mean(axis=1) fig, ax = plt.subplots(1) -ax.boxplot(window_snrs, labels=window_lengths, vert=True) +ax.boxplot(window_snrs, tick_labels=window_lengths, vert=True) ax.set( title="Effect of trial duration on 12 Hz SNR", ylabel="Average SNR",