pykanto.parameters#

Classes and methods to store and modify pykanto parameters.

Classes

Parameters(**kwargs)

General parameters class - stores parameters to be passed to a KantoData() object.

class pykanto.parameters.Parameters(**kwargs: Any)[source]#

General parameters class - stores parameters to be passed to a KantoData() object.

__init__(**kwargs: Any)[source]#

Sets default parameters, then updates with user-provided parameters.

window_length: int#

Number of samples. Defaults to 1024.

hop_length: int#

Number of samples between successive frames. Defaults to 128.

fft_size: int#

Number of bins used to divide the window. Defaults to 2048.

num_mel_bins: int#

Number of Mel frequency bins to use (n of ‘rows’ in mel-spectrogram). Defaults to 224.

sr: int#

The sampling rate (samples taken per second). Defaults to 22050.

hop_length_ms: float#

Calculated automatically.

fft_rate: float#

Calculated automatically.

top_dB: int#

Top dB to keep. Defaults to 65. Example: if top_dB = 65 anything below -65dB will be masked.

lowcut: int#

Minimum frequency (in Hz) to include by default. Defaults to 1000.

highcut: int#

Maximum frequency (in Hz) to include by default. Defaults to 10000.

dereverb: bool#

Wether to reduce reverberation in the spectrograms. Defaults to False

max_dB: int#

Maximum threshold to reach during segmentation, in dB. Defaults to -30

dB_delta: int#

Size of thresholding steps, in dB. Defaults to 5.

silence_threshold: float#

Threshold separating silence from voiced segments. Between 0.1 and 0.3 tends to work well. Defaults to 0.2.

max_unit_length: float#

Maximum unit length allowed. Defaults to 0.4.

min_unit_length: float#

Minimum unit length allowed. Defaults to 0.03.

min_silence_length: float#

Minimum silence length allowed. Defaults to 0.001.

gauss_sigma: int#

Sigma for gaussian kernel. Defaults to 3.

song_level: bool#

Whether to return the average of all units. Defaults to False (return individual units in each vocalisation)

subset: Tuple[int, int] | None#

Indices of the first and last items to include in the dataset. Optional, defaults to None.

num_cpus: None | int#

How many cpus to use for parallel computing. Default is available number of cpus

verbose: bool#

How much detail to provide. Defaults to False (not verbose).

update(**kwargs: Any) None[source]#

Update one or more parameters.

Raises

KeyError – Not a valid parameter name.

add(**kwargs: Any) None[source]#

Add one or more new parameters.