-
Notifications
You must be signed in to change notification settings - Fork 241
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
Fixing bug in checking whether the ROIs_on checkbox is checked #1029
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
landoskape
changed the title
Fixing conda environment creation statement for developers
Fixing bug in checking whether the ROIs_on checkbox is checked
Aug 30, 2023
simon-ball
added a commit
to simon-ball/suite2p
that referenced
this pull request
Oct 23, 2023
dataclass default values no longer permitted to be mutable in 3.11 (https://docs.python.org/3.11/whatsnew/3.11.html#dataclasses) Two changes needed: * Use a default_factory instead (ensures separate instances have independent values) * use a lamba to generate the same default value used previously reference MouseLand#1029
the conda create statement for the developer version was incorrect (it added the "env" argument unnecessarily) and didn't specify which python version to use. The newest python (3.11) has updates to the dataclasses module, which prevent the ROI class from working properly (in detection/stats.py) due to it's not being hashable.
state is returned as an integer (0 for unchecked, 2 for checked). When state is compared with `QtCore.Qt.Checked`, it always evaluates to False, because Qt.Checked is an enum, not an int. Processing state through QtCore.Qt.CheckState fixes this error and allows the user to toggle ROIs on and off
Following the discussion in issue MouseLand#709, I added an explanation to the docs that explains how to apply a new classifier.
Closed
As for the other PR, I created a new one without excess commit history. Can be found here: #1057 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main Request:
There was a bug in the code in the
ROIs_on
method in which the state of the checkbox was always evaulated to False. Specifically,state
is returned as an integer (0 for unchecked, 2 for checked). However, the if statement comparedstate
toQtCore.Qt.Checked
, which is an enum. Therefore, pressing spacebar or clicking the ROIs_on checkbox always tried to remove theself.color
items, generating a warning and preventing the user from toggling ROIs on and off.I fixed this by processing
state
through a Qt method that converts it to an enum, allowing successful comparison between the "checked" state with the following line:EDIT: I realized that the same issue shows up in the
roi_text
andzoom_cell
method, so fixed it there too.Fixes #1028
Minor request:
The conda create statement for developers unnecessarily included the "env" argument and didn't specify the python version. When the most recent python version is downloaded (3.11), then an update to dataclasses prevents the ROI class in detection/stats.py from working properly because a np.ndarray field is not hashable (see their update).
The fix to this issue was identified in this issue (from a different repository - huggingface/datasets#5230).