Repository navigation
Conversation
- Continuous data and spikes:
- sample numbers from sync/sample_numbers (new) or the legacy sync dataset
- sample rate from starting_time.rate or from the timestamps instead of
timestamps.interval (which the NWB schema fixes to 1)
- scaling: data.conversion * channel_conversion (NWB specification);
legacy files store the factor in both, so only channel_conversion is
applied for them (as before)
- TTL events from the EventsTables in /events (line, state, full_word,
sample_number), in addition to the legacy ".TTL" TimeSeries
- Implement load_messages for the new (/events/messages) and legacy
(/acquisition/messages) layouts
- Skip empty event tables (avoids int columns turning into floats)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TTL EventsTables are named "<processor>-<id>.<stream>.TTL" (or "TTL_<n>"), as the event folders of the Binary format. Event processor_id/stream_index are float64 again, as in the Binary format and earlier versions of this reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a v1.1.0 NWB test file (1.9 MB: File Reader -> Phase Detector -> Spike Detector -> Record Node recording channels 1-4 of 16, two short recordings with spikes, Phase Detector TTL events, messages and session metadata) and tests for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The NWB plugin writes one file per experiment, experiment<N>.nwb, or experiment<N>_recording<M>.nwb if experiment<N>.nwb already exists when recording M starts (e.g., after the data directory was changed between recordings and back). Open the files found in the directory, with the experiment and recording indexes taken from the file names, and order them by these numbers. Previously the file names were derived from the position in the alphabetically sorted list of files, which failed for missing experiment numbers and for 10 or more experiments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oruebel
added a commit
to NeurodataWithoutBorders/nwb-format
that referenced
this pull request
Oct 25, 2026
If the data directory is changed between recordings and the new directory already contains experiment<N>.nwb (e.g., after changing the directory and back), name the new file after the experiment and its first recording, e.g. experiment1_recording3.nwb, instead of appending the recording to the open file in the previous directory. Existing files are still never changed. This also applies when no file is open (the recording was previously not saved in NWB format in this case). Tested: recording into A, B, and A again (fixed directory name) gives A/experiment1.nwb (recording 1), B/experiment1.nwb (recording 2) and A/experiment1_recording3.nwb (recording 3); python-tools reads both files in A (open-ephys/open-ephys-python-tools#51). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Context
This PR is related to open-ephys-plugins/nwb-format#6 . This PR adds support for the NWB files written by the new AqNWB-based version of the NWB Format plugin, and keeps reading files of the previous layout. I am creating this PR here so we can test and review, however, it'll be best to wait for open-ephys-plugins/nwb-format#6 to be finalized before merging.
Changes
Continuous data and spikes
sync/sample_numbers(new layout) or from thesyncdataset (previous layout).starting_time.rateor computed from the timestamps. Previously it was read fromtimestamps.interval, which the NWB schema fixes to 1, so it can't hold the sample rate in compliant files.data.conversion * channel_conversion. Files of the previous layout store the factor in both, so onlychannel_conversionis applied for them, as before.Events and messages
EventsTables in/events(line,state,full_word,sample_number). Tables are named<processor>-<id>.<stream>.TTL(TTL_<n>for further event channels), as the event folders of the Binary format. The.TTLTimeSeries of the previous layout are still read.load_messagesis implemented for the new (/events/messages) and the previous (/acquisition/messages) layout.processor_idandstream_indexstay float64, as in the Binary format and in earlier versions of this reader.experiment<N>.nwb, andexperiment<N>_recording<M>.nwb, which the plugin writes ifexperiment<N>.nwbalready exists when recording M starts (e.g., after the data directory was changed between recordings and back). The files are ordered by experiment and recording number. Previously the file names were derived from the position in the alphabetically sorted list of files, which failed for missing experiment numbers and for 10 or more experiments.Testing
tests/data/v1.1.0_NWB(1.9 MB; GUI v1.1.0, File Reader -> Phase Detector -> Spike Detector -> Record Node recording channels 1-4 of the 16 example channels, two short recordings with spikes, Phase Detector TTL events, messages and session metadata) and four tests:test_aqnwb_continuous_data,test_aqnwb_spike_data,test_aqnwb_events,test_aqnwb_messages.main(4032c29).Note on the test file: the v1.1.0 NWB test file was recorded with the development version of the plugin (open-ephys-plugins/nwb-format#6). Once that PR is merged and released, the test file should be regenerated with the released plugin (and the tests updated if the layout changed during review). Until then, this PR should stay in draft.
Note on the Python version: the tests (and the package) need Python 3.11 or newer, also on
main:src/open_ephys/analysis/recording.pyimportsenum.StrEnum, which was added in Python 3.11, whilepyproject.tomldeclaresrequires-python = ">=3.9". With Python 3.9, importing the package fails withImportError: cannot import name 'StrEnum' from 'enum'. This PR doesn't change that; eitherrequires-pythonshould be raised to>=3.11, orStrEnumreplaced to keep supporting Python 3.9 and 3.10 (e.g., by a(str, Enum)subclass whose__str__returns the value, which is whatStrEnumadds). I can open a separate issue or PR for this if preferred.AI disclosure
🤖 Generated with the help of Claude Code