From 7a2e50a7467e5119ca1e5becf12092491769cac0 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Wed, 15 May 2024 06:26:05 -0400 Subject: [PATCH] MNT: minor fixes - typos and isort --- rocketpy/mathutils/vector_matrix.py | 4 ++-- rocketpy/sensors/accelerometer.py | 2 +- rocketpy/tools.py | 2 +- tests/test_sensors.py | 3 ++- tests/unit/test_sensors.py | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rocketpy/mathutils/vector_matrix.py b/rocketpy/mathutils/vector_matrix.py index c10ec5faf..fb884a672 100644 --- a/rocketpy/mathutils/vector_matrix.py +++ b/rocketpy/mathutils/vector_matrix.py @@ -950,7 +950,7 @@ def dot(self, other): return self.__matmul__(other) def round(self, decimals=0): - """Round the matrix to a given number of decimals. + """Round all the values matrix to a given number of decimals. Parameters ---------- @@ -1040,7 +1040,7 @@ def transformation(quaternion): q_x /= q_norm q_y /= q_norm q_z /= q_norm - # precompute common terms + # pre-compute common terms q_x2 = q_x**2 q_y2 = q_y**2 q_z2 = q_z**2 diff --git a/rocketpy/sensors/accelerometer.py b/rocketpy/sensors/accelerometer.py index 29fe7f0ec..38628fcbc 100644 --- a/rocketpy/sensors/accelerometer.py +++ b/rocketpy/sensors/accelerometer.py @@ -237,7 +237,7 @@ def measure(self, t, u, u_dot, relative_position, gravity, *args): ) A = inertial_to_sensor @ A - # Apply noise + bias and quatize + # Apply noise + bias and quantize A = self.apply_noise(A) A = self.apply_temperature_drift(A) A = self.quantize(A) diff --git a/rocketpy/tools.py b/rocketpy/tools.py index 213225410..d5526c1d1 100644 --- a/rocketpy/tools.py +++ b/rocketpy/tools.py @@ -1,9 +1,9 @@ import functools import importlib import importlib.metadata +import math import re import time -import math from bisect import bisect_left import numpy as np diff --git a/tests/test_sensors.py b/tests/test_sensors.py index 62c872b90..99ae7a0dd 100644 --- a/tests/test_sensors.py +++ b/tests/test_sensors.py @@ -1,5 +1,6 @@ import json import os + import numpy as np from rocketpy.mathutils.vector_matrix import Vector @@ -25,7 +26,7 @@ def test_sensor_on_rocket(calisto_accel_gyro): def test_ideal_sensors(flight_calisto_accel_gyro): - """Test the ideal sensors. All types of sensors are here to reduvce + """Test the ideal sensors. All types of sensors are here to reduce testing time. Parameters diff --git a/tests/unit/test_sensors.py b/tests/unit/test_sensors.py index 4e08dfcea..ff746e4ae 100644 --- a/tests/unit/test_sensors.py +++ b/tests/unit/test_sensors.py @@ -2,8 +2,8 @@ import os import numpy as np -from pytest import approx import pytest +from pytest import approx from rocketpy.mathutils.vector_matrix import Matrix, Vector from rocketpy.tools import euler_to_quaternions