From e181bd98ca5c9238cd7c8288a5e337154333b03c Mon Sep 17 00:00:00 2001 From: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com> Date: Wed, 6 May 2026 11:28:46 +0000 Subject: [PATCH] [MegaLinter] Apply linters automatic fixes --- .../bingham_distribution.py | 4 +--- src/pyrecest/filters/__init__.py | 2 +- .../spherical_harmonics_eot_tracker.py | 21 ++++++++++--------- .../test_spherical_harmonics_eot_tracker.py | 12 ++++++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/pyrecest/distributions/hypersphere_subset/bingham_distribution.py b/src/pyrecest/distributions/hypersphere_subset/bingham_distribution.py index 967efa33e..0f8277bdf 100644 --- a/src/pyrecest/distributions/hypersphere_subset/bingham_distribution.py +++ b/src/pyrecest/distributions/hypersphere_subset/bingham_distribution.py @@ -65,9 +65,7 @@ def integrand(u): b23_0 = iv(0, t23) b23_1 = iv(1, t23) base = b01_0 * b23_0 - exp_factor = _np.exp( - 0.5 * (Z[0] + Z[1]) * u + 0.5 * (Z[2] + Z[3]) * u_comp - ) + exp_factor = _np.exp(0.5 * (Z[0] + Z[1]) * u + 0.5 * (Z[2] + Z[3]) * u_comp) dF = _np.array( [ exp_factor * 0.5 * u * (b01_1 * b23_0 + base), diff --git a/src/pyrecest/filters/__init__.py b/src/pyrecest/filters/__init__.py index 83b24a1d2..22294e5f4 100644 --- a/src/pyrecest/filters/__init__.py +++ b/src/pyrecest/filters/__init__.py @@ -79,11 +79,11 @@ from .random_matrix_tracker import RandomMatrixTracker from .se2_ukf import SE2UKF from .so3_product_particle_filter import SO3ProductParticleFilter -from .state_space_subdivision_filter import StateSpaceSubdivisionFilter from .spherical_harmonics_eot_tracker import ( SphericalHarmonicsEOTTracker, SphericalHarmonicsExtendedObjectTracker, ) +from .state_space_subdivision_filter import StateSpaceSubdivisionFilter from .toroidal_particle_filter import ToroidalParticleFilter from .toroidal_wrapped_normal_filter import ToroidalWrappedNormalFilter from .track_manager import ( diff --git a/src/pyrecest/filters/spherical_harmonics_eot_tracker.py b/src/pyrecest/filters/spherical_harmonics_eot_tracker.py index f78e7009d..5ebd84fcb 100644 --- a/src/pyrecest/filters/spherical_harmonics_eot_tracker.py +++ b/src/pyrecest/filters/spherical_harmonics_eot_tracker.py @@ -1,7 +1,6 @@ from __future__ import annotations import numpy as np - import pyrecest.backend # pylint: disable=no-member,no-name-in-module,too-many-lines @@ -34,7 +33,9 @@ from .abstract_extended_object_tracker import AbstractExtendedObjectTracker -class SphericalHarmonicsEOTTracker(AbstractExtendedObjectTracker): # pylint: disable=too-many-instance-attributes +class SphericalHarmonicsEOTTracker( + AbstractExtendedObjectTracker +): # pylint: disable=too-many-instance-attributes """3-D star-convex EOT tracker with spherical-harmonic extent coefficients. The state is ``[cx, cy, cz, c_00, c_1,-1, c_1,0, c_1,1, ...]``. The @@ -256,7 +257,9 @@ def _complex_coeff_mat_to_real(complex_coeff_mat): * real(complex_coeff_mat[degree, degree + order]) ) else: - real_coeff_mat[degree, degree] = real(complex_coeff_mat[degree, degree]) + real_coeff_mat[degree, degree] = real( + complex_coeff_mat[degree, degree] + ) return real_coeff_mat @staticmethod @@ -305,13 +308,11 @@ def evaluate_radius_from_coefficients(coefficients, directions): radii = zeros(directions.shape[1]) for degree in range(coeff_mat.shape[0]): for order in range(-degree, degree + 1): - basis_values = ( - SphericalHarmonicsDistributionReal.real_spherical_harmonic_basis_function( - degree, - order, - theta, - phi, - ) + basis_values = SphericalHarmonicsDistributionReal.real_spherical_harmonic_basis_function( + degree, + order, + theta, + phi, ) radii += coeff_mat[degree, degree + order] * basis_values return radii diff --git a/tests/filters/test_spherical_harmonics_eot_tracker.py b/tests/filters/test_spherical_harmonics_eot_tracker.py index d37aab945..e46e11ed3 100644 --- a/tests/filters/test_spherical_harmonics_eot_tracker.py +++ b/tests/filters/test_spherical_harmonics_eot_tracker.py @@ -17,7 +17,9 @@ def test_coefficient_vector_matrix_roundtrip(self): coefficients = array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]) coeff_mat = SphericalHarmonicsEOTTracker.coefficients_to_matrix(coefficients) - coefficients_roundtrip = SphericalHarmonicsEOTTracker.matrix_to_coefficients(coeff_mat) + coefficients_roundtrip = SphericalHarmonicsEOTTracker.matrix_to_coefficients( + coeff_mat + ) self.assertEqual(coeff_mat.shape, (3, 5)) npt.assert_allclose(coefficients_roundtrip, coefficients) @@ -64,7 +66,9 @@ def test_measurement_function_projects_points_to_current_surface(self): ] ) - predicted = tracker.measurement_function(tracker.get_point_estimate(), measurements) + predicted = tracker.measurement_function( + tracker.get_point_estimate(), measurements + ) expected_points = array( [ @@ -87,7 +91,9 @@ def test_update_increases_radius_toward_far_measurement(self): tracker.update(array([2.0, 0.0, 0.0]), meas_noise_cov=0.01 * eye(3)) - self.assertGreater(tracker.evaluate_radius(array([1.0, 0.0, 0.0])), prior_radius) + self.assertGreater( + tracker.evaluate_radius(array([1.0, 0.0, 0.0])), prior_radius + ) self.assertLess(tracker.covariance[3, 3], prior_covariance[3, 3]) self.assertTrue(isfinite(tracker.latest_predicted_measurement).all()) self.assertTrue(linalg.eigvalsh(tracker.covariance)[0] > -1e-8)