VocalPy pipeline API

VocalPy uses one pipeline class for each supported animal. These classes detect candidate vocalizations, apply species-specific checks, and run optional classification and segmentation steps.

Use Getting started for installation, CLI commands, and output details. Use this page when you write Python code that calls or extends a pipeline class.

Submodules

vocalpy.pipelines.animal module

VocalPy - Vocal analysis framework

class vocalpy.pipelines.animal.Animal(animal, params)

Bases: ABC

Animal class calls apropriate pipeline functions

adjust_normalized_spectrogram(normalized_spectrogram)
apply_morphology(binary_spectrogram)
build_candidate_mask(spectrogram)
build_vocal_from_prop(prop, spectrogram, time_res, freq_res, this_bin, bin_size, lower_frequency_cutoff)
abstractmethod check_if_vocals_are_close(first_vocal, second_vocal)
classify_vocalizations(network_type, list_of_vocals, source=None)
combine_vocals(first_vocal, second_vocal)

Combines two vocals

Parameters:
  • first_vocal (Vocal)

  • second_vocal (Vocal) – vocals to be combined

connect_vocals(list_of_vocals)

Checks segmentation and combines segments that belong to the same vocalization. Uses predefined constraints. Can have different contrainsts for different animal pipelines

Parameters:

list_of_vocals (ListOfVocals) – list of vocal candidates to be connected

create_list_of_vocals(props, spectrogram, candidate_mask, time_res, freq_res, this_bin, bin_size)
estimate_background_intensity(spectrogram, center, window_radius)

Estimate local background intensity around a candidate vocalization.

finalize_candidate_mask(candidate_mask)
get_background_window_radius()
get_centered_window_bounds(center, window_radius, max_width)

Clamp a centered window to valid bounds while preserving width when possible.

get_component_min_area()
get_duration_limits_in_frames(time_resolution_ms)

Resolve duration thresholds to spectrogram-frame counts.

Legacy configs used min_vocal_duration / max_vocal_duration as frame counts despite the ambiguous name. Preserve that behavior while allowing explicit frame or millisecond keys going forward.

get_median_filter_size()
get_output_spectrogram_range()
get_region_intensity_stats(prop)

Read intensity statistics across skimage regionprops API versions.

get_sorted_regionprops(candidate_mask, spectrogram)
get_spectrogram_kwargs()
get_time_range_label(sample_range, sample_rate, start_range, end_range)
get_vocal_times(start, end, time_res, this_bin, bin_size)
has_minimum_contrast(signal_intensity, background_intensity)

Compare signal and background in dB space.

identifier(chunk)
identify_vocalizations(chunk)
parse_chunk(chunk)

Convert the mixed-type chunk payload back into typed values.

segment_vocalizations(list_of_vocals, source=None, path_to_model=None, threshold=None)

vocalpy.pipelines.guineapig module

VocalPy - Vocal analysis framework

class vocalpy.pipelines.guineapig.Guineapig(animal, params)

Bases: Animal

adjust_normalized_spectrogram(normalized_spectrogram)
apply_morphology(binary_spectrogram)
check_if_vocals_are_close(base_vocal, next_vocal)
classify_vocalizations(network_type, list_of_vocals, source=None)
finalize_candidate_mask(candidate_mask)
get_background_window_radius()
get_component_min_area()
get_median_filter_size()
get_output_spectrogram_range()
get_spectrogram_kwargs()

vocalpy.pipelines.mouse module

VocalPy - Vocal analysis framework

class vocalpy.pipelines.mouse.Mouse(animal, params)

Bases: Animal

check_if_vocals_are_close(first_vocal, second_vocal)
get_output_spectrogram_range()

vocalpy.pipelines.rat module

VocalPy - Vocal analysis framework

class vocalpy.pipelines.rat.Rat(animal, params)

Bases: Animal

check_if_vocals_are_close(first_vocal, second_vocal)
get_output_spectrogram_range()
get_spectrogram_kwargs()

Package contents

animals module

methods for each animal pipeline