How to work with multi-recording HDF5 files

A single HDF5 file can contain multiple recordings (e.g. two probes from the same session) and multiple pyramidal scales of each recording. This guide shows how to list, select, and read from them.

Inspect an HDF5 file

from lfpack import LFPackReader

# List recordings in the file
recordings = LFPackReader.recordings("multi.lf.h5")
print(recordings)   # e.g. ['probe00', 'probe01']

# List available scales for a recording
scales = LFPackReader.scales("multi.lf.h5", "probe00")
print(scales)       # e.g. [0, 1, 2]  (0 = full resolution)

Open a specific recording

sr = LFPackReader("multi.lf.h5", recording="probe00")
traces = sr[0:1000]

If the file contains only one recording, recording can be omitted and it is selected automatically.

Open a downsampled scale

# Scale 1 is spatially downsampled (half the channels)
sr = LFPackReader("multi.lf.h5", recording="probe00", scale=1)

Scale 0 is always the full-resolution recording. Higher scale indices correspond to progressively coarser spatial representations.

Write a multi-recording file

See how to write your own lfpack file.