ezmsg.nwb.util#
Module Attributes
Above this many values, |
Functions
- as_text(value)[source]#
One HDF5 value as text, whichever string flavour the writer used.
Which one you get depends on who wrote the file. pynwb stores text as variable-length UTF-8 and h5py hands it back as
str; writers that declare their stringsH5T_CSET_ASCII(aqnwb, and so every recording Orion writes) read back asbytes, because hdmf keys its decoding decision directly off the character set.str(value)is not a safe substitute: onbytesit yields the repr"b'cond_0'", which compares equal to nothing and parses as no JSON – a corruption that no exception announces.
- build_nwb_fname(metadata)[source]#
Build a default NWB filename from the session metadata.
- Return type:
- Parameters:
metadata (DeepDict)
- interval_median(values)[source]#
Median of a set of inter-sample intervals, cheaply.
For intervals specifically, and not for residuals or other continuous quantities: timestamps arrive on a device’s quantisation grid, so their differences cluster onto that grid and the median snaps to a grid point a stride cannot move. On a real 7.09M-interval stream, strides of 16 through 1024 all return 3.3301000002e-05. That is what makes the shortcut exact here and not elsewhere – a median of fit residuals, say, is a continuous quantity with no grid to snap to, and subsampling it would genuinely change the answer.
Strided rather than random or head-of-array: a stride samples the whole recording, so a stream whose intervals differ between its start and its end is represented across the estimate rather than by whichever part was read.
- is_zarr_array(dset)[source]#
A zarr-backed array: what NWBZarrIO hands back where NWBHDF5IO hands back an h5py dataset (
hdmf_zarr’s wrapper, or a barezarrarray).
Classes