Catalog PyPI
PACKAGE EXPLORERView in registry

a3em-analysis

PyPI

A3EM provides utilities for preprocessing bioacoustic recordings, extracting acoustic features, and working with supported bioacoustic datasets.

Versions collected1
Direct dependencies10From release 0.0.9
Last observed20 Oct, 16:39 UTC

README

Version 0.0.9 documentation

A3EM Package

import a3em_analysis

A3EM provides utilities for preprocessing bioacoustic recordings, extracting acoustic features, and working with supported bioacoustic datasets.

a3em_analysis.utils

preprocess

preprocess(audio, sample_rate, normalization=0.7)

Takes an audio clip as a numpy.ndarray, applies low-pass and high-pass filtering, resamples the signal to 2000 Hz, and normalizes it. This matches the preprocessing pipeline described in the Pardo paper.

Returns a (audio, sample_rate) tuple, where sample_rate is always 2000.

Example

import librosa
from a3em_analysis.utils import preprocess

audio_path = "test.wav"
audio, sample_rate = librosa.load(audio_path)

preprocessed_audio, sample_rate = preprocess(audio, sample_rate)

extract_features

extract_features(audio, sample_rate)

Takes an audio clip as a numpy.ndarray and extracts acoustic features from the signal.

Example

import librosa
from a3em_analysis.utils import preprocess, extract_features

audio_path = "test.wav"
audio, sample_rate = librosa.load(audio_path)

preprocessed_audio, sample_rate = preprocess(audio, sample_rate)
features = extract_features(preprocessed_audio, sample_rate)

a3em_analysis.datasets

The a3em_analysis.datasets module provides convenient access to supported A3EM datasets. Dataset classes handle downloading, preprocessing, clip extraction, and feature extraction.

Arden

The Arden dataset contains collar-borne AudioMoth recordings collected in June 2025 in Samburu National Reserve, Kenya.

from a3em_analysis.datasets import Arden
import os

dataset = Arden(
    path=os.getenv("DATA_PATH"),
    token=os.getenv("API_TOKEN")
)

path specifies where the dataset should be stored locally. token is used to authenticate downloads from Dryad.

The first time data is loaded, the dataset will automatically:

  1. Check for the required audio and annotation files locally.
  2. Download the dataset from Dryad if necessary.
  3. Extract downloaded archives.
  4. Load and filter annotation metadata.
  5. Optionally generate background-noise examples.
  6. Extract audio clips.
  7. Preprocess the clips.
  8. Compute acoustic features.

The extracted clips and features are cached on the Arden instance so that subsequent calls do not repeat feature extraction unless reload=True is specified.


load_data

load_data(
    random_state=None,
    rumble_only=False,
    reload=False
)

Loads the dataset and returns the extracted acoustic features together with their binary labels.

Example

features, labels = dataset.load_data(
    random_state=123
)

Parameters

ParameterDescription
random_stateSeed used when shuffling metadata and generating background-noise clips.
rumble_onlyIf True, only annotated elephant rumbles are included. If False, background-noise examples are also generated.
reloadIf True, regenerates metadata, clips, and features even if they have already been loaded.

Returns

features : pandas.DataFrame
labels   : pandas.Series

Labels are binary:

  • 0 — Background noise
  • 1 — Elephant rumble

Annotation quality values 2, 3, and 4 are mapped to the rumble label 1. Background-noise examples have quality -1 and are mapped to label 0.

Audio is always loaded at its native sample rate and resampled to 2000 Hz internally by preprocess during feature extraction.


load_data_ml

load_data_ml(
    test_split=0.2,
    random_state=None,
    rumble_only=False,
    reload=False,
    shuffle=False
)

Loads the dataset and creates train/test splits suitable for machine-learning workflows.

Internally, this method uses sklearn.model_selection.train_test_split.

Example

x_train, x_test, y_train, y_test = dataset.load_data_ml(
    test_split=0.2,
    random_state=123,
    shuffle=True
)

