PyPorCC
PyPorCC is a package that allows the detection and classification of Harbor Porpoises' clicks. The detection of clicks in continuous files is a python adaptation of the PAMGuard click detector algorithm.
Gillespie D, Gordon J, McHugh R, McLaren D, Mellinger DK, Redmond P, Thode A, Trinder P, Deng XY (2008) PAMGUARD: Semiautomated, open source software for real-time acoustic detection and localisation of cetaceans. Proceedings of the Institute of Acoustics 30:54–62.
The classification is done using the PorCC algorithm, adapted to python from the paper:
Cosentino, M., Guarato, F., Tougaard, J., Nairn, D., Jackson, J. C., & Windmill, J. F. C. (2019). Porpoise click classifier (PorCC): A high-accuracy classifier to study harbour porpoises ( Phocoena phocoena ) in the wild. The Journal of the Acoustical Society of America, 145(6), 3427–3434. https://doi.org/10.1121/1.5110908
Also other models can be trained. The implemented ones so far are:
svc: Support Vector Machineslsvc: Linear Support Vector MachinesRandomForest: Random Forestknn: K-Nearest Neighbor
Usage
Click detector
The Click detector can be used in continuous wav files (with higher than 300 kHz sampling rate) or in the SoundTrap HF output files (*.bcl + *.dwv). For SoundTrapHF files, you can create a ClickDetectorSoundTrapHF object with the necessary parameters and run it as:
import pathlib
import pyhydrophone as pyhy
from pyporcc import ClickDetectorSoundTrapHF, ClickDetector, PorCC, Filter
sound_folder = pathlib.Path("./../tests/test_data/soundtrap")
save_folder = pathlib.Path('./../tests/test_data/output')
# Hydrophone
model = 'ST300HF'
name = 'SoundTrap'
serial_number = 67416073
soundtrap = pyhy.soundtrap.SoundTrapHF(name=name, model=model, serial_number=serial_number)
# Filters parameters
lowcutfreq = 100e3 # Lowcut frequency
highcutfreq = 160e3 # Highcut frequency
# Define the filters
pfilter = Filter(filter_name='butter', filter_type='bandpass', order=4,
frequencies=[lowcutfreq, highcutfreq])
dfilter = Filter(filter_name='butter', filter_type='high', order=4, frequencies=20000)
classifier = PorCC(load_type='manual', config_file='default')
cd = ClickDetectorSoundTrapHF(hydrophone=soundtrap, save_folder=save_folder, convert=True,
classifier=classifier, prefilter=pfilter, save_noise=False)
cd.detect_click_clips_folder(sound_folder, blocksize=60 * 576000)
For continuous data, just make sure you use the class ClickDetector object instead of a ClickDetectorSoundTrapHF! The rest of the code should be the same (except the hydrophone definition, which will depend on the instrument you use)
Note
Please note, the clicks PAMGuard's Click Classifier classified as porpoise clicks appear as 0 in both ClassifiedAs and ManualAssign fields.
Citation
Metadata
Release files for pyporcc 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyporcc-0.3.4.tar.gz | 22.0 kB | Without provenance | Details for pyporcc-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyporcc-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for pyporcc-0.3.4-py3-none-any.whl |
Total release size: 47.3 kB
Release files / pyporcc-0.3.4.tar.gz
| Download URL | pyporcc-0.3.4.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9026a9e833514a9ea136d48a6396bc597bda64356970b6c7d6f3e49c1afdf915
|
|
BLAKE2b-256 checksum How to use checksums |
11013e8fbc4fe3e242083f47d41dd749f8e1c4a9eb66e4d55135a990316f7fff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Windows/10
|
Release files / pyporcc-0.3.4-py3-none-any.whl
| Download URL | pyporcc-0.3.4-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad223e266f0cbad388ddfd098a7e3f5e01a08bc8e8aee4cbcb9e97235579a1f1
|
|
BLAKE2b-256 checksum How to use checksums |
fc2024d0276eecd5a4365fe9ac6b1eae195a8acecfa335d4b1f0f4fbfa868cb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Windows/10
|
Security for pyporcc 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.