Closed dkluger closed 1 year ago
I made quite a few changes in 2f06cf6. I'm sure I'm forgetting some, but here's what I can remember, in no particular order:
MAX_SAMP_PER_S
with self.basic_header["SampleResolution"]
in case we every get away from 30_000 base sampling frequency.full_timestamps
kwarg. Setting to True will return per-sample timestamps for each segment. These might be the recorded timestamps, or idealized timestamps if either old filespec or ptp times and not force_srate. Default is False
which preserves previous behaviour.elec_rows
kwarg. Setting False (True by default) will return the data with shape (samples, channels), which is C-contiguous w.r.t. how it is stored on disk. True preserves previous behavior.zeropad
functionality which had been commented out, even though the kwarg remained. Will print a deprecation warning if set True.The data loading is now lazy, and as such is no longer deferred until after header inspection. This simplifies logic and lazy-loading drastically speeds up function return time. The data won't be loaded into memory until the user slices the data. If they are only slicing specific segments, or using a rolling-window for analysis, this will lead to greater performance and few memory bottlenecks.
However, using either zeropad
or force_srate
might cause the data to be loaded into memory because the returned array is modified with data not on disk, so it's impossible to do lazy-loading.
@dkluger , this probably needs a re-review now, but I'll mark it as ready.
This is a pull request for merging in changes to the class
NsxFile
to allow for files with 1-sample segments in continuous data. This allows for PTP timestamping of continuous data. The methodgetaligneddata()
allows for continuous data frame copies/removals to allow for PTP-timestamped data to be aligned to the "true" sampling rates (30 kS/s, 10 kS/s, etc). This allows data recorded from a Gemini NSP and Gemini Hub to be aligned for analysis after alignment.