Parameters

ParameterDescription
test_splitFraction of samples reserved for testing. Defaults to 0.2.
random_stateSeed used for dataset generation and the train/test split.
rumble_onlyIf True, only annotated elephant rumbles are included. If False, background-noise examples are also generated.
reloadIf True, regenerates metadata, clips, and features before splitting.
shuffleWhether samples should be shuffled by train_test_split before creating the split. Defaults to False.

Returns

x_train : pandas.DataFrame
x_test  : pandas.DataFrame
y_train : pandas.Series
y_test  : pandas.Series

load_clips

load_clips(
    random_state=None,
    rumble_only=False,
    reload=False
)

Returns the extracted audio clips together with their computed acoustic features.

Example

clips, features = dataset.load_clips(
    random_state=123,
    rumble_only=False
)

Parameters

ParameterDescription
random_stateSeed used when generating the dataset.
rumble_onlyIf True, background-noise examples are not generated.
reloadIf True, regenerates the clips and features.

Returns

  • clips — list containing the extracted audio clips as NumPy arrays.
  • features — pandas.DataFrame containing one row of acoustic features for each clip.

Each extracted clip includes a 0.2 second buffer before and after its annotated time range.

Clips shorter than two seconds after extraction are discarded during feature extraction.


Iteration

An Arden dataset can be iterated over directly.

dataset = Arden(path, token)

for clip, features in dataset:
    print(len(clip))
    print(features)

If the dataset has not already been loaded, iteration automatically initializes it using the default loading options.

Each iteration returns:

(
    numpy.ndarray,  # audio clip
    dict            # extracted acoustic features
)

Indexing

Individual clips and their corresponding features can be accessed by index after the dataset has been loaded.

clip, features = dataset[10]

The returned feature set is converted from its DataFrame row into a dictionary.

If the dataset has not yet been loaded, indexing returns:

(None, None)

Dataset Length

The number of metadata entries currently loaded can be obtained with len():

len(dataset)

Before the dataset has been initialized, its length is 0.


Rumble Filtering

Arden annotations are filtered before clips are extracted.

Only entries satisfying all of the following conditions are retained:

  • call_type is RUM or BKG
  • earflap is 0 or 1
  • overlap is N
  • quality is -1, 2, 3, or 4
  • duration is greater than 2 seconds

When rumble_only=True, background-noise examples are not generated.


Background-Noise Generation

When rumble_only=False, background-noise (BKG) examples are automatically generated from regions outside the annotated event ranges.

The duration of generated noise clips is based on the mean and standard deviation of annotation durations in the corresponding recording.

Generated background-noise entries use:

call_type = BKG
quality   = -1
overlap   = N
earflap   = 0

Because background-noise selection is randomized, use random_state when reproducible dataset generation is required.

features, labels = dataset.load_data(
    random_state=123
)

Audio Processing

Audio recordings are loaded using librosa at their native sample rate.

For each retained metadata entry:

  1. The corresponding time range is extracted from the recording.
  2. A 0.2 second buffer is added to each side.
  3. The clip is passed through a3em_analysis.utils.preprocess, which resamples it to 2000 Hz.
  4. Acoustic features are calculated using a3em_analysis.utils.extract_features at the resampled rate.

The original extracted clip and its computed features are retained by the dataset instance.


Reloading Data

Once clips and features have been generated, the Arden instance reuses them.

To force the dataset to regenerate its metadata, clips, and features:

features, labels = dataset.load_data(
    reload=True
)

This is useful when changing parameters such as:

rumble_only
random_state

Quick Start

import os
from a3em_analysis.datasets import Arden

dataset = Arden(
    path=os.getenv("DATA_PATH"),
    token=os.getenv("API_TOKEN")
)

# Load features and labels
features, labels = dataset.load_data(
    random_state=123
)

print(features.head())
print(labels.head())

