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: DataArrayWrap

Handing 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.ndarray or a xarray.DataArray with the frequency data.

frequencyarray_like, optional

The frequencies corresponding to the data. Mandatory if data is a numpy.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_upper instead.

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 numpy inputs.

coordsxarray.DataArray.coords

Additional coordinates for this data.

attrsdict, optional

Additional attributes to store with this data.

Methods

estimate_bandwidth()

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

attrs

Attributes stored in the data.

bandwidth

Compute bandwidth from frequency band edges.

coords

The coordinate (dimension) arrays for this data.

data

The contained data.

dims

The dimensions of this data.

frequency

The frequencies for the data.

sizes

Mapping from dimension names to lengths.