Skip to main content

ActiRhythm Toolkit

ActiRhythm Toolkit is a command-line workflow for analysing accelerometer activity data and characterising behavioural and circadian rhythms. It provides preprocessing, hidden Markov model state estimation, downstream rhythm analysis, and optional machine-learning and GLMM workflows.

This repository contains source code, notebooks and published figures only. No subject data is distributed: the maned wolf biologger recordings analysed in the accompanying thesis belong to the data owners and are not redistributable. Supply your own input files under data/ to run the workflow.

Repository layout

src/         importable package (actirhythm CLI and analysis modules)
scripts/     pipeline entry points, figure generators and reporting helpers
notebooks/   exploratory notebooks (outputs stripped)
tests/       unit tests
figures/     figures published in the thesis
docs/         pipeline description and methodological notes
data/        input data (git-ignored, placeholders only)
outputs/     run artefacts (git-ignored)

Installation

python -m pip install actirhythm-toolkit

Optional extras from PyPI:

python -m pip install "actirhythm-toolkit[ml]"
python -m pip install "actirhythm-toolkit[glmm]"
python -m pip install "actirhythm-toolkit[notebooks]"

PyPI project page:

https://pypi.org/project/actirhythm-toolkit/

Optional capabilities

python -m pip install "actirhythm-toolkit[ml]"
python -m pip install "actirhythm-toolkit[glmm]"
python -m pip install "actirhythm-toolkit[notebooks]"

The glmm extra also requires a local R installation and compatible R packages. Check your environment with:

actirhythm glmm-doctor

Quick Start

Run the complete workflow from a project directory containing your input data and optional config.yaml:

actirhythm

Inspect the planned inputs and outputs before running:

actirhythm --dry-run

Run a named analysis version:

actirhythm full --run-version v1

Commands

actirhythm full
actirhythm preprocess
actirhythm analytics
actirhythm glmm-doctor

Run actirhythm --help for all configuration, data-path, output-path, and resume options.

Input Data

The workflow accepts accelerometer CSV data with a timestamp, subject identifier, activity measure, and optional axis or posture measurements. Use --data-revised-dir to specify an input directory and --raw-data-file to provide a fallback CSV file.

Choosing an activity signal

Set the analysis signal with --activity-signal (default ActMindata).

Some loggers export only the average of each accelerometer axis per epoch. The magnitude of a mean acceleration vector is dominated by gravity, so it describes body orientation, not movement intensity: it is longest when the animal holds a single posture and shortens as orientation varies within the epoch. Such a magnitude can therefore be negatively correlated with real activity and must not be used as an intensity index.

The toolkit still computes activity_xy and activity_xyz from the axes, but treats them as posture descriptors. A genuine intensity metric (ODBA/VeDBA) requires within-epoch variance, which averaged exports do not retain. Where a firmware activity count such as ActMindata is available, prefer it.

Posture descriptors remain useful for validating decoded states: resting states should show a higher and less variable posture magnitude than active ones. The preprocessing stage writes this check to posture_state_validation.csv.

Deployment windows

Records collected after a device is removed cannot be identified from the signal alone — a retrieved logger still registers varying posture and occasional activity while it is being transported, which is indistinguishable from genuine low-activity behaviour. Documented removal times are required.

Because removal times are study metadata that identify individual animals, none are shipped with this repository. Place your own deployment_windows.csv in the project directory and call qc.load_deployment_windows():

subject,end_timestamp,reason
A,2024-04-02 00:00,battery failure before explant
B,2023-07-07 10:15,documented device removal

Alternatively, pass a mapping directly to qc.apply_deployment_windows(). Without a window file, post-removal records are treated as valid observations.

Subject anonymisation

qc.assign_subject_codes() replaces subject names with codes (S01, S02, …) ordered by first observation, and the preprocessing stage writes the mapping to subject_code_mapping.csv. Treat that file as confidential — it is the re-identification key. It is not required to reproduce any result.

Dwell-time filtering

--min-dwell sets the minimum bout length in bins for the post-decoding filter (default 2; at 15-minute sampling that is 30 minutes).

This filter suppresses decoder flicker but also alters the decoded sequence, so transition probabilities and dwell-time summaries describe the filtered series. Choose the threshold against your own data rather than by convention: a value above the unfiltered median bout length discards a large share of genuine bouts. Each run writes dwell_time_sensitivity.csv comparing 15-, 30- and 60-minute thresholds so the choice can be justified.

Development

  1. Clone the repository:
git clone https://github.com/nerminjukan/actirhythm-toolkit.git
cd actirhythm-toolkit
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install in editable mode:
python -m pip install -e .

Development extras:

python -m pip install -e .[dev]
python -m pip install -e .[ml]
python -m pip install -e .[glmm]
python -m pip install -e .[notebooks]

Source

Source code and issue tracking: https://github.com/nerminjukan/actirhythm-toolkit

License

GNU General Public License, version 3 or later. See LICENSE.

Metadata

Release files for actirhythm-toolkit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for actirhythm-toolkit 0.2.1
File Size Uploaded Provenance
actirhythm_toolkit-0.2.1.tar.gz 56.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for actirhythm-toolkit 0.2.1
File Interpreter ABI Platform
actirhythm_toolkit-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 115.6 kB

Release files / actirhythm_toolkit-0.2.1.tar.gz

Download URL actirhythm_toolkit-0.2.1.tar.gz
Size 56.3 kB
Tags Source
SHA-256 checksum
How to use checksums
811608d84b656ee2d7d92ed7530ec5c2c18da3f74c7304021e01a8dc6bd3c8e3
BLAKE2b-256 checksum
How to use checksums
4d769fca09ed53661d0cf00e9f7cb9b4e1dcce9e462e676354404317dbc7ff06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / actirhythm_toolkit-0.2.1-py3-none-any.whl

Download URL actirhythm_toolkit-0.2.1-py3-none-any.whl
Size 59.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
404627a70b36bb21bc712c4ce7d0cd973ea849a2bc71160a53d7e3bd726e684c
BLAKE2b-256 checksum
How to use checksums
dc8e307d79f34243ee8b0f8e9e492240474c4b851880cb94ef82ccd8bd542bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for actirhythm-toolkit 0.2.1

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page