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

refactor thresholding/masking to avoid duplication #4292

Open
Remi-Gau opened this issue Feb 28, 2024 · 0 comments
Open

refactor thresholding/masking to avoid duplication #4292

Remi-Gau opened this issue Feb 28, 2024 · 0 comments
Assignees
Labels
Code quality This issue tackles code quality (code refactoring, PEP8...).

Comments

@Remi-Gau
Copy link
Collaborator

tried plotting some things and I don't see anything obviously wrong. Since the lines you added back only address the threshold part of the masking (not the vmin/vmax parts of the _threshold function I added), I don't think it would break anything. However, it might be confusing/not optimal to have 2 places in a function where thresholding/masking is done? I checked and the reason why I moved the thresholding further down in that function is because, for glass brain plotting with custom vmin, the thresholding needed to be done after we take the absolute value of the data if plot_abs is True (otherwise we incorrectly lose whatever is lower than vmin), but for some reason the absolute value is only taken in GlassBrainAxes.transform_to_2d, which gives the 2D views to be plotted in each panel. It doesn't look like there is currently an easy way to take the absolute value of the whole 3D data (possibly because plot_abs is only for glass brain plots?), but maybe we can add a plot_abs parameter to the slicer objects and do the absolute value handling inside _map_show?

Anyway if this needs to be fixed as soon as possible I think your fix should be fine, but in the future we might want to consider not having the double thresholding/masking part.

Originally posted by @michellewang in #4256 (comment)

@Remi-Gau Remi-Gau added the Code quality This issue tackles code quality (code refactoring, PEP8...). label Feb 29, 2024
@Remi-Gau Remi-Gau self-assigned this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code quality This issue tackles code quality (code refactoring, PEP8...).
Projects
None yet
Development

No branches or pull requests

1 participant