Skip to content

inertialsim.analysis

Inertial sensor analysis tools.

The analysis module provides classes and methods to:

  • calculate Allan deviation (the standard method of characterizing random error in inertial sensors)
  • fit parametric models to Allan deviation data

Classes:

Name Description
AllanDeviation

Allan deviation (variance) analysis of random noise.

NoiseModel

Noise parameters to include when fitting Allan deviation model.

AllanDeviation

Allan deviation (variance) analysis of random noise.

Allan deviation (or it's square, Allan variance) is a standard technique for analysis of random noise sources in inertial sensors. See Standards [05] and [06] for further details.

This class provides methods to calculate Allan deviation and its estimated accuracy. It also provides methods to extract best-fit parameters from an Allan deviation signal.

Methods:

Name Description
calculate

Calculate the Allan deviation of a uniformly sampled signal.

fit_model

Fit standard noise parameters to an Allan deviation signal.

calculate classmethod

calculate(
    measurement: Measurement, num_clusters: int = 100
) -> tuple[NDArray, NDArray, NDArray]

Calculate the Allan deviation of a uniformly sampled signal.

The Allan deviation is a statistical measure used in characterizing random processes in time domain signals. It is calculated as the standard deviation of a sliding window of time averages across a signal, with the window varying from a minimum value of a single sample up to a maximum of half the duration of the signal (the Nyquist frequency). Each window covers a "cluster" of data points of a fixed length (given that the signal is uniformly sampled in time).

Allan deviation (or its square, Allan variance) is the standard method for characterizing noise in inertial sensors. The function returns the fully overlapping Allan deviation as defined in Section C.1. of Standard [05]. See also Reference [20] for further details.

Parameters:

Name Type Description Default
measurement Measurement

Measurement object containing the sensor data to analyze. This should be uniformly sampled time series data. The results will be calculated independently for each channel.

required
num_clusters int

Number of logarithmically spaced cluster sizes to return. Must be at least 1. Default = 100.

100

Returns:

Name Type Description
tau NDArray

Averaging time (in seconds) corresponding to each Allan deviation output. Tau is logarithmically spaced from a minimum <= the sample period to a <= the Nyquist frequency (half the sample rate).

allan_deviation NDArray

An estimate of the Allan deviation of the input signal.

allan_deviation_deviation NDArray

An estimate of the standard deviation of the Allan deviation.

fit_model classmethod

fit_model(
    model: NoiseModel,
    tau: ArrayLike,
    allan_deviation: ArrayLike,
    allan_deviation_deviation: ArrayLike | None = None,
) -> NDArray

Fit standard noise parameters to an Allan deviation signal.

Find the coefficients of quantization (Q), random walk (N), bias instability (B), rate random walk (K), and rate ramp (R) noises that best fit the Allan deviation data (in the weighted least squares sense). See calculate to calculate the required inputs from sensor measurements.

See Standard [05], Section C.1 and Reference [20] & Reference [29] for further details. Note: this procedure is optimal in the sense of Reference [29] when the model is correctly specified.

The resulting model parameters can then be used in IMU, gyro, and accelerometer specifications.

Parameters:

Name Type Description Default
model NoiseModel

NoiseModel specifying which coefficients to include in the least squares model fit.

required
tau ArrayLike

Averaging time (in seconds) corresponding to each Allan deviation input.

required
allan_deviation ArrayLike

Allan deviation.

required
allan_deviation_deviation ArrayLike | None

Optional estimate of the standard deviation of the Allan deviation. If None, all inputs will be weighted equally.

None

Returns:

Name Type Description
noise_parameters NDArray

Array of up to 5 noise parameters [Q, N, B, K, R]. Units will be compatible with the units of the input Allan deviation. If model excludes some parameters, the included parameters will be returned in the order shown. Negative coefficients will be truncated to 0.0. This typically indicates insufficient data and/or a mis-specified model.

Raises:

Type Description
ValueError

Model does not include any coefficients to fit.

NoiseModel dataclass

NoiseModel(
    *,
    fit_quantization: bool = True,
    fit_random_walk: bool = True,
    fit_bias_instability: bool = True,
    fit_rate_random_walk: bool = True,
    fit_rate_ramp: bool = True,
)

Noise parameters to include when fitting Allan deviation model.

Specify which noise parameters to include when fitting a least-squares model to Allan deviation data.

Attributes:

Name Type Description
fit_quantization bool

Include angle (gyro) or velocity (accelerometer) quantization terms in

fit_random_walk bool

Include angle (gyro) or velocity (accelerometer) random walk terms in

fit_bias_instability bool

Include angular rate (gyro) or acceleration (accelerometer) bias

fit_rate_random_walk bool

Include angular rate (gyro) or acceleration (accelerometer) random walk

fit_rate_ramp bool

Include angular rate (gyro) or acceleration (accelerometer) ramp

fit_quantization class-attribute instance-attribute

fit_quantization: bool = True

Include angle (gyro) or velocity (accelerometer) quantization terms in the Allan deviation model.

fit_random_walk class-attribute instance-attribute

fit_random_walk: bool = True

Include angle (gyro) or velocity (accelerometer) random walk terms in the Allan deviation model.

fit_bias_instability class-attribute instance-attribute

fit_bias_instability: bool = True

Include angular rate (gyro) or acceleration (accelerometer) bias instability terms in the Allan deviation model.

fit_rate_random_walk class-attribute instance-attribute

fit_rate_random_walk: bool = True

Include angular rate (gyro) or acceleration (accelerometer) random walk terms in the Allan deviation model.

fit_rate_ramp class-attribute instance-attribute

fit_rate_ramp: bool = True

Include angular rate (gyro) or acceleration (accelerometer) ramp terms in the Allan deviation model.