Skip to main content

Functions for working with files created by the EvTAF program and the evsonganaly GUI

Project description

evfuncs

Functions for working with files created by EvTAF and the evsonganaly GUI.
In case you need to work with those files in Python 😊😊😊 (see "Usage" below).

The first work published with data collected using EvTAF and evsonganaly is in this paper:
Tumer, Evren C., and Michael S. Brainard.
"Performance variability enables adaptive plasticity of ‘crystallized’adult birdsong."
Nature 450.7173 (2007): 1240.
https://www.nature.com/articles/nature06390

These functions are translations to Python of the original functions written in MATLAB (copyright Mathworks) by Evren Tumer (shown below).

Image of Evren

Installation

$ pip install evfuncs

Usage

The main purpose for developing these functions in Python was to work with files of Bengalese finch song in this data repository: https://figshare.com/articles/Bengalese_Finch_song_repository/4805749

Using evfuncs with that repository, you can load the .cbin audio files ...

>>> import evfuncs

>>> rawsong, samp_freq = evfuncs.load_cbin('gy6or6_baseline_230312_0808.138.cbin')

... and the annotation in the .not.mat files ...

>>> notmat_dict = evfuncs.load_notmat('gy6or6_baseline_230312_0808.138.cbin')

(or, using the .not.mat filename directly)

>>> notmat_dict = evfuncs.load_notmat('gy6or6_baseline_230312_0808.138.not.mat')

...and you should be able to reproduce the segmentation of the raw audio files of birdsong into syllables and silent periods, using the segmenting parameters from a .not.mat file and the simple algorithm applied by the SegmentNotes.m function.

>>> smooth = evfuncs.smooth_data(rawsong, samp_freq)
>>> threshold = notmat_dict['threshold']
>>> min_syl_dur = notmat_dict['min_dur'] / 1000
>>> min_silent_dur = notmat_dict['min_int'] / 1000
>>> onsets, offsets = evfuncs.segment_song(smooth, samp_freq, threshold, min_syl_dur, min_silent_dur)
>>> import numpy as np
>>> np.allclose(onsets, notmat_dict['onsets'])
True

(Note that this test would return False if the onsets and offsets in the .not.mat annotation file had been modified, e.g., a user of the evsonganaly GUI had edited them, after they were originally computed by the SegmentNotes.m function.)

The evfuncs functions are used in the hybrid-vocal-classifier and songdeck libraries.

Getting Help

Please feel free to raise an issue here:
https://github.com/NickleDave/evfuncs/issues

License

BSD License.

Citation

If you use this package, please cite the DOI:
DOI

Build Status

Build Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for evfuncs, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size evfuncs-0.2.1-py3-none-any.whl (8.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size evfuncs-0.2.1.tar.gz (8.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page