Skip to content

Add NIDAQ-aligned session psychophysical kernel - #31

Merged
rojasgabriel merged 5 commits into
mainfrom
cursor/cursor-1523
Aug 3, 2026
Merged

Add NIDAQ-aligned session psychophysical kernel#31
rojasgabriel merged 5 commits into
mainfrom
cursor/cursor-1523

Conversation

@rojasgabriel

@rojasgabriel rojasgabriel commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an ephys-only, session-level psychophysical-kernel analysis for GRB006.

  • PsychophysicalKernelParam: versioned fixed-bin, observation-window, evidence-encoding, CV, and regularization settings.
  • SessionPsychophysicalKernel: one NIDAQ-aligned kernel per Session × PsychophysicalKernelParam.
  • src/utils/psychophysical_kernel.py: fixed 100 ms bins, unobserved late bins represented as NaN, complete-case prefix fitting, L2 logistic CV, fitted-set majority baseline, and Odoemene Eq. 5-style trial-rate contrasts.
  • psychophysical_kernel_diagnostics.py: populate and diagnostic-figure entrypoint.
  • Focused unit tests cover coding, timing windows, missing bins, Eq. 5 fitting, and determinism.

Scope relative to behavior_analyses

The pooled behavior_analyses.PsychophysicalKernel table remains the canonical LabData surface for purely behavioral pooled fits. This PR does not replace or duplicate that table.

This session table stays in ephys because its center-exit and response windows require NIDAQ EventMapping. A read-only reconciliation against a one-session pooled fit confirmed that the behavioral table can fit the same session, but cannot reproduce these fixed NIDAQ windows or the locked Eq. 5 analysis.

Live validation and interpretation

Four rows were populated for GRB006 20240821_121447: the original max-rate variants and the locked trial-rate center/response variants. The locked center and response fits both performed below their fitted-set majority baselines, and the early/late label changed under principal sensitivity checks.

The result is diagnostic only: it does not support an early- versus late-integrator claim or a directional link to the V1 category time course.

Verification

  • uvx --from ruff==0.15.0 ruff check .
  • uvx --from ruff==0.15.0 ruff format --check .
  • uvx --from ty==0.0.37 ty check
  • python -m unittest discover -s tests — 29 passed
  • git diff --check

The final corrective commit also instantiates the DataJoint computed table before populate and widens the heterogeneous extraction result annotation, resolving all six prior ty diagnostics.

cursoragent and others added 5 commits July 28, 2026 23:38
Implement residual-rate kernel math with NaN masking for unseen late
bins, persist results in PsychophysicalKernel, and add unit tests plus a
diagnostic plotting entrypoint for GRB006 session validation.

Co-authored-by: Gabriel Rojas-Bowe <rojasgabriel@users.noreply.github.com>
Parameterize PsychophysicalKernelParam with observation_window so the
same residual-rate fit can be run on fixation-only flashes or on all
flashes through the response poke, and overlay both in diagnostics.

Co-authored-by: Gabriel Rojas-Bowe <rojasgabriel@users.noreply.github.com>
Add concise Odoemene/Huk/Katz/Yates/Okazawa references in the style of
spks metrics, so residual-rate evidence and early/late labels are
traceable from the code.

Co-authored-by: Gabriel Rojas-Bowe <rojasgabriel@users.noreply.github.com>
@rojasgabriel rojasgabriel changed the title Add GRB006 psychophysical kernel DataJoint table Add NIDAQ-aligned session psychophysical kernel Aug 3, 2026
@rojasgabriel
rojasgabriel marked this pull request as ready for review August 3, 2026 20:16
@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@rojasgabriel
rojasgabriel merged commit 4c8ae98 into main Aug 3, 2026
6 checks passed
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.

2 participants