Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Brain slider ranges #12612

Merged
merged 3 commits into from
May 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading