open-ephys / bonsai-onix1

Bonsai library for the Open Ephys Onix Acquisition System
https://open-ephys.github.io/onix1-bonsai-docs
MIT License
4 stars 3 forks source link

Add validation of Neuropixels calibration files #291

Closed bparks13 closed 3 weeks ago

bparks13 commented 4 weeks ago

In this PR, the calibration files for NeuropixelsV1e, NeuropixelsV2e, and NeuropixelsV2eBeta are now validated using a custom TryParse method. This applies to the ADC / gain calibration files for NeuropixelsV1e, and the gain calibration file for NeuropixelsV2e/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 be ulong 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 a StreamReader 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.