maad.util.write_raven_annot

maad.util.write_raven_annot(fname, df_rois, save_file=True)[source]

Write audio segmentation to text file in Raven format, a file that can be imported and modified with Raven. If the dataframe has no frequency delimiters, annotations are saved with standard Audacity format (temporal segmentation). If the dataframe has temporal and frequencial delimiters, the annotations are saved as spectral selection style (spectro-temporal selection). If the dataframe is empty, the function saves an empty file.

Parameters:
fname: str

filename to save the segmentation

df_rois: pandas dataframe

Dataframe containing the coordinates corresponding to sound signatures For bounding box (temporal eand frequency limits) :: df_rois must contain at least the columns ‘min_t’, ‘max_t’, ‘min_f’, ‘max_f’

Returns:
df_out: pandas dataframe

Dataframe that has been saved in Raven format

Examples

>>> from maad import sound, rois, util
>>> s, fs = sound.load('../data/spinetail.wav')
>>> df_rois = rois.find_rois_cwt(s, fs, flims=(3000,8000), tlen=2, th=0)
>>> df_rois['Label'] = 'Spinetail'
>>> df_raven = util.write_raven_annot('spinetail_annotations.txt', df_rois)