Skip to content

Feature request: .load_recording() #3632

Open
@cwindolf

Description

@cwindolf

Idea: it would be nice to have a function load_recording(path, stream_id=None, type=None) (or similar) which implements an if tree internally to try to guess what format a recording is. I wanted to open an issue where we can think about whether this is useful and what it could look like.

The motivation would be cases like writing spike sorting CLI tools. This function would make it possible to implement recording loading in GUI and CLI tools. Currently, tools need the user to pass in a BaseRecording of some kind, meaning that most tools rely on the user calling si.read_X() and launching the tool from within Python. For example, spikeinterface-gui takes this approach, but it could use this to implement a GUI path selector, and it could then be run from the command line or a launcher instead of from an interactive Python session. This could also make it easier for users to write format-portable scripts and make things easier for non-technical or non-python-savvy users. Future works could extend this to loading sorting outputs or other extractors.

API: not super sure. Sometimes a stream_id will be necessary; maybe in the common case where both LFP and AP are available, the AP stream can be chosen by default, or there could be a prefer_ap type flag? I imagine that some formats are ambiguous, so maybe a type= flag might be needed to allow users to override in those cases. I think it's okay if there are rare cases which are not handled by this tool.

Implementation: I think this function can start by calling load_extractor() and move on to other cases when that fails? It can raise a detailed error message in failure cases indicating that the path didn't match any of the formats tried (listing them), or it can let the format-specific loader functions raise errors about stream_ids and that kind of thing.

Curious if people have any thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestextractorsRelated to extractors module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions