-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add validation of Neuropixels calibration files #291
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions for improving the conciseness and strictness of the code. They pertain to np 2.0 but the same suggestions can brough to 1.0 if you think they are good changes.
- Refactored code (moved to helper class) and made names consistent - Added TryParse methods for NeuropixelsV2e and NeuropixelsV1e calibration files - Refactored code to return a nullable type instead of following the conventional TryParse pattern - Added dialog elements that displays the current gain correction value from the gain calibration file - Added V2 gain correction class for easier passing of correction and SN - Display the serial number after parsing calibration files - Add a button to open a new window for the ADC values in NeuropixelsV1eDialog - Small update to size of controls and panels - Added status strip for Neuropixels V1e - Make code more concise, utilizing reactive patterns - Add try-catch when reading from file for very specific exceptions - Rename variables to use full names instead of abbreviations
- IsExternalInit is now placed is its own file, since it only needs to be defined once in a namespace for records to work
- Starting folder when browsing for calibration files is set to the previous location if it exists - File IO and access exceptions presented as MessageBoxs with error styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some minor modifications. This is ready to merge, I think.
In this PR, the calibration files for
NeuropixelsV1e
,NeuropixelsV2e
, andNeuropixelsV2eBeta
are now validated using a customTryParse
method. This applies to the ADC / gain calibration files forNeuropixelsV1e
, and the gain calibration file forNeuropixelsV2e
/NeuropixelsV2eBeta
.The
TryParse
method will validate that the file exists and can be opened, that there are the correct number of elements, and that each element is able to be parsed into the correct type. For example, the first line in each file should contain a single element, and it should beulong
for the serial number. Other elements include the channel number, gain correction value at different gain levels, or ADC values.Fixes #228
Related to #283, existing public methods for
NeuropixelsV1e
have been marked as obsolete, since they took aStreamReader
as an argument instead of the filepath. These methods are not removed or modified, since doing so would be a major revision.In addition to creating the
TryParse
method, this PR also takes advantage of these new methods by adding the correction values back into the various dialogs so that the user can view the ADC values and gain corrections that will be applied to the data based on the current gains selected. These are added at all dialog levels, so that anytime a file is selected, the gain will be updated in a textbox. For ADC values, instead of being in a tab like they were previously, they are now opened in a new window when a button is pressed. This window is modal, so the rest of the GUI is nonfunctional until the ADC window is closed.Fixes #232
While adding control elements, including a status bar to display the serial number, there were some small quality-of-life changes made to control sizes.