Add np_sync module for VR-to-NP barcode alignment and tests - #343
Open
CeliaBenquet wants to merge 39 commits into
Open
Add np_sync module for VR-to-NP barcode alignment and tests#343CeliaBenquet wants to merge 39 commits into
CeliaBenquet wants to merge 39 commits into
Conversation
…ws to restrict session combos
CeliaBenquet
force-pushed
the
celia/add-batch-tables
branch
from
August 5, 2026 13:51
25590e9 to
25ba627
Compare
…ng and enhance ExcludedDataset pattern matching logic
Signed-off-by: Célia Benquet <32598028+CeliaBenquet@users.noreply.github.com>
This file contains hidden or 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
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.
This pull request introduces a new pipeline for aligning VR (behavior) time to Neuropixels (NP) native time using shared barcode events, along with documentation and unit tests. The main changes include adding the barcode alignment fitting logic, a DataJoint table for storing and applying the alignment, and updating configuration and documentation to support and describe the new functionality.
Barcode alignment pipeline for VR-to-NP time synchronization:
vr4mice/analysis/np_sync.pyimplementing the barcode alignment logic, including a dataclassBarcodeAlignmentFitand thealign_barcodesfunction to fit a linear mapping and interpolator from VR to NP time using shared barcode events.BarcodeSyncinvr4mice/schema/np_sync.pyto store the fitted alignment for each dataset/recording/DAQ, with methods to convert VR times to NP times using either the interpolator or the linear fit. This table handles missing data gracefully and logs errors.Configuration and integration:
.env.compose.exampleanddocker-compose.ymlto mount thenp_pipelinesource directory into the container, ensuring that the VR pipeline can import NP schema definitions for alignment.Documentation:
docs/software/datajoint.md) to include the new barcode alignment table and describe its dependencies and usage.Testing:
test_np_sync.py, covering correct recovery of known fits, handling of missing values, skipping of unreliable early events, and correctness of the interpolator.This PR introduces a new utility for aligning VR and Neuropixels (NP) event streams using shared barcode values, along with its configuration and unit tests. The main addition is a function that computes a linear mapping and interpolator from VR event times to NP event times based on shared barcodes, addressing issues with unreliable early events. The changes also include Docker configuration updates to ensure the necessary code is available in the container.Barcode alignment utility:
align_barcodesfunction andBarcodeAlignmentFitdataclass invr4mice/analysis/np_sync.pyto compute a linear regression and interpolator from VR to NP time using shared barcode events, with an option to skip unreliable early events.tests/unit/test_np_sync.pyto verify correct recovery of linear fits, handling of missing/extra barcodes, skipping of early events, and the interpolator’s accuracy.Docker and environment configuration:
NP_PIPELINE_SRC_PATHto.env.compose.exampleto specify the path to the requirednp_pipelinesource code for imports.docker-compose.ymlto mount thenp_pipelinesource directory into the container using the new environment variable.