Promote timing_source into PsychophysicalKernel primary key - #14
Merged
Conversation
Move timing_source above the schema divider so each kernel row records one fit from one clock. Drop mixed, rename nidaq to nidq, require an explicit timing_source in fetch_pooled_kernel_inputs, and enumerate available sources in key_source. Add tests for availability checks and dual-clock keys. Closes #13 Co-authored-by: Gabriel Rojas-Bowe <rojasgabriel@users.noreply.github.com>
rojasgabriel
marked this pull request as ready for review
August 12, 2026 21:24
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c2a4853. Configure here.
Closed
5 tasks
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.

Summary
Promotes
timing_sourceinto thePsychophysicalKernelprimary key so NIDQ and Bpod fits of the same config can coexist as separate rows. Drops themixedenum value and renamesnidaqtonidq.Closes #13.
Changes
labdata_plugin/analysisschema.py):timing_sourceis now part of the primary key with enumnidq/bpod.key_sourceemits one row per available timing source viaavailable_timing_sources().src/behavior_analyses/kernel_timing.py):fetch_pooled_kernel_inputsrequires an explicittiming_sourceand raises when the selected trial sets cannot supply it. No auto-prefer or silent pooling across clocks.MIGRATION.mdto reflect the key semantics.Validation
ruff check .— passruff format --check .— pass (after format)pytest tests/test_kernel_timing.py tests/test_schema_imports.py::SchemaImportTests::test_analysis_schema_imports_with_fake_labdata tests/test_cli_and_migration_contracts.py::CliContractTests— 16 passedLive populate validation (GRB006 under both clocks) requires the lab DataJoint connection and is not run in the cloud agent.
Migration note
This is a key change: drop and re-declare
PsychophysicalKernelbefore importing. Runmigrate_kernel_timing_source.py(dry run, then--apply) against the live schema after merge.