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

Neuropix configuration #1

Merged
merged 32 commits into from
Mar 4, 2025
Merged

Neuropix configuration #1

merged 32 commits into from
Mar 4, 2025

Conversation

bparks13
Copy link
Member

@bparks13 bparks13 commented Jan 7, 2025

This is a draft PR so that we can start picking and choosing which features to carry over when we scrap this plugin and start over. The main feature in this PR is porting over the Neuropixels Canvas so that users can choose which channels are active, as well as all of the usual gain settings. There are significant changes made compared to how the neuropixels-pxi plugin is configured due to the fact that we do not use the Neuropixels API, nor do we use the Basestations and other NPX-specific hardware. This is simply a port of the look-and-feel of the canvas.

This is still a work-in-progress and is not guaranteed to be fully functional; it is a proof of concept for gaining knowledge on what is needed to build this again in a new plugin.

Edit:
These changes have reached a mostly stable point, with edits to the editor, addition of a canvas, and a much more robust read/distribute frame infrastructure. This is now ready to be reviewed, and merged into main before continuing the regular development cycle of creating issues and then creating individual branches to fix specific issues.

bparks13 and others added 13 commits September 30, 2024 11:04
- This only applies to the BNO that is not operated in passthrough mode
- Set port voltage and refresh devices from the editor
- Disable buttons during acquisition
- Update header to match variable name
- Correctly read/write bytes that are I2C addresses
- Correctly stream BNO data
- Switch order of processing; frame distribution is quickly processed on the DataThread, then process frames in individual device threads
- Added most functionality needed to parse gain/adc calibration files. still need to finish and test
- Added the isReady() method
- Fixed AP frame indexing
- Added checks during Read/WriteBytes for invalid return codes
- Much of the code is pulled from the neuropixels-pxi plugin, and modified for use with Onix1 classes
- All settings now directly reference the device the settings are saved in, to minimize the possibility of error with needing to manually update settings inside the canvas itself
- Renamed variables / methods where needed for clarity
- Removed extraneous variables and methods
- Save the passthrough Toggle editor so it can be manipulated more easily
@bparks13 bparks13 requested a review from jonnew January 7, 2025 16:38
- Remove tabs in the canvas when rescanning the device table
- Connect the probe settings in the canvas to the Npxv1e device, and update these settings before starting acquisition
- Use PathParameters to track the path used for calibration files of Neuropixels probes
- Change size of the viewport to minimize the appearance of scrollbars
- Add DeviceList.h
- Change the editor button from "Rescan" to "Scan"
- Fixed some enum class underlying types
- Added helper methods to find the gain / reference of Npx probes
- Each OnixDevice must now implement a method that adds the sourceBuffers and correctly assigns them to their respective internal pointer
- When updating Settings, clear the buffers and only add back the devices that are enabled to ensure that the buffers are indexed correctly
- Instead of spawning a new thread for every device, have one thread that is dedicated to reading frames, and another thread that is dedicated to adding data to buffers
- Now that individual devices are not threaded, no need to keep the inheritance
- Remove unnecessary NeuropixComponents.cpp file
- Small optimizations: Convert raw pointers to unique_ptrs where possible, change the order when stopping acquisition so that streaming frames are stopped before reading frames stops, clear all portTabs when resetting the canvas, remove extraneous variables / methods
- The device table will only be scanned when the user presses Scan
- Related: The plugin will not report it is connected to hardware until Scan has been pressed
- Instead of Scan, there is a Connect button that when pressed will connect to Onix hardware, and then it will be labelled as Disconnect
- Disconnecting sets the port voltage to zero
- In the plugin destructor, the port voltage is also set to zero
- Shows options for both ports
- Added combo box for available headstages
- Removed the voltage value from automatically appearing, added a tooltip indicating that it is a voltage override
…tage discovery

- Moves the port voltage modifications, and checking the link state, to the new PortController class
- Add macros for checking the results of register read/writes to OnixDevice
- Ensures that the context is reset correctly so that devices stream data
- Automated port voltage discovery uses the same logic as OpenEphys.Onix1
- Changed the order of operations during stopAcquisition so that bad frames aren't read due to the context resetting
- Fixed an issue where PathParameters were being set with a value other than the default
@bparks13 bparks13 requested a review from aacuevas February 3, 2025 15:12
@bparks13 bparks13 marked this pull request as ready for review February 3, 2025 15:12
@bparks13 bparks13 added this to the Neuropixels 1.0f milestone Feb 4, 2025
@bparks13 bparks13 self-assigned this Feb 4, 2025
@jonnew
Copy link

jonnew commented Feb 25, 2025

Ill be adding comments here as a work with this library.

@jonnew
Copy link

jonnew commented Feb 25, 2025

The LOAD FROM JSON button does not reload the calibration file paths. I think that it should because its a reasonable starting position for e.g. the next probe you put in there to start navigation to new file.

image

@jonnew
Copy link

jonnew commented Feb 25, 2025

When I press play, I get the following message at the bottom of the screen.

image

Aside from figuring out what's going on here, refrain from using exclamation points in messages. It ends up "raising the temperature" of the interaction rather than guiding the user towards a solution.

@jonnew
Copy link

jonnew commented Feb 25, 2025

When acquisition starts, a modal window pops up indicating that the neuropixels are being "updated". It should really say that calibration data is being loaded to the headstagage and I would like a progress bar instead of the barbershop poll thing.

Copy link

@jonnew jonnew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall on the right track. I put individual comments that need to be addressed and several new issues. The biggest concern i have right now is actually performance. We need this to be at least as performant as the PXI plugin (e.g. with respect to plotting data). Is #20 a problem with the LFP viewer or this plugin's interaction with the LFP viewer?

- Wrap ONI context in its own class
- Update text when writing calibration files to Neuropixels_1
- Show explicit progress bar instead of infinite bar when writing calibration files
- Ensure that AP/LFP data is converted correctly based on current gains
@bparks13 bparks13 requested a review from jonnew February 27, 2025 19:49
@bparks13
Copy link
Member Author

@jonnew This PR is now ready for a second review. One thing to highlight is #20 can be circumvented by changing the renderer as noted in the issue. This does not appear to be stemming from the plugin, so I don't think we can do anything about it right now.

Copy link

@jonnew jonnew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved during video call.

@bparks13 bparks13 merged commit 8b82d22 into main Mar 4, 2025
@bparks13 bparks13 deleted the neuropix-configuration branch March 4, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaling of ephys data in Neuripixels_1.cpp.ProcessFrame() is icorrect
3 participants