uwacan.TimeData#
- class TimeData(data, time=None, start_time=None, samplerate=None, dims='time', coords=None, attrs=None, **kwargs)[source]#
Bases:
DataArrayWrapHanding data which varies over time.
This class is mainly used to wrap time-signals of sampled sounds. As such, the time data is assumed to be sampled at a constant samplerate.
- Parameters:
- dataarray_like
A
numpy.ndarrayor axarray.DataArraywith the time data.- timearray_like, optional
A
numpy.ndarraywithdtype=datetime64[ns]containing time stamps for the samples.- start_timetime_like, optional
The start time for the first sample in the signal. This should ideally be a proper time type, but it will be parsed if it is a string. Defaults to “now” if not given.
- sampleratefloat, optional
The samplerate for this data, in Hz. If the
datais anumpy.ndarray, this has to be given. If thedatais axarray.DataArraywhich already has a time coordinate, this can be omitted.- dimsstr or [str], default=”time”
The dimensions of the data. Must have the same length as the number of dimensions in the data. Only used for
numpyinputs.- coords
xarray.DataArray.coords Additional coordinates for this data.
- attrsdict, optional
Additional attributes to store with this data.
Methods
from_dataset(dataset)Instantiate the class from a dataset.
listen([downsampling, upsampling, headroom])Play back this time data over speakers.
rolling([duration, step, overlap, squeeze_time])Generate rolling windows of this data.
subwindow([time, start, stop, center, ...])Select a subset of the data over time.
Inherited methods
apply(func, *args, **kwargs)Apply some function to the contained data.
groupby(group)isel([indexers, drop, missing_dims, drop_allnan])Select a subset of the data from the coordinate indices.
load(path[, lookup_class])Load data from a Zarr file and optionally restore the original class.
make_figure(**kwargs)Create a plotly figure, styled for this data.
max([dim])Maximum of this data, along some dimension.
mean([dim])Average of this data, along some dimension.
min([dim])Minimum of this data, along some dimension.
reduce(func, dim, **kwargs)Apply a reduction function along some dimension in this data.
save(path[, append_dim])Save the data to a Zarr file at the specified path.
sel([indexers, method, tolerance, drop, ...])Select a subset of the data from the coordinate labels.
std([dim])Standard deviation of this data, along some dimension.
sum([dim])Sum of this data, along some dimension.
where(cond[, other, drop])Filter elements from this object according to a condition.
Attributes
attrsAttributes stored in the data.
coordsThe coordinate (dimension) arrays for this data.
dataThe contained data.
dimsThe dimensions of this data.
sampleratesizesMapping from dimension names to lengths.
timeTime coordinates for this data.
time_windowA
TimeWindowdescribing when the data start and stops.