Skip to content

Conversation

@h-mayorquin
Copy link
Collaborator

@h-mayorquin h-mayorquin commented Oct 20, 2025

The current block_index parameter exposes a Neo implementation detail that most users won't understand. Since Open Ephys organizes data into named experiment folders (experiment1, experiment2, etc.), I've added an experiment_name parameter that lets users specify experiments directly by folder name (e.g., experiment_name="experiment2"). I've also improved error messages to list available experiments instead of just mentioning block_index.

I add the experiment_name parameter to OpenEphysBinaryRecordingExtractor with full backward compatibility. I deprecate block_index with a FutureWarning (removal in 0.105.0) and add a get_available_experiments() class method for discovery. My implementation passes experiment_names=[experiment_name] to Neo to filter efficiently. I've enhanced the docstring with the Open Ephys binary format and how it maps to SpikeInterface concepts.

I'm also deprecating experiment_names (plural). This parameter was added to Neo in PR #1159 to handle inconsistent stream configurations across experiments, but this doesn't apply to SpikeInterface since we only load one experiment at a time. The new experiment_name (singular) is clearer for our single-block loading model and achieves the same goal of filtering out incompatible streams so the data can be loaded.

[EDIT] After discussion below, we are keeping block index.

@h-mayorquin h-mayorquin self-assigned this Oct 20, 2025
@h-mayorquin h-mayorquin added the extractors Related to extractors module label Oct 20, 2025
@h-mayorquin h-mayorquin requested a review from alejoe91 October 20, 2025 21:29
@alejoe91
Copy link
Member

alejoe91 commented Oct 21, 2025

Thanks @h-mayorquin

Please let's not deprecate block_index though! We have convenient functions to get the number of blocks and stream names for NEO extractors. These can be used to traverse the blocks/streams and are angnostic to the specific reader. Eg.

from spikeinterface.extractors import recording_extractor_full_dict

reader_type = "openephysbinary" # or any other neo
reader_kwargs = {"folder_path": "path-to-folder"}
num_blocks = se.get_neo_num_blocks(reader_type)
stream_names, stream_ids = se.get_neo_streams(reader_type)

for block_index in range(num_blocks):
    for stream_name in stream_names:
        recording = recording_extractor_full_dict[reader_type](**reader_kwargs)

Copy link
Member

@alejoe91 alejoe91 left a comment

Choose a reason for hiding this comment

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

LGTM, but let's not deprecate block_index pls :)

@h-mayorquin
Copy link
Collaborator Author

Undid the deprecation. I was thinking that only this extractor uses the block index but I realize some others do:

MaxwellRecordingExtractor, MCSRawRecordingExtractor NixRecordingExtractor,TdtRecordingExtractor

So now the logic is that you can use either but not both.

@alejoe91
Copy link
Member

Undid the deprecation. I was thinking that only this extractor uses the block index but I realize some others do:

MaxwellRecordingExtractor, MCSRawRecordingExtractor NixRecordingExtractor,TdtRecordingExtractor

So now the logic is that you can use either but not both.

Perfect!

│ │ │ │ └── timestamps.npy
│ │ │ └── events/ # Event streams
│ │ └── recording2/ # Additional recording (additional segment)
│ └── experiment2/ # Different experiment
Copy link
Member

Choose a reason for hiding this comment

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

maybe add settings_2.xml which is generated for experiment2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@alejoe91 alejoe91 merged commit 171bc0c into SpikeInterface:main Oct 23, 2025
15 checks passed
@h-mayorquin h-mayorquin deleted the add_experiment_name_to_open_ephys branch October 23, 2025 07:14
@chrishalcrow
Copy link
Member

Hello, think we'll need to pin neo to >=0.14.3 so that _parse_folder_structure is exposed. Agree?

@h-mayorquin
Copy link
Collaborator Author

Hello, think we'll need to pin neo to >=0.14.3 so that _parse_folder_structure is exposed. Agree?

Agree. I should not have used a private internal detail of neo as well : /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extractors Related to extractors module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants