Allan Variance Analyzer
Efficient Tool for Allan Variance Analysis
This library provides tools for performing Allan Variance Analysis on IMU data in order to calibrate the IMU parameters. This is done by computing the Angle Random Walk (ARW), Bias Instability and Gyro Random Walk for the gyroscope, and Velocity Random Walk (VRW), Bias Instability and Accel Random Walk for the accelerometer.
While plenty of libraries exist for this purpose, this library stands out for its immense efficiency, use of pure Python (no bindings or compilation needed), and ease of use, while being fully unit tested for ease-of-mind when adopting it for your use case.
Faster
The popular allan_variance_ros package (written in C++), when run on the example imu_simulation.bag takes:
611.90s user 204.06s system 96% cpu 14:06.21 total
Our library takes:
40.64s user 2.04s system 91% cpu 46.558 total
which is a 15x speed improvement!
Easier
- There is no ROS dependency! But still useable within ROS.
- Since this library is written completely in Python, you can simply do
import allan_variance_analyzerto use it. pipinstallable.- Outputs an
imu.yamlfile following the Kalibr format.
Collecting IMU Data
Please follow the below steps to collect the data needed to calibrate the IMU.
-
Place your IMU on some damped surface and record your IMU data to the file format of your choice. Please be sure to record at least 3 hours of data. The longer the sequence, the more accurate the results.
-
Recommended Reorganize messages by timestamp.
-
Define an interface for reading the data file and loading it as a
Tx6numpyarray whereTis the number of data samples and we have 3-dimensional gyroscrope and 3-dimensional accelerometer data. -
Create a configuration YAML file which specifies the IMU rate (Hz) and the measure rate (Hz) which is the rate at which data is measured/subsampled. You can add additional parameters for your particular interface. An example config file is availabe in config/sim.yaml.
-
Run Allan Variance computation tool. Please see analyze_rosbag.py for an example script using ROS bag data.
-
The result is a generated
imu.yamlfile in the Kalibr format.
Example Data
We use the 3 hour log of a Realsense D435i IMU with timestamps already re-arranged, as provided by raabuchanan.
Our library automatically generates a Kalibr compatible file as imu.yaml:
# Accelerometer
accelerometer_noise_density: 0.006308226052016165
accelerometer_random_walk: 0.00011673723527962174
# Gyroscope
gyroscope_noise_density: 0.00015198973532354657
gyroscope_random_walk: 2.664506559330434e-06
update_rate: 400.0 # Make sure this is correct
Author
If you use this package for academic work, please consider using the citation below:
@software{AllanVarianceAnalyzer,
author = {Varun Agrawal},
title = {Fast Allan Variance Analysis},
year = {2026},
version = {1.0.1},
url = {https://github.com/varunagrawal/allan_variance}
}
References
- Indirect Kalman Filter for 3D Attitude Estimation, Trawny & Roumeliotis
- An introduction to inertial navigation, Oliver Woodman
- Characterization of Errors and Noises in MEMS Inertial Sensors Using Allan Variance Method, Leslie Barreda Pupo
- Kalibr IMU Noise Documentation
Local Development
We use uv to manage the project.
To run unit tests:
uv run pytest
To run an example script:
uv run python scripts/analyze_rosbag.py config/sim.yaml imu_simulation.bag
Metadata
Release files for allan-variance-analyzer 1.0.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 |
|---|---|---|---|---|
| allan_variance_analyzer-1.0.4.tar.gz | 7.8 kB | Without provenance | Details for allan_variance_analyzer-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allan_variance_analyzer-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for allan_variance_analyzer-1.0.4-py3-none-any.whl |
Total release size: 17.2 kB
Release files / allan_variance_analyzer-1.0.4.tar.gz
| Download URL | allan_variance_analyzer-1.0.4.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edc7acc2964d62e8591cfe3004a215bce7b32c9f4d47cef0fcfecd78bbb5da43
|
|
BLAKE2b-256 checksum How to use checksums |
ecab2260334df5382876a8d634ef3c23f6a97d35a92d916fe0b9f5b076abbe05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / allan_variance_analyzer-1.0.4-py3-none-any.whl
| Download URL | allan_variance_analyzer-1.0.4-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf9ad8ee7f8ea0abfa3415c43f6b66556ea3fecacab7caf9f35aef275880b4ae
|
|
BLAKE2b-256 checksum How to use checksums |
7acba92560ae36e4a74dd6535c70d4a8074b9c20fdec5978ba4ef50b7cd6c1a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for allan-variance-analyzer 1.0.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.