uwacan.FrequencyData#
- class FrequencyData(data, frequency=None, frequency_band_lower=None, frequency_band_upper=None, bandwidth=None, dims='frequency', coords=None, attrs=None, **kwargs)[source]#
Bases:
DataArrayWrapHanding data which varies over frequency.
This class is mainly used to wrap spectra of sampled sounds. Typically, this is represented as power spectral densities, but other data types are also possible.
- Parameters:
- dataarray_like
A
numpy.ndarrayor axarray.DataArraywith the frequency data.- frequencyarray_like, optional
The frequencies corresponding to the data. Mandatory if
datais anumpy.ndarray.- frequency_band_lowerarray_like, optional
The lower edge of each frequency band. Must be provided together with
frequency_band_upper. This is the preferred method for specifying frequency band information.- frequency_band_upperarray_like, optional
The upper edge of each frequency band. Must be provided together with
frequency_band_lower. This is the preferred method for specifying frequency band information.- bandwidthfloat, optional
A single bandwidth value valid for all frequencies. This is a convenience method that assumes centered frequency bands. For per-frequency bandwidth, use
frequency_band_lower/frequency_band_upperinstead.- dimsstr or [str], default=”frequency”
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
Estimate the bandwidth of the frequency vector.
from_dataset(dataset)Instantiate the class from a dataset.
plot(**kwargs)Make a scatter trace of this data.
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.
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.
sizesMapping from dimension names to lengths.