Skip to content

Commit a80c8e0

Browse files
doc: improve noise module documentation with respect to noise units (#86)
1 parent b633bdc commit a80c8e0

1 file changed

Lines changed: 31 additions & 24 deletions

File tree

src/smsfusion/noise/_noise.py

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,10 @@ class IMUNoise:
328328
Provides an interface for generating random IMU sensor measurement noise with
329329
the following contributions for each sensor axis (x, y, z):
330330
331-
- **N**: White noise
332-
- **B**: Flicker noise (sometimes referred to as 'pink noise' or 'bias instability')
333-
- **K**: Drift / Brownian noise (optional)
334-
- **bc**: Constant bias (optional)
331+
- **N**: White noise.
332+
- **B**: Flicker noise (sometimes referred to as 'pink noise' or 'bias instability').
333+
- **K**: Drift / Brownian noise (optional).
334+
- **bc**: Constant bias (optional).
335335
336336
A white sequence, ``WN[k]``, with spectral density ``N**2`` is generated by drawing samples
337337
from a Normal distribution with standard deviation ``N * sqrt(fs)``.
@@ -401,21 +401,21 @@ class IMUNoise:
401401
.. code-block:: python
402402
403403
err_acc = {
404-
"bc": (0.1, 0.2, 0.3),
405-
"N": (1.0e-4, 2.0e-4, 3e-4),
406-
"B": (1.0e-5, 2.0e-5, 3.0e-5),
407-
"K": (1.0e-6, 2.0e-6, 3.0e-6),
408-
"tau_cb": (10.0, 20.0, 30.0),
409-
"tau_ck": (1_000.0, 2_000.0, 3_000.0),
404+
"bc": (0.1, 0.2, 0.3), # m/s^2
405+
"N": (7.0e-4, 7.0e-4, 8.0e-4), # (m/s^2)/sqrt(Hz)
406+
"B": (5.0e-4, 5.0e-4, 6.0e-4), # m/s^2
407+
"K": (1.0e-7, 1.0e-7, 1.0e-7), # (m/s^2)*sqrt(Hz)
408+
"tau_cb": (50.0, 50.0, 50.0), # s
409+
"tau_ck": (3_600.0, 3_600.0, 3_600.0), # s
410410
}
411411
412412
err_gyro = {
413-
"bc": (0.4, 0.5, 0.6),
414-
"N": (4.0e-4, 5.0e-4, 6e-4),
415-
"B": (4.0e-5, 5.0e-5, 6.0e-5),
416-
"K": (4.0e-6, 5.0e-6, 6.0e-6),
417-
"tau_cb": (40.0, 50.0, 60.0),
418-
"tau_ck": (4_000.0, 5_000.0, 6_000.0),
413+
"bc": (0.04, 0.05, 0.06), # rad/s
414+
"N": (5.0e-5, 5.0e-5, 6.0e-5), # (rad/s)/sqrt(Hz)
415+
"B": (3.0-5, 3.0-5, 4.0-5), # rad/s
416+
"K": (4.0e-7, 4.0e-7, 5.0e-7), # (rad/s)*sqrt(Hz)
417+
"tau_cb": (50.0, 50.0, 50.0), # s
418+
"tau_ck": (3_600.0, 3_600.0, 3_600.0), # s
419419
}
420420
421421
imu_noise = IMUNoise(err_acc, err_gyro)
@@ -426,19 +426,27 @@ class IMUNoise:
426426
.. code-block:: python
427427
428428
err_acc = {
429-
"N": 1.0e-4,
430-
"B": 1.0e-5,
431-
"tau_cb": 10.0,
429+
"N": 7.0e-4, # (m/s^2)/sqrt(Hz)
430+
"B": 5.0e-4, # m/s^2
431+
"tau_cb": 50.0, # s
432432
}
433433
434434
err_gyro = {
435-
"N": 4.0e-4,
436-
"B": 4.0e-5,
437-
"tau_cb": 40.0,
435+
"N": 5.0e-5, # (rad/s)/sqrt(Hz)
436+
"B": 3.0-5, # rad/s
437+
"tau_cb": 50.0, # s
438438
}
439439
440440
imu_noise = IMUNoise(err_acc, err_gyro)
441441
442+
Dictionaries with noise parameters for the SMS Motion Gen 2 sensor are provided
443+
in the :mod:`smsfusion.constants` module.
444+
445+
- :const:`smsfusion.constants.ERR_ACC_MOTION2`
446+
- :const:`smsfusion.constants.ERR_GYRO_MOTION2`
447+
448+
The values represent accelerometer noise in m/s^2 and gyroscope noise in rad/s.
449+
442450
See Also
443451
--------
444452
smsfusion.constants.ERR_ACC_MOTION1
@@ -522,8 +530,7 @@ def __call__(self, fs: float, n: int) -> NDArray[np.float64]:
522530
Notes
523531
-----
524532
The generated noise will have units corresponding to the noise
525-
parameters given during initialization; the default noise parameters
526-
yields accelerometer noise in m/s^2, and gyroscope noise in deg/s.
533+
parameters given during initialization.
527534
"""
528535
seeds = _gen_seeds(self._seed, 6)
529536
x = np.column_stack(

0 commit comments

Comments
 (0)