Skip to main content

No project description provided

Project description

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 Machines
  • lsvc: Linear Support Vector Machines
  • RandomForest: Random Forest
  • knn: 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

DOI

Project details


Download files

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

Source Distribution

pyporcc-0.1.5.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyporcc-0.1.5-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file pyporcc-0.1.5.tar.gz.

File metadata

  • Download URL: pyporcc-0.1.5.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10

File hashes

Hashes for pyporcc-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f6ccc98ace516c0cdc3ae035867465a1cde408e7ccb1de3c31d05e08df6e189d
MD5 eec5642e2cd6bb11c68552bfcbf54e94
BLAKE2b-256 7151b26a5acb2665dc099accf106f349491c6f22dc622b6f6e0c45e8140a66c5

See more details on using hashes here.

File details

Details for the file pyporcc-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyporcc-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10

File hashes

Hashes for pyporcc-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc393b6d088f699ab729e730c52e7c1537c234e1df35e42c656649dbf201018e
MD5 0dcec8f8d3b3579a076161da91b49146
BLAKE2b-256 c7740215b8d98182ca96c9bf890f6c1eb7c0749c83d55c0809f1679e5aea2caa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page