# Create a machine-learning split
x_train, x_test, y_train, y_test = dataset.load_data_ml(
    test_split=0.2,
    random_state=123,
    shuffle=True
)

# Access raw clips and features
clips, clip_features = dataset.load_clips()

# Iterate through clips
for clip, feature_set in dataset:
    print(clip.shape)
    print(feature_set)

Running Tests

The package includes a pytest suite covering a3em_analysis.utils and Arden dataset determinism.

pip install pytest
pytest

Downloads & popularity

1downloads
1-day window · source-reported counts17 Oct 2026
2721360
2026-08-21: 222 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-21–2026-08-212026-08-22: 21 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-22–2026-08-222026-08-23: 16 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-23–2026-08-232026-08-24: 31 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-24–2026-08-242026-08-25: 7 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-25–2026-08-252026-08-27: 86 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-27–2026-08-272026-08-28: 23 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-28–2026-08-282026-08-29: 31 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-29–2026-08-292026-08-30: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-08-30–2026-08-302026-09-01: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-01–2026-09-012026-09-02: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-02–2026-09-022026-09-04: 14 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-04–2026-09-042026-09-05: 183 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-05–2026-09-052026-09-06: 9 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-06–2026-09-062026-09-07: 15 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-07–2026-09-072026-09-08: 272 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-08–2026-09-082026-09-09: 35 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-09–2026-09-092026-09-10: 3 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-10–2026-09-102026-09-11: 12 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-11–2026-09-112026-09-12: 37 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-12–2026-09-122026-09-13: 2 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-13–2026-09-132026-09-14: 5 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-14–2026-09-142026-09-15: 30 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-15–2026-09-152026-09-16: 18 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-16–2026-09-162026-09-18: 30 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-18–2026-09-182026-09-19: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-19–2026-09-192026-09-20: 11 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-20–2026-09-202026-09-21: 3 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-21–2026-09-212026-09-22: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-22–2026-09-222026-09-23: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-23–2026-09-232026-09-24: 15 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-24–2026-09-242026-09-25: 5 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-25–2026-09-252026-09-26: 10 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-26–2026-09-262026-09-27: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-27–2026-09-272026-09-28: 7 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-28–2026-09-282026-09-29: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-29–2026-09-292026-09-30: 4 · observed 2026-10-20T19:25:23.4885707Z · period 2026-09-30–2026-09-302026-10-01: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-01–2026-10-012026-10-03: 2 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-03–2026-10-032026-10-04: 11 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-04–2026-10-042026-10-05: 12 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-05–2026-10-052026-10-06: 3 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-06–2026-10-062026-10-07: 3 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-07–2026-10-072026-10-08: 2 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-08–2026-10-082026-10-09: 9 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-09–2026-10-092026-10-10: 5 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-10–2026-10-102026-10-11: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-11–2026-10-112026-10-12: 2 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-12–2026-10-122026-10-13: 3 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-13–2026-10-132026-10-14: 2 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-14–2026-10-142026-10-15: 22 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-15–2026-10-152026-10-16: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-16–2026-10-162026-10-17: 1 · observed 2026-10-20T19:25:23.4885707Z · period 2026-10-17–2026-10-17
21 Aug17 Oct

