Skip to content

Commit

Permalink
Merge branch 'main' into tfce-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored May 17, 2024
2 parents dad599a + 5a20b82 commit 41ee73b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/changes/devel/12612.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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`_.
11 changes: 5 additions & 6 deletions mne/viz/_brain/_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tools/install_pre_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tutorials/time-freq/50_ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 41ee73b

Please sign in to comment.