Skip to content

SpikeInterface objects and xarray DataTree conversion functions #3929

Open

Description

@JulienBrn

Hi,

I use xarray datatypes for most of my scripts and I feel all spikeinterfaces objects could fit in the xarray datatree datatype with almost no drawback (we keep lazyness, chunks, ...). I would really enjoy to be able to use spikeinterface objects and functions for most of my pipeline, but every now and then, have a function to convert to a xarray datatree and vice-versa (perhaps requiring a specific structure of the datatree).

Are conversions functions from and to xarray datatree a feature that may be added to SpikeInterface in the future?

In a more broad function, my understanding of spikeinterface machinery is that it has its own chunk/lazyness handler, and those mostly operate on time chunks. Would there be any drawback in using xarray with Dask as back-end instead, except for the complete code overhaul ?

Activity

  1. zm711 commented on May 16, 2025

    @zm711
    Member

    @samuelgarcia and @alejoe91 should comment here :)

  2. added
    question
    on May 16, 2025
  3. samuelgarcia commented on Jun 2, 2025

    @samuelgarcia
    Member

    Hi @JulienBrn
    I started a similar idea last year on the neo project. See theses functions https://github.com/NeuralEnsemble/python-neo/blob/master/neo/rawio/xarray_utils.py
    This works is quite unfinished. It works only when the file is binary at the moment.

    Making a direct wrapper on top of sikeinterface object would be very tricky because we would need the internal structure of the underlying formats (binary, zarr, hdf5, or any other type).

    Restarting from sractch spikeinterface on top of xarray could be an interesting theorical discussion but will certainly will stay a discussion. spikeinterface like many other projects has been built in the good old fashion cutsom classes + numpy under the wood, this looks very cuting edge today but the code is quite easy to read.

  4. JulienBrn commented on Jul 2, 2025

    @JulienBrn
    Author

    Making a direct wrapper on top of sikeinterface object would be very tricky because we would need the internal structure of the underlying formats (binary, zarr, hdf5, or any other type).

    Couldn't we just convert the lazy arrays into dask arrays without caring about the underlying format ?

  5. JulienBrn commented on Jul 16, 2025

    @JulienBrn
    Author

    I'll elaborate on my previous answer: could we not construct a dask delayed using recording.get_traces for each chunk, thus without caring about the underlying file format?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions