pulsarbat.readers.BaseReader#
- class pulsarbat.readers.BaseReader(*, shape, dtype, signal_type=<class 'pulsarbat.core.Signal'>, sample_rate, start_time=None, **signal_kwargs)[source]#
Base class for readers.
Subclasses must either implement the
_read_array()method if using the default.read()implementation, or implement their own.read()method.- Parameters
- shape
tupleofint Signal shape.
- dtype
dtype Data-type of signal data.
- signal_typesubclass of
Signal, default:Signal Type of signal that will be returned by
read().- sample_rate
Quantity The number of samples per second. Must be in units of frequency.
- start_time
Time, optional Timestamp at first sample of signal data. Default is None.
- **signal_kwargs
Additional kwargs to pass on to
signal_typewhen creating a Signal object.
- shape
Attributes
dtSample spacing (
1 / sample_rate).dtypeData-type of data.
ndimNumber of dimensions in data.
sample_rateSample rate of the signal data.
sample_shapeShape of a sample.
shapeShape of data.
start_timeTimestamp at first sample.
stop_timeTimestamp after last sample.
time_lengthLength of signal in time units.
Methods
contains(t, /)Whether time(s) are within the bounds of the signal.
dask_read(offset, n, /, **kwargs)Read n samples from given offset using Dask arrays.
offset_at(t, /)Returns nearest integer offset at given time.
read(offset, n, /, **kwargs)Read n samples from given offset.
time_at(offset, /[, unit])Returns time at given offset.
- dask_read(offset, n, /, **kwargs)[source]#
Read n samples from given offset using Dask arrays.
A convenience method equivalent to the
read()method withuse_dask=True.
- read(offset, n, /, **kwargs)[source]#
Read n samples from given offset.
- Parameters
- Returns
SignalSignal of length
ncontaining data that was read.