Skip to content

Rename read_openephys to read_openephys_neuropixels and add a helper to detect Neuropixels streams #411

@h-mayorquin

Description

@h-mayorquin

read_openephys only handles Neuropixels probes (it parses NP_PROBE XML elements from settings.xml and calls build_neuropixels_probe), but its generic name suggests it works for any OpenEphys recording. This is misleading for users who are not familiar with the library and could lead to errors when they try to use it with non-Neuropixels OpenEphys recordings (Intan acquisition boards, tetrodes, silicon probes with RHD headstages, etc.). I propose renaming it to read_openephys_neuropixels. The old read_openephys name would remain as a thin wrapper that issues a FutureWarning and delegates to the new function.

The internal detection logic (neuropixels_tools.py#L1112-L1139) decides whether a recording is Neuropixels by matching processor name strings ("Neuropix-PXI", "OneBox", "ONIX"). The problem is that processor names identify which plugin acquired the data, not whether Neuropixels probe geometry is present. ONIX, for example, can stream both Neuropixels and non-Neuropixels probes (see supported headstages), so matching on "ONIX" doesn't answer the right question. A more direct check is whether the settings.xml actually contains NP_PROBE elements (or the ONIX equivalents NEUROPIXELSV1E, NEUROPIXELSV1F, NEUROPIXELSV2E) for the requested stream. Those elements are what the function needs to build the probe, so their presence is the ground truth for "this stream has Neuropixels geometry." I think we should extract this check into a small helper, something like has_neuropixels_probes(settings_file, stream_name=None) -> bool, so callers can ask "does this stream have Neuropixels geometry?" before calling read_openephys_neuropixels, rather than calling it with raise_error=False and interpreting a None return.

I am aware that in SpikeInterface we already work around this with the raise_error=False pattern (openephys.py#L357-L362), but I still think the current naming is confusing and the detection logic should be explicit rather than relying on a silent None return to mean "this isn't a Neuropixels stream."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions