cogpy.io.ecog_io
ECoG file I/O: load, save, and convert grid ECoG recordings.
Note
Lab-internal module. Assumes the binary .dat + XML
metadata layout used in the Bhatt Lab. Not part of the stable public
API — external users should prefer cogpy.io.converters.
Provides helpers that read raw binary (.dat) and Zarr files into
xarray.DataArray objects with standardised (AP, ML, time) dimensions
and an fs attribute. Large files are loaded as dask-backed arrays so
they stay out of RAM until needed.
Matrix convention note
Python (C-order / row-major) stacks as (AP, ML):
sigx_flat = sigx.stack(ch=("AP", "ML")) # time, ch=(AP, ML)
MATLAB (F-order / column-major) stacks as (ML, AP):
sigx_flat = sigx.stack(ch=("ML", "AP")) # time, ch=(ML, AP)
Functions that accept external arrays (e.g. from_arr()) let you
specify axis indices so both conventions are handled.
Functions
|
Validate that sigx has the expected ECoG schema (dims + fs). |
|
Write a DataArray to Zarr with a dask progress bar. |
|
Write a Dataset to Zarr with a dask progress bar. |
|
Converts a numpy array to an xarray.DataArray and selects a time slice. |
|
Creates a memory-mapped (dask) array from a .dat file, reshaped to (num_channels, num_samples). |
|
Load a combined ECoG + Neuropixels binary and split into two arrays. |
|
Load the first nsamples from an Open Ephys recording directory. |
|
Save a NumPy array to a flat binary |
|
Split a combined ECoG + Neuropixels file and save each to Zarr. |
|
Write a DataArray or Dataset to Zarr (dispatches by type). |
|
Convert a Zarr ECoG file to flat binary |