Skip to content

Promote timing_source into PsychophysicalKernel primary key - #14

Merged
rojasgabriel merged 3 commits into
devfrom
cursor/cursor-775b
Aug 12, 2026
Merged

Promote timing_source into PsychophysicalKernel primary key#14
rojasgabriel merged 3 commits into
devfrom
cursor/cursor-775b

Conversation

@rojasgabriel

Copy link
Copy Markdown
Owner

Summary

Promotes timing_source into the PsychophysicalKernel primary key so NIDQ and Bpod fits of the same config can coexist as separate rows. Drops the mixed enum value and renames nidaq to nidq.

Closes #13.

Changes

  • Schema (labdata_plugin/analysisschema.py): timing_source is now part of the primary key with enum nidq / bpod. key_source emits one row per available timing source via available_timing_sources().
  • Loader (src/behavior_analyses/kernel_timing.py): fetch_pooled_kernel_inputs requires an explicit timing_source and raises when the selected trial sets cannot supply it. No auto-prefer or silent pooling across clocks.
  • Tests: Updated kernel timing tests; added coverage for availability checks and dual-clock keys sharing a fit config.
  • Docs: Updated MIGRATION.md to reflect the key semantics.

Validation

  • ruff check . — pass
  • ruff 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 passed

Live 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 PsychophysicalKernel before importing. Run migrate_kernel_timing_source.py (dry run, then --apply) against the live schema after merge.

Open in Web Open in Cursor 

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
rojasgabriel marked this pull request as ready for review August 12, 2026 21:24

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread labdata_plugin/analysisschema.py
Comment thread src/behavior_analyses/kernel_timing.py
@rojasgabriel
rojasgabriel merged commit eead296 into dev Aug 12, 2026
4 checks passed
@rojasgabriel
rojasgabriel deleted the cursor/cursor-775b branch August 12, 2026 23:01
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.

Make timing_source part of the PsychophysicalKernel key, drop mixed, rename nidaq to nidq

2 participants