Skip to content

Commit

Permalink
Fix code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Mar 24, 2022
1 parent 9237639 commit 664712d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ahrs/filters/famc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""
Fast Accelerometer-Magnetometer Combination
===========================================
Expand Down Expand Up @@ -161,6 +162,10 @@

import numpy as np

def _assert_iterables(item, item_name: str = 'iterable'):
if not isinstance(item, (list, tuple, np.ndarray)):
raise TypeError(f"{item_name} must be given as an array. Got {type(item)}")

class FAMC:
"""
Fast Accelerometer-Magnetometer Combination
Expand Down Expand Up @@ -206,8 +211,8 @@ class FAMC:
"""
def __init__(self, acc: np.ndarray = None, mag: np.ndarray = None):
self.acc = acc.copy()
self.mag = mag.copy()
self.acc: np.ndarray = acc
self.mag: np.ndarray = mag
self.Q = None
if self.acc is not None and self.mag is not None:
self.Q = self._compute_all()
Expand All @@ -220,11 +225,13 @@ def _compute_all(self) -> np.ndarray:
Returns
-------
Q : array
Q : numpy.ndarray
M-by-4 Array with all estimated quaternions, where M is the number
of samples.
"""
_assert_iterables(self.acc, 'acc')
_assert_iterables(self.mag, 'mag')
if self.acc.shape != self.mag.shape:
raise ValueError("acc and mag are not the same size")
if self.acc.ndim < 2:
Expand Down

0 comments on commit 664712d

Please sign in to comment.