Repository navigation
docs(tutorials): rework convertTrials tutorial (ragged-array API, correctness fixes, reordered flow) - #857
Open
ehennestad wants to merge 11 commits into
Open
docs(tutorials): rework convertTrials tutorial (ragged-array API, correctness fixes, reordered flow)#857ehennestad wants to merge 11 commits into
ehennestad wants to merge 11 commits into
Conversation
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
from
September 28, 2026 20:56
12cd0e9 to
3d7e427
Compare
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
from
October 1, 2026 09:30
3d7e427 to
ff60f8e
Compare
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
2 times, most recently
from
October 1, 2026 15:01
da3b863 to
e487874
Compare
ehennestad
marked this pull request as ready for review
October 1, 2026 18:32
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## add-ragged-array-methods #857 +/- ##
=========================================================
Coverage 95.51% 95.51%
=========================================================
Files 241 241
Lines 9033 9033
=========================================================
Hits 8628 8628
Misses 405 405 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
2 times, most recently
from
October 6, 2026 15:33
3bddef0 to
294f9c3
Compare
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
from
November 12, 2026 13:38
fce94f0 to
2e9101c
Compare
2 of 3 tasks
Update the convertTrials live script tutorial. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The tutorial now lives in convertTrials.mlx, so the plain script goes. The tutorial test skips the live script because it needs the CRCNS ALM-3 dataset. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
convertTrials is a live script, so matnwb_exportTutorials selects it with the other tutorials. It needs the CRCNS ALM-3 dataset and stops at its dataset check without it. The default IgnoreFiles now lists it, next to basicUsage, which reads the file convertTrials writes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ehennestad
force-pushed
the
update-convert-trials-tutorial
branch
from
November 13, 2026 08:17
2e9101c to
f3038b8
Compare
This branch has not been deployed
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.
Depends on #855.
Motivation
Reworks the
convertTrialstutorial to use the ragged-array methods from #855 and fixes errors in the file it writes, such as a 1-basedidx_startandElectricalSeriesdata in the wrong dimension order.Problem — For someone learning trial-based conversion from the
convertTrialstutorial, the previous version taught outdated patterns and produced a subtly incorrect file. It stored spike waveforms through a workaround column, wrote null object references that breakpynwb'sto_dataframe, used a 1-basedidx_startfor its trial timeseries references (off by one for any schema-aware reader), stored the ElectricalSeries data in the wrong dimension order, and stepped through the sections in an order that made the trials table hard to follow.Solution — Rework the tutorial to use current MatNWB idioms and produce a schema-faithful,
pynwb-interoperable file, with a section order and prose that read cleanly top to bottom.What changed
waveformscolumn pluswaveform_mean/waveform_sd, built with the newaddDoublyRaggedArrayhelper — noSpikeEventSeriesworkaround.addRaggedArray, so trials without raw data simply have no reference instead of a null one (the previous null references brokepynwb'sto_dataframe).DeviceModel+Device.ObjectView/SoftLinkrather than hand-written HDF5 paths.idx_startfor trial timeseries references is now 0-basedstarting_timeandstarting_time_rateinstead of timestamps for anElectricalSerieswhose sampling is regular; a series with irregular sampling keepstimestampsElectricalSeriesdata is written as channels × time; time-unit names are normalized to NWB's plural form (e.g.seconds).toTable(); the file is checked withinspectNwbFileat the end.basicUsage.mlxupdated (it depends onconvertTrials)ElectricalSeriesowns its own electrodesDynamicTableRegion. A neurodata object has one location in the file, so a region shared across the series was exported as copies with a warning per trial.tutorials/convertTrials.mis removed; the live script replaces it. The tutorial test skipsconvertTrials.mlx, which needs the ALM-3 dataset, and the ecephys tutorial's link now points at the live script.matnwb_exportTutorialsskipsconvertTrialsin a default export, because it needs the ALM-3 dataset. It also turns the recycle bin off while it exports (recycle('off')) and restores the setting afterwards.ecephys.htmlis exported again in full from MATLAB R2024b, so its diff also holds changed styling and outputs, such asnwb_version: '2.11.0'.Implementation notes
waveformscolumn'sdata: samples down the rows, one waveform per column. The shortcut form (data{unit} = [numSamples x numSpikes]) assumes one electrode per unit, which holds for ALM-3. The tutorial documents the multi-electrode forms,data{unit}{spike} = [numSamples x numElectrodes]or one[numSamples x numElectrodes x numSpikes]array per unit.addRaggedArray/addDoublyRaggedArraymethods andutil.create_indexed_columnfrom feat(dynamictable): add addRaggedArray for ragged and doubly ragged columns #855.How to test
Requires the CRCNS ALM-3 dataset (see the links at the top of the tutorial). With
CRCNS_ALM3_ROOT_PATHpointing at the downloaded data, run the tutorial end to end:It exports
out/ANM255201_20141124.nwband finishes withinspectNwbFile. As a cross-check, the trials and units tables should read cleanly in pynwb, includingto_dataframe().Current tutorial: https://matnwb--852.org.readthedocs.build/en/852/pages/tutorials/convertTrials.html
New Tutorial: https://matnwb--857.org.readthedocs.build/en/857/pages/tutorials/convertTrials.html
Checklist
fix #XXwhereXXis the issue number?🤖 Generated with Claude Code