vocalpy.segment.MeanSquaredParams#
- class vocalpy.segment.MeanSquaredParams(threshold: int = 5000, min_dur: float = 0.02, min_silent_dur: float = 0.002, freq_cutoffs: ~typing.Iterable = (500, 10000), smooth_win: int = 2, scale: bool = True, scale_val: int | float = 32768, scale_dtype: ~numpy.dtype[~typing.Any] | None | type[~typing.Any] | ~numpy._typing._dtype_like._SupportsDType[~numpy.dtype[~typing.Any]] | str | tuple[~typing.Any, int] | tuple[~typing.Any, ~typing.SupportsIndex | ~collections.abc.Sequence[~typing.SupportsIndex]] | list[~typing.Any] | ~numpy._typing._dtype_like._DTypeDict | tuple[~typing.Any, ~typing.Any] = <class 'numpy.int16'>)[source]#
Bases:
Params
Data class that represents parameters for
vocalpy.segment.ava.segment()
.- Attributes:
- thresholdint
Value above which mean squared signal is considered part of a segment. Default is 5000.
- min_durfloat
Minimum duration of a segment, in seconds. Default is 0.02, i.e. 20 ms.
- min_silent_durfloat
Minimum duration of silent gap between segments, in seconds. Default is 0.002, i.e. 2 ms.
- freq_cutoffsIterable
Cutoff frequencies for bandpass filter. List or tuple with two elements, default is
(500, 10000)
.- smooth_winint
Size of smoothing window in milliseconds. Default is 2.
- scalebool
If True, scale the
sound.data
. Default is True. This is needed to replicate the behavior ofevsonganaly
, which assumes the audio data is loaded as 16-bit integers. Since the default forvocalpy.Sound
is to load sounds with a numpy dtype of float64, this function defaults to multiplying thesound.data
by 2**15, and then casting to the int16 dtype. This replicates the behavior of theevsonganaly
function, given data with dtype float64. If you have loaded a sound with a dtype of int16, then set this to False.- scale_val
Value to multiply the
sound.data
by, to scale the data. Default is 2**15. Only used ifscale
isTrue
. This is needed to replicate the behavior ofevsonganaly
, which assumes the audio data is loaded as 16-bit integers.scale_dtype
numpy.dtypeSigned integer type, compatible with C
short
.
Methods
alias of
int16
keys
- __init__(threshold: int = 5000, min_dur: float = 0.02, min_silent_dur: float = 0.002, freq_cutoffs: ~typing.Iterable = (500, 10000), smooth_win: int = 2, scale: bool = True, scale_val: int | float = 32768, scale_dtype: ~numpy.dtype[~typing.Any] | None | type[~typing.Any] | ~numpy._typing._dtype_like._SupportsDType[~numpy.dtype[~typing.Any]] | str | tuple[~typing.Any, int] | tuple[~typing.Any, ~typing.SupportsIndex | ~collections.abc.Sequence[~typing.SupportsIndex]] | list[~typing.Any] | ~numpy._typing._dtype_like._DTypeDict | tuple[~typing.Any, ~typing.Any] = <class 'numpy.int16'>) None #
Methods
__init__
([threshold, min_dur, ...])keys
()Attributes
freq_cutoffs
min_dur
min_silent_dur
scale
scale_val
smooth_win
threshold
- scale_dtype#
alias of
int16