pypistats · 53 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-17 – 2026-10-1712026-10-20T19:25:23.4885707Z
2026-10-16 – 2026-10-1612026-10-20T19:25:23.4885707Z
2026-10-15 – 2026-10-15222026-10-20T19:25:23.4885707Z
2026-10-14 – 2026-10-1422026-10-20T19:25:23.4885707Z
2026-10-13 – 2026-10-1332026-10-20T19:25:23.4885707Z
2026-10-12 – 2026-10-1222026-10-20T19:25:23.4885707Z
2026-10-11 – 2026-10-1112026-10-20T19:25:23.4885707Z
2026-10-10 – 2026-10-1052026-10-20T19:25:23.4885707Z
2026-10-09 – 2026-10-0992026-10-20T19:25:23.4885707Z
2026-10-08 – 2026-10-0822026-10-20T19:25:23.4885707Z
2026-10-07 – 2026-10-0732026-10-20T19:25:23.4885707Z
2026-10-06 – 2026-10-0632026-10-20T19:25:23.4885707Z
2026-10-05 – 2026-10-05122026-10-20T19:25:23.4885707Z
2026-10-04 – 2026-10-04112026-10-20T19:25:23.4885707Z
2026-10-03 – 2026-10-0322026-10-20T19:25:23.4885707Z
2026-10-01 – 2026-10-0112026-10-20T19:25:23.4885707Z
2026-09-30 – 2026-09-3042026-10-20T19:25:23.4885707Z
2026-09-29 – 2026-09-2942026-10-20T19:25:23.4885707Z
2026-09-28 – 2026-09-2872026-10-20T19:25:23.4885707Z
2026-09-27 – 2026-09-2742026-10-20T19:25:23.4885707Z
2026-09-26 – 2026-09-26102026-10-20T19:25:23.4885707Z
2026-09-25 – 2026-09-2552026-10-20T19:25:23.4885707Z
2026-09-24 – 2026-09-24152026-10-20T19:25:23.4885707Z
2026-09-23 – 2026-09-2312026-10-20T19:25:23.4885707Z
2026-09-22 – 2026-09-2242026-10-20T19:25:23.4885707Z
2026-09-21 – 2026-09-2132026-10-20T19:25:23.4885707Z
2026-09-20 – 2026-09-20112026-10-20T19:25:23.4885707Z
2026-09-19 – 2026-09-1912026-10-20T19:25:23.4885707Z
2026-09-18 – 2026-09-18302026-10-20T19:25:23.4885707Z
2026-09-16 – 2026-09-16182026-10-20T19:25:23.4885707Z
2026-09-15 – 2026-09-15302026-10-20T19:25:23.4885707Z
2026-09-14 – 2026-09-1452026-10-20T19:25:23.4885707Z
2026-09-13 – 2026-09-1322026-10-20T19:25:23.4885707Z
2026-09-12 – 2026-09-12372026-10-20T19:25:23.4885707Z
2026-09-11 – 2026-09-11122026-10-20T19:25:23.4885707Z
2026-09-10 – 2026-09-1032026-10-20T19:25:23.4885707Z
2026-09-09 – 2026-09-09352026-10-20T19:25:23.4885707Z
2026-09-08 – 2026-09-082722026-10-20T19:25:23.4885707Z
2026-09-07 – 2026-09-07152026-10-20T19:25:23.4885707Z
2026-09-06 – 2026-09-0692026-10-20T19:25:23.4885707Z
2026-09-05 – 2026-09-051832026-10-20T19:25:23.4885707Z
2026-09-04 – 2026-09-04142026-10-20T19:25:23.4885707Z
2026-09-02 – 2026-09-0212026-10-20T19:25:23.4885707Z
2026-09-01 – 2026-09-0142026-10-20T19:25:23.4885707Z
2026-08-30 – 2026-08-3042026-10-20T19:25:23.4885707Z
2026-08-29 – 2026-08-29312026-10-20T19:25:23.4885707Z
2026-08-28 – 2026-08-28232026-10-20T19:25:23.4885707Z
2026-08-27 – 2026-08-27862026-10-20T19:25:23.4885707Z
2026-08-25 – 2026-08-2572026-10-20T19:25:23.4885707Z
2026-08-24 – 2026-08-24312026-10-20T19:25:23.4885707Z
2026-08-23 – 2026-08-23162026-10-20T19:25:23.4885707Z
2026-08-22 – 2026-08-22212026-10-20T19:25:23.4885707Z
2026-08-21 – 2026-08-212222026-10-20T19:25:23.4885707Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.98 Sept 202610

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
vu-a3em/a3em-python-package

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:2179b54672fd4bffbddea8e58e372c772b12d58dfb2994a34d7cb015038b870d