uwacan.analysis.Spectrogram#
- class Spectrogram(data, time=None, start_time=None, samplerate=None, frequency=None, frequency_band_lower=None, frequency_band_upper=None, bandwidth=None, dims=None, coords=None, attrs=None, **kwargs)[source]#
Bases:
TimeFrequencyDataHandling of spectrogram data, both linear and banded.
- Parameters:
- dataarray_like
A
numpy.ndarrayor axarray.DataArraywith the time-frequency data.- 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. This is not the samplerate of the underlying time signal, but time steps of the time axis on the time-frequency data. If the
datais anumpy.ndarray, this has to be given. If thedatais axarray.DataArraywhich already has a time coordinate, this can be omitted.- frequencyarray_like, optional
The frequencies corresponding to the data. Mandatory if
datais anumpy.ndarray.- bandwidtharray_like, optional
The bandwidth of each data point. Can be an array with per-frequency bandwidth or a single value valid for all frequencies.
- dimsstr or [str], optional
The dimensions of the data. Must have the same length as the number of dimensions in the data. Mandatory used for
numpyinputs, not used forxarrayinputs.- coords
xarray.DataArray.coords Additional coordinates for this data.
- attrsdict, optional
Additional attributes to store with this data.
Methods
analyze_timedata(time_data, *[, ...])Compute a spectrogram from time data.
from_dataset(data, **kwargs)Instantiate the class from a dataset.
plot(**kwargs)Make a heatmap trace of this data.
Inherited methods
apply(func, *args, **kwargs)Apply some function to the contained data.
Estimate the bandwidth of the frequency vector.
groupby(group)isel([indexers, drop, missing_dims, drop_allnan])Select a subset of the data from the coordinate indices.
listen([downsampling, upsampling, headroom])Play back this time data over speakers.
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.
rolling([duration, step, overlap, squeeze_time])Generate rolling windows of 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.
subwindow([time, start, stop, center, ...])Select a subset of the data over time.
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.
bandwidthCompute bandwidth from frequency band edges.
coordsThe coordinate (dimension) arrays for this data.
dataThe contained data.
dimsThe dimensions of this data.
frequencyThe frequencies for the data.
sampleratesizesMapping from dimension names to lengths.
timeTime coordinates for this data.
time_windowA
TimeWindowdescribing when the data start and stops.