Observed since 20 Oct, 16:39 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A3EM provides utilities for preprocessing bioacoustic recordings, extracting acoustic features, and working with supported bioacoustic datasets.
import a3em_analysis
A3EM provides utilities for preprocessing bioacoustic recordings, extracting acoustic features, and working with supported bioacoustic datasets.
a3em_analysis.utilspreprocesspreprocess(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.
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_featuresextract_features(audio, sample_rate)
Takes an audio clip as a numpy.ndarray and extracts acoustic features from the signal.
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.datasetsThe a3em_analysis.datasets module provides convenient access to supported A3EM datasets. Dataset classes handle downloading, preprocessing, clip extraction, and feature extraction.
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:
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_dataload_data(
random_state=None,
rumble_only=False,
reload=False
)
Loads the dataset and returns the extracted acoustic features together with their binary labels.
features, labels = dataset.load_data(
random_state=123
)
| Parameter | Description |
|---|---|
random_state | Seed used when shuffling metadata and generating background-noise clips. |
rumble_only | If True, only annotated elephant rumbles are included. If False, background-noise examples are also generated. |
reload | If True, regenerates metadata, clips, and features even if they have already been loaded. |
features : pandas.DataFrame
labels : pandas.Series
Labels are binary:
0 — Background noise1 — Elephant rumbleAnnotation 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_mlload_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.
x_train, x_test, y_train, y_test = dataset.load_data_ml(
test_split=0.2,
random_state=123,
shuffle=True
)
| Parameter | Description |
|---|---|
test_split | Fraction of samples reserved for testing. Defaults to 0.2. |
random_state | Seed used for dataset generation and the train/test split. |
rumble_only | If True, only annotated elephant rumbles are included. If False, background-noise examples are also generated. |
reload | If True, regenerates metadata, clips, and features before splitting. |
shuffle | Whether samples should be shuffled by train_test_split before creating the split. Defaults to False. |
x_train : pandas.DataFrame
x_test : pandas.DataFrame
y_train : pandas.Series
y_test : pandas.Series
load_clipsload_clips(
random_state=None,
rumble_only=False,
reload=False
)
Returns the extracted audio clips together with their computed acoustic features.
clips, features = dataset.load_clips(
random_state=123,
rumble_only=False
)
| Parameter | Description |
|---|---|
random_state | Seed used when generating the dataset. |
rumble_only | If True, background-noise examples are not generated. |
reload | If True, regenerates the clips and features. |
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.
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
)
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)
The number of metadata entries currently loaded can be obtained with len():
len(dataset)
Before the dataset has been initialized, its length is 0.
Arden annotations are filtered before clips are extracted.
Only entries satisfying all of the following conditions are retained:
call_type is RUM or BKGearflap is 0 or 1overlap is Nquality is -1, 2, 3, or 42 secondsWhen rumble_only=True, background-noise examples are not generated.
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 recordings are loaded using librosa at their native sample rate.
For each retained metadata entry:
0.2 second buffer is added to each side.a3em_analysis.utils.preprocess, which resamples it to 2000 Hz.a3em_analysis.utils.extract_features at the resampled rate.The original extracted clip and its computed features are retained by the dataset instance.
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
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)
The package includes a pytest suite covering a3em_analysis.utils and Arden dataset determinism.
pip install pytest
pytest
pypistats · 53 observations shown. Missing days are unknown. Source category: overall: without mirrors.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-17 – 2026-10-17 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-16 – 2026-10-16 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-15 – 2026-10-15 | 22 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-14 – 2026-10-14 | 2 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-13 – 2026-10-13 | 3 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-12 – 2026-10-12 | 2 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-11 – 2026-10-11 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-10 – 2026-10-10 | 5 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-09 – 2026-10-09 | 9 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-08 – 2026-10-08 | 2 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-07 – 2026-10-07 | 3 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-06 – 2026-10-06 | 3 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-05 – 2026-10-05 | 12 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-04 – 2026-10-04 | 11 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-03 – 2026-10-03 | 2 | 2026-10-20T19:25:23.4885707Z |
| 2026-10-01 – 2026-10-01 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-30 – 2026-09-30 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-29 – 2026-09-29 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-28 – 2026-09-28 | 7 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-27 – 2026-09-27 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-26 – 2026-09-26 | 10 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-25 – 2026-09-25 | 5 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-24 – 2026-09-24 | 15 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-23 – 2026-09-23 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-22 – 2026-09-22 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-21 – 2026-09-21 | 3 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-20 – 2026-09-20 | 11 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-19 – 2026-09-19 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-18 – 2026-09-18 | 30 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-16 – 2026-09-16 | 18 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-15 – 2026-09-15 | 30 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-14 – 2026-09-14 | 5 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-13 – 2026-09-13 | 2 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-12 – 2026-09-12 | 37 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-11 – 2026-09-11 | 12 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-10 – 2026-09-10 | 3 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-09 – 2026-09-09 | 35 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-08 – 2026-09-08 | 272 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-07 – 2026-09-07 | 15 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-06 – 2026-09-06 | 9 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-05 – 2026-09-05 | 183 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-04 – 2026-09-04 | 14 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-02 – 2026-09-02 | 1 | 2026-10-20T19:25:23.4885707Z |
| 2026-09-01 – 2026-09-01 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-30 – 2026-08-30 | 4 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-29 – 2026-08-29 | 31 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-28 – 2026-08-28 | 23 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-27 – 2026-08-27 | 86 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-25 – 2026-08-25 | 7 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-24 – 2026-08-24 | 31 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-23 – 2026-08-23 | 16 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-22 – 2026-08-22 | 21 | 2026-10-20T19:25:23.4885707Z |
| 2026-08-21 – 2026-08-21 | 222 | 2026-10-20T19:25:23.4885707Z |
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.9 | 8 Sept 2026 | 10 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 16:39 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:2179b54672fd4bffbddea8e58e372c772b12d58dfb2994a34d7cb015038b870d