Skip to content

Fix segment timing, LFP alignment, dates, units and electrode groups - #14

Draft
bendichter wants to merge 4 commits into
mainfrom
fix-reproduction-findings
Draft

bendichter wants to merge 4 commits into
mainfrom
fix-reproduction-findings

Conversation

@bendichter

Copy link
Copy Markdown
Contributor

This fixes the conversion problems reported in #9, #11, #12 and #13 that come from the conversion code. The changes were checked against the source files on our Drive, including the lab's "Maze Data How-To" document and the array notes in each session's zip. All ten DANDI:000070 sessions have been re-converted locally with the updated maze_task_unsorted pipeline, and nothing has been uploaded yet.

Maze Task (DANDI:000070)

Trial times now handle every recording segment, not only the second. Each segment starts at the end of the previous recording, or one mean inter-trial interval after the previous segment's last trial if that is later. In the five Nitschke sessions with three or more segments, trial, spike and position times no longer jump backwards.

The LFP is aligned to the trials. Array A shares a clock with the trials and is placed at each segment's offset. The source records every trial's start on both Cerebus systems (CerebusInfoA and CerebusInfoB), so array B is mapped onto array A's clock with a linear fit per segment. The fit gives 999.990 Hz for Jenkins and 999.9855 Hz for Nitschke, with residuals under 0.11 ms, which agrees with @cboulay's estimates in #11. Cross-correlating each array's spikes with its LFP's high-frequency power peaks at lag 0 (array A) or within one 10 ms bin (array B) in every segment of ses-20090912.

The session date is read from the .mat filename. The old script prepended "2009" to a month-day folder name, so the five Nitschke sessions on DANDI are dated a year early (the source files are all from 2010).

Hand and cursor positions are marked as mm. The trials gain cursor_offset (the cursor was drawn PARAMS.cursorDispY above the hand, 35 mm for Jenkins, which explains the hand ending below the target in #12), and the fields the how-to recommends: offline_move_onset_time, offline_reaction_time, active_target and unhittable. hit_target_position was indexed by position in the list of kept trials instead of by trial, and took the last target when none was hit. Both are fixed.

The Units table is described as unsorted threshold crossings, one per electrode (every entry in SU.unitLookup has Blackrock unit code 0), with a 30 kHz resolution. The 65,536 spike split between units 0 and 1 (#9) came from the hdmf version used in 2021, and the re-converted files no longer have it.

The maze_task_unsorted pipeline now handles both monkeys, finds a session's recordings and date from its folder, runs on current neuroconv, and adds HERD references for the species (NCBITaxon) and both arrays (UBERON). The HERD support needs neuroconv main until the next release, so environment.yaml pins it. Jenkins's age is set to "/", since his date of birth is unknown.

Center-Out Task (DANDI:000121)

Each unit's electrode_group now matches its electrode row; they were swapped between M1 and PMd. Positions are marked as mm, is_successful is described as the rig's trial success flag, and the Units table is described as threshold crossings. The LFP timing problems from #11 are not addressed here, and this pipeline still uses nwb_conversion_tools, so it needs porting to neuroconv before 000121 can be re-converted.

Testing

All ten 000070 sessions converted without errors. In every file, trials and each unit's spike times run forward in time, and each LFP segment starts where the previous one ends. NWB Inspector reports only a missing subject description. An Encore check of the re-converted files against the paper is running now.

Two things are open. The LFP voltage scale is still 1 µV per bit, as in the published files, because these NSx 2.1 files carry no scaling. Also, the old maze_task pipeline received the same extractor fixes but cannot be installed with a fixed hdmf, so the re-conversion should use maze_task_unsorted.

🤖 Generated with Claude Code

bendichter and others added 4 commits October 23, 2026 11:03
Maze task (DANDI:000070): trial times now handle every recording segment
restart, not only the first, so sessions with three or more segments no
longer jump backwards in time. When the recording durations are known,
each segment starts no earlier than the end of the previous recording.
The neuroconv converter uses this to place each LFP segment at the same
offset as its trials. Hand and cursor positions are marked as mm, the
hand's y offset is described, and the session date is read from the mat
filename instead of assuming 2009.

Center-out task (DANDI:000121): each unit's electrode_group now matches
the group of its electrode row (they were swapped between M1 and PMd),
positions are marked as mm, and the is_successful description now says
what the column holds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The maze source records each trial's start on both Cerebus systems, so
array B is now mapped onto array A's clock with a per-segment linear fit
instead of left unaligned. Trials gain the cursor offset, the offline
movement onset and reaction time, the accessible target, and the
unhittable flag described in the lab's how-to. hit_target_position was
indexed by position in the list of kept trials instead of by trial, and
took the last target when none was hit; both are fixed.

The neuroconv session script now handles both monkeys, finds the
recordings and date from the session folder, and runs on neuroconv
0.10. Units are described as unsorted threshold crossings with a 30 kHz
resolution, and the LFP series keep their published names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Macaca mulatta maps to NCBITaxon:9544, the PMd array to UBERON premotor
cortex and the M1 array to UBERON primary motor cortex. This needs the
ExternalResources support on neuroconv main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

1 participant