uwacan.analysis.SpectralProbability#
- class SpectralProbability(data, levels=None, binwidth=None, frequency=None, frequency_band_lower=None, frequency_band_upper=None, bandwidth=None, scaling=None, num_frames=None, averaging_time=None, dims=None, coords=None, attrs=None, **kwargs)[source]#
Bases:
FrequencyDataHandles spectral probability data.
- Parameters:
- dataarray_like
A
numpy.ndarrayor axarray.DataArraywith the frequency data.- levelsarray_like, optional
The dB level represented by the bins. Mandatory if
datais anumpy.ndarray.- binwidthfloat, optional
The width of the bins. Computed from the levels if not given.
- 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.- scalingstr, default=”density”
The scaling of the probabilities for the level bins in each frequency band. Must be one of:
"counts": the number of frames with that level;"probability": how often a certain level occurred, i.e.,counts / num_frames;"density": the probability density at a certain level, i.e.,probability / binwidth.
Note that the sum of counts (at a given frequency) is the total number of frames, the sum of probability is 1, and the integral of the density is 1.
- num_framesint
The number of spectra used to compute this spectral probability.
- averaging_timefloat
The duration from which each spectrum was averaged over, in seconds.
- 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_spectrogram(spectrogram, *[, ...])Compute spectral probability from a spectrogram.
analyze_timedata(data, *, filterbank[, ...])Compute spectral probability from time data.
plot([logarithmic_probabilities])Make a heatmap trace of this data.
plot_percentile(percentile, **kwargs)with_probability_scale(new_scale)Rescale the probability data according to a new scaling method.
Inherited methods
apply(func, *args, **kwargs)Apply some function to the contained data.
Estimate the bandwidth of the frequency vector.
from_dataset(dataset)Instantiate the class from a dataset.
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.
levelsThe dB levels the probabilities are for.
sizesMapping from dimension names to lengths.