diff --git a/src/pyrecest/_backend/numpy/linalg.py b/src/pyrecest/_backend/numpy/linalg.py index fe9b33ad29..cd1312f9e7 100644 --- a/src/pyrecest/_backend/numpy/linalg.py +++ b/src/pyrecest/_backend/numpy/linalg.py @@ -22,16 +22,20 @@ from .._shared_numpy.linalg import ( _normalize_fractional_matrix_power_exponent, - fractional_matrix_power as _fractional_matrix_power, +) +from .._shared_numpy.linalg import fractional_matrix_power as _fractional_matrix_power +from .._shared_numpy.linalg import ( is_single_matrix_pd, - logm as _logm, +) +from .._shared_numpy.linalg import logm as _logm +from .._shared_numpy.linalg import ( polar, qr, quadratic_assignment, solve, solve_sylvester, - sqrtm as _sqrtm, ) +from .._shared_numpy.linalg import sqrtm as _sqrtm def _empty_zero_by_zero_matrix_result(value): diff --git a/src/pyrecest/_backend/pytorch/random.py b/src/pyrecest/_backend/pytorch/random.py index 54340db9d7..eaf5728a57 100644 --- a/src/pyrecest/_backend/pytorch/random.py +++ b/src/pyrecest/_backend/pytorch/random.py @@ -267,9 +267,7 @@ def _validate_randint_array_dtype_bounds(low, high, dtype): # representable by the output dtype, as in randint(255, 256, dtype=uint8). # For int64, input tensors cannot represent max + 1, so every accepted high # value is already within the valid endpoint range. - if dtype != _torch.int64 and bool( - _torch.any(high_int64 > dtype_info.max + 1) - ): + if dtype != _torch.int64 and bool(_torch.any(high_int64 > dtype_info.max + 1)): raise ValueError(f"high is out of bounds for {dtype_name}") diff --git a/src/pyrecest/backend_support/_pytorch_one_hot_scalar_contract.py b/src/pyrecest/backend_support/_pytorch_one_hot_scalar_contract.py index 4e5b06bd89..94cea6bc0c 100644 --- a/src/pyrecest/backend_support/_pytorch_one_hot_scalar_contract.py +++ b/src/pyrecest/backend_support/_pytorch_one_hot_scalar_contract.py @@ -277,9 +277,7 @@ def array_equal(a, b, equal_nan=False): comparison = torch_module.eq(a, b) if dtype.is_floating_point or dtype.is_complex: - comparison = comparison | ( - torch_module.isnan(a) & torch_module.isnan(b) - ) + comparison = comparison | (torch_module.isnan(a) & torch_module.isnan(b)) return bool(torch_module.all(comparison)) array_equal.__name__ = getattr(original_array_equal, "__name__", "array_equal") diff --git a/src/pyrecest/distributions/abstract_custom_distribution.py b/src/pyrecest/distributions/abstract_custom_distribution.py index 7fa21201e4..d3a596f8bd 100644 --- a/src/pyrecest/distributions/abstract_custom_distribution.py +++ b/src/pyrecest/distributions/abstract_custom_distribution.py @@ -10,7 +10,6 @@ from .abstract_distribution_type import AbstractDistributionType - _INVALID_INTEGRAL_TYPES = ( bool, np.bool_, diff --git a/src/pyrecest/distributions/cart_prod/gauss_von_mises_distribution.py b/src/pyrecest/distributions/cart_prod/gauss_von_mises_distribution.py index 3f2359e890..0f1962eca3 100644 --- a/src/pyrecest/distributions/cart_prod/gauss_von_mises_distribution.py +++ b/src/pyrecest/distributions/cart_prod/gauss_von_mises_distribution.py @@ -37,7 +37,6 @@ from ..nonperiodic.gaussian_distribution import GaussianDistribution from .abstract_hypercylindrical_distribution import AbstractHypercylindricalDistribution - _INVALID_SCALAR_TYPES = ( str, bytes, diff --git a/src/pyrecest/distributions/cart_prod/hypercylindrical_state_space_subdivision_distribution.py b/src/pyrecest/distributions/cart_prod/hypercylindrical_state_space_subdivision_distribution.py index 82cd2a09e2..3c63bbe58c 100644 --- a/src/pyrecest/distributions/cart_prod/hypercylindrical_state_space_subdivision_distribution.py +++ b/src/pyrecest/distributions/cart_prod/hypercylindrical_state_space_subdivision_distribution.py @@ -38,7 +38,9 @@ from pyrecest.distributions.nonperiodic.custom_linear_distribution import ( CustomLinearDistribution, ) -from pyrecest.distributions.nonperiodic.gaussian_distribution import GaussianDistribution +from pyrecest.distributions.nonperiodic.gaussian_distribution import ( + GaussianDistribution, +) from pyrecest.distributions.nonperiodic.linear_mixture import LinearMixture diff --git a/src/pyrecest/distributions/hypersphere_subset/von_mises_fisher_distribution.py b/src/pyrecest/distributions/hypersphere_subset/von_mises_fisher_distribution.py index e5b96943be..fabc78a7bc 100644 --- a/src/pyrecest/distributions/hypersphere_subset/von_mises_fisher_distribution.py +++ b/src/pyrecest/distributions/hypersphere_subset/von_mises_fisher_distribution.py @@ -33,7 +33,6 @@ from .abstract_hyperspherical_distribution import AbstractHypersphericalDistribution - _INVALID_REAL_SCALAR_TYPES = ( bool, np.bool_, diff --git a/src/pyrecest/distributions/hypersphere_subset/watson_distribution.py b/src/pyrecest/distributions/hypersphere_subset/watson_distribution.py index f4dcebb91c..36e2886120 100644 --- a/src/pyrecest/distributions/hypersphere_subset/watson_distribution.py +++ b/src/pyrecest/distributions/hypersphere_subset/watson_distribution.py @@ -29,7 +29,6 @@ from .abstract_hyperspherical_distribution import AbstractHypersphericalDistribution from .bingham_distribution import BinghamDistribution - _INVALID_REAL_SCALAR_TYPES = ( bool, np.bool_, diff --git a/src/pyrecest/evaluation/check_and_fix_config.py b/src/pyrecest/evaluation/check_and_fix_config.py index d90cb058a1..b4429a4c0f 100644 --- a/src/pyrecest/evaluation/check_and_fix_config.py +++ b/src/pyrecest/evaluation/check_and_fix_config.py @@ -1,7 +1,6 @@ from numbers import Integral, Real import numpy as np - from pyrecest.distributions import AbstractManifoldSpecificDistribution @@ -12,9 +11,9 @@ def _is_integer_count(value): def _validate_probability(value, name): - if isinstance(value, (bool, np.bool_, np.datetime64, np.timedelta64)) or not isinstance( - value, Real - ): + if isinstance( + value, (bool, np.bool_, np.datetime64, np.timedelta64) + ) or not isinstance(value, Real): raise TypeError(f"{name} must be a real scalar") value = float(value) if not np.isfinite(value) or not 0.0 <= value <= 1.0: diff --git a/src/pyrecest/evaluation/get_distance_function.py b/src/pyrecest/evaluation/get_distance_function.py index 44a2cb3407..1e0b325153 100644 --- a/src/pyrecest/evaluation/get_distance_function.py +++ b/src/pyrecest/evaluation/get_distance_function.py @@ -164,9 +164,7 @@ def distance_function(xest, xtrue): return distance_function -def _target_matrix_candidates( - value, name: str -) -> list[tuple[numpy.ndarray, int]]: +def _target_matrix_candidates(value, name: str) -> list[tuple[numpy.ndarray, int]]: value = _as_real_numeric_array(value, name) if value.ndim not in (1, 2): raise ValueError(f"{name} must be a one- or two-dimensional target set") diff --git a/src/pyrecest/experimental/dvs/vectorized_flow.py b/src/pyrecest/experimental/dvs/vectorized_flow.py index 6e1eea314a..2d80d4ca9a 100644 --- a/src/pyrecest/experimental/dvs/vectorized_flow.py +++ b/src/pyrecest/experimental/dvs/vectorized_flow.py @@ -48,9 +48,7 @@ def tracker_signed_normal_flows_vectorized( except Exception: # pragma: no cover - backend-specific safety fallback return np.asarray( [ - tracker.signed_normal_flow_for_measurement( - measurement, unit_velocity - ) + tracker.signed_normal_flow_for_measurement(measurement, unit_velocity) for measurement in measurements ], dtype=float, diff --git a/src/pyrecest/filters/daum_huang_particle_filter.py b/src/pyrecest/filters/daum_huang_particle_filter.py index 794d846a9b..3bbee63112 100644 --- a/src/pyrecest/filters/daum_huang_particle_filter.py +++ b/src/pyrecest/filters/daum_huang_particle_filter.py @@ -261,9 +261,7 @@ def __init__( self.flow_type if flow_type is None else flow_type ) self.n_steps = _validate_positive_int(n_steps, "n_steps") - self.step_schedule = ( - None if step_schedule is None else tuple(step_schedule) - ) + self.step_schedule = None if step_schedule is None else tuple(step_schedule) self.jitter = _validate_nonnegative_float(jitter, "jitter") def update_identity(self, meas_noise, measurement, **kwargs): @@ -736,10 +734,7 @@ def _regularize_cov_np(covariance, jitter): eigenvalues = np.linalg.eigvalsh(covariance) spectral_scale = max(float(np.max(np.abs(eigenvalues))), 1.0) tolerance = ( - 10.0 - * np.finfo(float).eps - * max(covariance.shape[0], 1) - * spectral_scale + 10.0 * np.finfo(float).eps * max(covariance.shape[0], 1) * spectral_scale ) min_eigenvalue = float(eigenvalues[0]) if min_eigenvalue < -tolerance: diff --git a/src/pyrecest/filters/global_nearest_neighbor.py b/src/pyrecest/filters/global_nearest_neighbor.py index 82f7b0f9e1..7fd108c49f 100644 --- a/src/pyrecest/filters/global_nearest_neighbor.py +++ b/src/pyrecest/filters/global_nearest_neighbor.py @@ -22,7 +22,6 @@ from .abstract_nearest_neighbor_tracker import AbstractNearestNeighborTracker - _INVALID_PAIRWISE_COST_SCALAR_TYPES = ( type(None), bool, diff --git a/src/pyrecest/filters/mode_rbpf_manifold_ukf_tracker.py b/src/pyrecest/filters/mode_rbpf_manifold_ukf_tracker.py index 18d94faa0e..dc61fa6139 100644 --- a/src/pyrecest/filters/mode_rbpf_manifold_ukf_tracker.py +++ b/src/pyrecest/filters/mode_rbpf_manifold_ukf_tracker.py @@ -876,9 +876,7 @@ def _normalize_probs(probs): ) total = float(np.sum(probs)) if total <= 0.0: - raise ValueError( - "initial_mode_probs must have positive total probability" - ) + raise ValueError("initial_mode_probs must have positive total probability") return probs / total @staticmethod diff --git a/src/pyrecest/filters/multisensor_hdp_association.py b/src/pyrecest/filters/multisensor_hdp_association.py index 6c03018ada..1722a0912b 100644 --- a/src/pyrecest/filters/multisensor_hdp_association.py +++ b/src/pyrecest/filters/multisensor_hdp_association.py @@ -337,19 +337,14 @@ def multisensor_hdp_association( ) log_concentration = np.log(concentration) - target_log_priors = ( - np.logaddexp( - _safe_log(counts), - log_concentration + _safe_log(base_target_weights), - ) - + _safe_log(detection) - ) + target_log_priors = np.logaddexp( + _safe_log(counts), + log_concentration + _safe_log(base_target_weights), + ) + _safe_log(detection) existing_log_weights = log_likelihoods + target_log_priors[None, :] birth_log_weights = ( - birth_log_likelihood - + log_concentration - + _safe_log(base_birth_weight) + birth_log_likelihood + log_concentration + _safe_log(base_birth_weight) ) clutter_log_weights = clutter_log_likelihood + _safe_log(clutter_weight) log_weights = np.concatenate( diff --git a/src/pyrecest/filters/sequence_association.py b/src/pyrecest/filters/sequence_association.py index 6f62962c7a..dc55ec4676 100644 --- a/src/pyrecest/filters/sequence_association.py +++ b/src/pyrecest/filters/sequence_association.py @@ -360,9 +360,8 @@ def _validate_integer(value: object, name: str) -> int: raise ValueError(message) from exc if value_array.ndim != 0 or value_array.dtype == np.bool_: raise ValueError(message) - if ( - value_array.dtype.kind in {"S", "U", "c"} - or _is_temporal_scalar_array(value_array) + if value_array.dtype.kind in {"S", "U", "c"} or _is_temporal_scalar_array( + value_array ): raise ValueError(message) diff --git a/src/pyrecest/models/linear_gaussian.py b/src/pyrecest/models/linear_gaussian.py index 7ed22d4ae5..c784cc2bc6 100644 --- a/src/pyrecest/models/linear_gaussian.py +++ b/src/pyrecest/models/linear_gaussian.py @@ -2,8 +2,8 @@ from numbers import Complex, Integral, Real +from pyrecest.backend import all as backend_all from pyrecest.backend import ( - all as backend_all, asarray, ) from pyrecest.backend import copy as backend_copy diff --git a/src/pyrecest/smoothers/abstract_smoother.py b/src/pyrecest/smoothers/abstract_smoother.py index 867352fa36..64978d4d46 100644 --- a/src/pyrecest/smoothers/abstract_smoother.py +++ b/src/pyrecest/smoothers/abstract_smoother.py @@ -161,9 +161,7 @@ def _normalize_vector_sequence( # pylint: disable=too-many-return-statements expected_shape = (vector_dim,) shape_error = f"{name} must contain vectors with shape {expected_shape}." - if isinstance(values, (list, tuple)) and any( - value is None for value in values - ): + if isinstance(values, (list, tuple)) and any(value is None for value in values): values_arr = None else: try: diff --git a/src/pyrecest/utils/_point_set_registration_common.py b/src/pyrecest/utils/_point_set_registration_common.py index 46fdafacb5..84405b9a2f 100644 --- a/src/pyrecest/utils/_point_set_registration_common.py +++ b/src/pyrecest/utils/_point_set_registration_common.py @@ -25,7 +25,6 @@ from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist - _INVALID_REAL_SCALAR_TYPES = ( type(None), bool, diff --git a/src/pyrecest/utils/_roi_assignment_extreme_range.py b/src/pyrecest/utils/_roi_assignment_extreme_range.py index abed064058..de721ce304 100644 --- a/src/pyrecest/utils/_roi_assignment_extreme_range.py +++ b/src/pyrecest/utils/_roi_assignment_extreme_range.py @@ -15,8 +15,7 @@ def _cost_conversion_is_finite( threshold_cost = max_similarity - min_similarity dummy_penalty = max( 1e-12, - sys.float_info.epsilon - * max(1.0, abs(max_similarity), abs(min_similarity)), + sys.float_info.epsilon * max(1.0, abs(max_similarity), abs(min_similarity)), ) return math.isfinite(threshold_cost) and math.isfinite( threshold_cost + dummy_penalty diff --git a/src/pyrecest/utils/metrics.py b/src/pyrecest/utils/metrics.py index 0153d8e2aa..9b869436a4 100644 --- a/src/pyrecest/utils/metrics.py +++ b/src/pyrecest/utils/metrics.py @@ -579,11 +579,7 @@ def _as_covariance_stack( def _as_positive_int(value: Any, name: str) -> int: array = np.asarray(value) - if ( - array.ndim != 0 - or array.dtype == np.bool_ - or array.dtype.kind in {"M", "m"} - ): + if array.ndim != 0 or array.dtype == np.bool_ or array.dtype.kind in {"M", "m"}: raise ValueError(f"{name} must be a positive integer") scalar = array.item() if isinstance(scalar, (int, np.integer)) and not isinstance(scalar, bool): diff --git a/src/pyrecest/utils/point_set_registration.py b/src/pyrecest/utils/point_set_registration.py index 1a7d60b724..f291b54715 100644 --- a/src/pyrecest/utils/point_set_registration.py +++ b/src/pyrecest/utils/point_set_registration.py @@ -214,8 +214,10 @@ def _validate_positive_integer(value, name: str, *, minimum: int = 1) -> int: except TypeError: pass - if isinstance(value, np.ndarray) and value.shape == () and isinstance( - value.item(), temporal_types + if ( + isinstance(value, np.ndarray) + and value.shape == () + and isinstance(value.item(), temporal_types) ): raise ValueError(error_message) diff --git a/tests/backend/test_numpy_fractional_matrix_power_exponent_validation.py b/tests/backend/test_numpy_fractional_matrix_power_exponent_validation.py index e554d48271..ee5b57c7e4 100644 --- a/tests/backend/test_numpy_fractional_matrix_power_exponent_validation.py +++ b/tests/backend/test_numpy_fractional_matrix_power_exponent_validation.py @@ -2,7 +2,6 @@ import pytest from pyrecest._backend.numpy import linalg - _MATRIX = np.diag([4.0, 9.0]) @@ -16,9 +15,7 @@ np.timedelta64(2, "ns"), np.datetime64("1970-01-01T00:00:00.000000002"), np.array(np.timedelta64(2, "ns"), dtype=object), - np.array( - np.datetime64("1970-01-01T00:00:00.000000002"), dtype=object - ), + np.array(np.datetime64("1970-01-01T00:00:00.000000002"), dtype=object), "0.5", 0.5 + 0.0j, ], diff --git a/tests/backend/test_numpy_linalg_zero_by_zero_matrix_functions.py b/tests/backend/test_numpy_linalg_zero_by_zero_matrix_functions.py index 92668c9444..c96767d251 100644 --- a/tests/backend/test_numpy_linalg_zero_by_zero_matrix_functions.py +++ b/tests/backend/test_numpy_linalg_zero_by_zero_matrix_functions.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest._backend.numpy import linalg diff --git a/tests/backend/test_numpy_random_masked_parameters.py b/tests/backend/test_numpy_random_masked_parameters.py index b950f833b1..354b4d9255 100644 --- a/tests/backend/test_numpy_random_masked_parameters.py +++ b/tests/backend/test_numpy_random_masked_parameters.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest._backend.numpy import random diff --git a/tests/backend/test_numpy_random_masked_size.py b/tests/backend/test_numpy_random_masked_size.py index a1a9a3a8bc..f283db127e 100644 --- a/tests/backend/test_numpy_random_masked_size.py +++ b/tests/backend/test_numpy_random_masked_size.py @@ -2,7 +2,6 @@ import pytest from pyrecest._backend.numpy import random - _MASKED_SIZE_ARGUMENTS = ( np.ma.masked, np.ma.array(3, mask=True), diff --git a/tests/backend/test_pytorch_randint_dtype_bounds.py b/tests/backend/test_pytorch_randint_dtype_bounds.py index d633ecfa4b..3de40b1f37 100644 --- a/tests/backend/test_pytorch_randint_dtype_bounds.py +++ b/tests/backend/test_pytorch_randint_dtype_bounds.py @@ -1,7 +1,6 @@ import numpy as np import pytest - torch = pytest.importorskip("torch") from pyrecest._backend.pytorch import random # noqa: E402 @@ -16,9 +15,7 @@ ([0], [129], np.int8, "high is out of bounds for int8"), ], ) -def test_array_randint_rejects_bounds_outside_output_dtype( - low, high, dtype, message -): +def test_array_randint_rejects_bounds_outside_output_dtype(low, high, dtype, message): with pytest.raises(ValueError, match=message): random.randint(low, high, dtype=dtype) diff --git a/tests/backend/test_pytorch_random_multivariate_normal_keywords.py b/tests/backend/test_pytorch_random_multivariate_normal_keywords.py index f4d1982ee3..4f4fd0e773 100644 --- a/tests/backend/test_pytorch_random_multivariate_normal_keywords.py +++ b/tests/backend/test_pytorch_random_multivariate_normal_keywords.py @@ -1,7 +1,6 @@ import numpy as np import pytest - torch = pytest.importorskip("torch") from pyrecest._backend.pytorch import random # noqa: E402 diff --git a/tests/distributions/test_abstract_mixture_temporal_weights.py b/tests/distributions/test_abstract_mixture_temporal_weights.py index e18ba4cb95..a6a3ccaf71 100644 --- a/tests/distributions/test_abstract_mixture_temporal_weights.py +++ b/tests/distributions/test_abstract_mixture_temporal_weights.py @@ -1,7 +1,6 @@ import unittest import numpy as np - from pyrecest.distributions.abstract_mixture import _validate_mixture_weight_values diff --git a/tests/distributions/test_complex_acg_sample_count_precision.py b/tests/distributions/test_complex_acg_sample_count_precision.py index be98466cb2..53b99159ab 100644 --- a/tests/distributions/test_complex_acg_sample_count_precision.py +++ b/tests/distributions/test_complex_acg_sample_count_precision.py @@ -2,7 +2,6 @@ from fractions import Fraction import numpy as np - from pyrecest.distributions.hypersphere_subset.complex_angular_central_gaussian_distribution import ( _validate_positive_sample_count, ) diff --git a/tests/distributions/test_complex_watson_temporal_sample_count.py b/tests/distributions/test_complex_watson_temporal_sample_count.py index 12dd3e549b..ef8688604a 100644 --- a/tests/distributions/test_complex_watson_temporal_sample_count.py +++ b/tests/distributions/test_complex_watson_temporal_sample_count.py @@ -1,11 +1,9 @@ import numpy as np -import pytest - import pyrecest.backend +import pytest from pyrecest.backend import array, complex128 from pyrecest.distributions import ComplexWatsonDistribution - pytestmark = pytest.mark.skipif( pyrecest.backend.__backend_name__ == "jax", reason="Complex Watson sampling is not supported on the JAX backend", diff --git a/tests/distributions/test_ellipsoidal_ball_temporal_sample_count.py b/tests/distributions/test_ellipsoidal_ball_temporal_sample_count.py index 0e5cd24c2e..8a4eda0594 100644 --- a/tests/distributions/test_ellipsoidal_ball_temporal_sample_count.py +++ b/tests/distributions/test_ellipsoidal_ball_temporal_sample_count.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.backend import array, diag from pyrecest.distributions import EllipsoidalBallUniformDistribution diff --git a/tests/distributions/test_gauss_von_mises_scalar_validation.py b/tests/distributions/test_gauss_von_mises_scalar_validation.py index 4f7a6c0b2e..db93e5af25 100644 --- a/tests/distributions/test_gauss_von_mises_scalar_validation.py +++ b/tests/distributions/test_gauss_von_mises_scalar_validation.py @@ -49,9 +49,7 @@ def test_rejects_nonreal_or_masked_sample_counts(invalid_count): 0.5 + 0.0j, ], ) -def test_constructor_rejects_nonreal_or_masked_scalars( - parameter_name, invalid_value -): +def test_constructor_rejects_nonreal_or_masked_scalars(parameter_name, invalid_value): with pytest.raises(ValueError, match=parameter_name): _make_distribution(**{parameter_name: invalid_value}) diff --git a/tests/distributions/test_gaussian_marginalize_out_validation.py b/tests/distributions/test_gaussian_marginalize_out_validation.py index 9da6cbc212..510256396e 100644 --- a/tests/distributions/test_gaussian_marginalize_out_validation.py +++ b/tests/distributions/test_gaussian_marginalize_out_validation.py @@ -1,7 +1,6 @@ import unittest import numpy as np - from pyrecest.backend import array from pyrecest.distributions import GaussianDistribution diff --git a/tests/distributions/test_gaussian_mixture_complex_mean.py b/tests/distributions/test_gaussian_mixture_complex_mean.py index 4604d27a14..48c3ba18df 100644 --- a/tests/distributions/test_gaussian_mixture_complex_mean.py +++ b/tests/distributions/test_gaussian_mixture_complex_mean.py @@ -11,12 +11,8 @@ class GaussianMixtureComplexMeanTest(unittest.TestCase): def test_set_mean_rejects_complex_target_without_mutating_components(self): - component_1 = GaussianDistribution( - array([0.0, 1.0]), diag(array([1.0, 2.0])) - ) - component_2 = GaussianDistribution( - array([2.0, 3.0]), diag(array([3.0, 4.0])) - ) + component_1 = GaussianDistribution(array([0.0, 1.0]), diag(array([1.0, 2.0]))) + component_2 = GaussianDistribution(array([2.0, 3.0]), diag(array([3.0, 4.0]))) mixture = GaussianMixture([component_1, component_2], array([0.25, 0.75])) original_means = [to_numpy(dist.mu).copy() for dist in mixture.dists] diff --git a/tests/distributions/test_hypercylindrical_zero_marginals.py b/tests/distributions/test_hypercylindrical_zero_marginals.py index d782d86cc5..673982ab36 100644 --- a/tests/distributions/test_hypercylindrical_zero_marginals.py +++ b/tests/distributions/test_hypercylindrical_zero_marginals.py @@ -2,7 +2,6 @@ from math import pi import numpy as np - from pyrecest.backend import __backend_name__ as backend_name from pyrecest.backend import array from pyrecest.distributions.cart_prod.hypercylindrical_state_space_subdivision_distribution import ( diff --git a/tests/distributions/test_hypertoroidal_mixed_boolean_input_validation.py b/tests/distributions/test_hypertoroidal_mixed_boolean_input_validation.py index decf71c831..2061319113 100644 --- a/tests/distributions/test_hypertoroidal_mixed_boolean_input_validation.py +++ b/tests/distributions/test_hypertoroidal_mixed_boolean_input_validation.py @@ -23,9 +23,7 @@ def test_rejects_mixed_boolean_evaluation_points(self): def test_numeric_python_sequences_remain_valid(self): npt.assert_allclose(as_shift_vector([0.0, 1.0], 2), [0.0, 1.0]) - npt.assert_allclose( - as_hypertoroidal_points([[0.0, 1.0]], 2), [[0.0, 1.0]] - ) + npt.assert_allclose(as_hypertoroidal_points([[0.0, 1.0]], 2), [[0.0, 1.0]]) if __name__ == "__main__": diff --git a/tests/distributions/test_hypertoroidal_python_scalar_integrand.py b/tests/distributions/test_hypertoroidal_python_scalar_integrand.py index a94be22f9e..1c2077135b 100644 --- a/tests/distributions/test_hypertoroidal_python_scalar_integrand.py +++ b/tests/distributions/test_hypertoroidal_python_scalar_integrand.py @@ -1,7 +1,6 @@ import numpy as np import numpy.testing as npt import pytest - from pyrecest import backend from pyrecest.distributions import AbstractHypertoroidalDistribution diff --git a/tests/distributions/test_linear_box_particle_temporal_count.py b/tests/distributions/test_linear_box_particle_temporal_count.py index e75c61e84a..31e9ef6859 100644 --- a/tests/distributions/test_linear_box_particle_temporal_count.py +++ b/tests/distributions/test_linear_box_particle_temporal_count.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.backend import array from pyrecest.distributions.nonperiodic.linear_box_particle_distribution import ( LinearBoxParticleDistribution, diff --git a/tests/distributions/test_partially_wrapped_normal_hybrid_moment_order.py b/tests/distributions/test_partially_wrapped_normal_hybrid_moment_order.py index d1d045a31a..15c01efee8 100644 --- a/tests/distributions/test_partially_wrapped_normal_hybrid_moment_order.py +++ b/tests/distributions/test_partially_wrapped_normal_hybrid_moment_order.py @@ -2,7 +2,6 @@ import numpy as np import numpy.testing as npt - from pyrecest.backend import array from pyrecest.distributions.cart_prod.partially_wrapped_normal_distribution import ( PartiallyWrappedNormalDistribution, diff --git a/tests/distributions/test_piecewise_constant_interval_index_validation.py b/tests/distributions/test_piecewise_constant_interval_index_validation.py index 521852682a..675aa59025 100644 --- a/tests/distributions/test_piecewise_constant_interval_index_validation.py +++ b/tests/distributions/test_piecewise_constant_interval_index_validation.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.distributions.circle.piecewise_constant_distribution import ( PiecewiseConstantDistribution, ) diff --git a/tests/distributions/test_se2_dirac_temporal_particle_count.py b/tests/distributions/test_se2_dirac_temporal_particle_count.py index 20704ce014..8be4cda233 100644 --- a/tests/distributions/test_se2_dirac_temporal_particle_count.py +++ b/tests/distributions/test_se2_dirac_temporal_particle_count.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.distributions import SE2DiracDistribution from pyrecest.distributions.cart_prod.abstract_hypercylindrical_distribution import ( AbstractHypercylindricalDistribution, @@ -18,10 +17,14 @@ def sample(self, n): raise AssertionError("invalid temporal counts must not reach sampling") def marginalize_linear(self): - raise AssertionError("marginalization must not be evaluated for count validation") + raise AssertionError( + "marginalization must not be evaluated for count validation" + ) def marginalize_periodic(self): - raise AssertionError("marginalization must not be evaluated for count validation") + raise AssertionError( + "marginalization must not be evaluated for count validation" + ) @pytest.mark.parametrize( diff --git a/tests/distributions/test_so3_conversion_validation.py b/tests/distributions/test_so3_conversion_validation.py index 09ebb67f14..d3b6f9e697 100644 --- a/tests/distributions/test_so3_conversion_validation.py +++ b/tests/distributions/test_so3_conversion_validation.py @@ -16,7 +16,6 @@ SO3TangentGaussianDistribution, ) - _TEMPORAL_VALUES = ( np.timedelta64(3, "ns"), np.timedelta64(3, "us"), diff --git a/tests/distributions/test_von_mises_temporal_sample_count.py b/tests/distributions/test_von_mises_temporal_sample_count.py index 467b42c503..66d58a2ad4 100644 --- a/tests/distributions/test_von_mises_temporal_sample_count.py +++ b/tests/distributions/test_von_mises_temporal_sample_count.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.distributions import VonMisesDistribution diff --git a/tests/distributions/test_wrapped_exponential_extreme_rate.py b/tests/distributions/test_wrapped_exponential_extreme_rate.py index 0f24e350e6..98ec27b1e4 100644 --- a/tests/distributions/test_wrapped_exponential_extreme_rate.py +++ b/tests/distributions/test_wrapped_exponential_extreme_rate.py @@ -2,7 +2,6 @@ import numpy as np import numpy.testing as npt - import pyrecest.backend from pyrecest.backend import array from pyrecest.distributions.circle.wrapped_exponential_distribution import ( diff --git a/tests/distributions/test_wrapped_normal_temporal_sample_counts.py b/tests/distributions/test_wrapped_normal_temporal_sample_counts.py index 1a697b5480..fc39951a19 100644 --- a/tests/distributions/test_wrapped_normal_temporal_sample_counts.py +++ b/tests/distributions/test_wrapped_normal_temporal_sample_counts.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.distributions import WrappedNormalDistribution diff --git a/tests/evaluation/test_integer_estimate_history.py b/tests/evaluation/test_integer_estimate_history.py index 82f48dde1a..385f8379e0 100644 --- a/tests/evaluation/test_integer_estimate_history.py +++ b/tests/evaluation/test_integer_estimate_history.py @@ -1,7 +1,6 @@ import numpy as np import numpy.testing as npt import pytest - from pyrecest.backend import array, get_backend_name from pyrecest.evaluation import perform_predict_update_cycles from pyrecest.evaluation.configure_for_filter import register_filter_factory diff --git a/tests/filters/test_daum_huang_particle_flow_validation.py b/tests/filters/test_daum_huang_particle_flow_validation.py index 228fbd8c1f..8e4659c4ac 100644 --- a/tests/filters/test_daum_huang_particle_flow_validation.py +++ b/tests/filters/test_daum_huang_particle_flow_validation.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.backend import array, to_numpy from pyrecest.filters.daum_huang_particle_filter import ( gaussian_bridge_moments, diff --git a/tests/filters/test_euclidean_boxed_particle_filter_zero_support_likelihood.py b/tests/filters/test_euclidean_boxed_particle_filter_zero_support_likelihood.py index f1de6cd213..b4144dcfe4 100644 --- a/tests/filters/test_euclidean_boxed_particle_filter_zero_support_likelihood.py +++ b/tests/filters/test_euclidean_boxed_particle_filter_zero_support_likelihood.py @@ -2,7 +2,6 @@ import numpy as np import numpy.testing as npt - from pyrecest.backend import array, to_numpy from pyrecest.distributions.nonperiodic.linear_dirac_distribution import ( LinearDiracDistribution, diff --git a/tests/filters/test_gnn_pairwise_cost_weight_validation.py b/tests/filters/test_gnn_pairwise_cost_weight_validation.py index a3be13f890..d2f3f2e6fe 100644 --- a/tests/filters/test_gnn_pairwise_cost_weight_validation.py +++ b/tests/filters/test_gnn_pairwise_cost_weight_validation.py @@ -36,15 +36,13 @@ def test_rejects_invalid_pairwise_cost_weights(self): def test_accepts_finite_nonnegative_scalar_weights(self): for valid_weight in (0, 0.5, np.float64(2.0)): with self.subTest(pairwise_cost_weight=valid_weight): - validated_weight = ( - GlobalNearestNeighbor._validate_pairwise_cost_weight(valid_weight) + validated_weight = GlobalNearestNeighbor._validate_pairwise_cost_weight( + valid_weight ) self.assertEqual(validated_weight, float(valid_weight)) def test_zero_weight_ignores_positive_infinite_pairwise_gate(self): - tracker = GlobalNearestNeighbor( - association_param={"pairwise_cost_weight": 0.0} - ) + tracker = GlobalNearestNeighbor(association_param={"pairwise_cost_weight": 0.0}) geometric_costs = np.array([[1.25]]) combined_costs = tracker._apply_pairwise_cost_matrix( @@ -54,9 +52,7 @@ def test_zero_weight_ignores_positive_infinite_pairwise_gate(self): npt.assert_array_equal(combined_costs, geometric_costs) def test_positive_weight_scales_pairwise_costs(self): - tracker = GlobalNearestNeighbor( - association_param={"pairwise_cost_weight": 2.0} - ) + tracker = GlobalNearestNeighbor(association_param={"pairwise_cost_weight": 2.0}) combined_costs = tracker._apply_pairwise_cost_matrix( np.array([[1.0, 2.0]]), np.array([[3.0, 4.0]]) diff --git a/tests/filters/test_gnn_pairwise_object_cost_validation.py b/tests/filters/test_gnn_pairwise_object_cost_validation.py index 1956a965ac..53222d0fb1 100644 --- a/tests/filters/test_gnn_pairwise_object_cost_validation.py +++ b/tests/filters/test_gnn_pairwise_object_cost_validation.py @@ -78,12 +78,10 @@ def test_rejects_native_temporal_dtypes(self): ) def test_accepts_real_numeric_values(self): - pairwise_cost_matrix = ( - GlobalNearestNeighbor._validate_pairwise_cost_matrix( - [[1, 2.5]], - 1, - 2, - ) + pairwise_cost_matrix = GlobalNearestNeighbor._validate_pairwise_cost_matrix( + [[1, 2.5]], + 1, + 2, ) np.testing.assert_allclose(pairwise_cost_matrix, [[1.0, 2.5]]) diff --git a/tests/filters/test_measurement_reliability_temporal_counts.py b/tests/filters/test_measurement_reliability_temporal_counts.py index 2abed5d82b..4ff98c2a3b 100644 --- a/tests/filters/test_measurement_reliability_temporal_counts.py +++ b/tests/filters/test_measurement_reliability_temporal_counts.py @@ -1,7 +1,6 @@ import unittest import numpy as np - from pyrecest.filters import ( normalize_active_measurement_mask, normalize_measurement_noise_covariances, diff --git a/tests/filters/test_mode_rbpf_manifold_ukf_tracker.py b/tests/filters/test_mode_rbpf_manifold_ukf_tracker.py index bd6e3c87ae..ca3e7521eb 100644 --- a/tests/filters/test_mode_rbpf_manifold_ukf_tracker.py +++ b/tests/filters/test_mode_rbpf_manifold_ukf_tracker.py @@ -161,7 +161,6 @@ def test_update_without_measurements_is_noop(self): npt.assert_allclose(posterior, prior) - def test_preserves_impossible_mode_probabilities(self): transition_matrix = np.eye(3) tracker = self.make_tracker( diff --git a/tests/filters/test_nonadditive_arraylike_samples.py b/tests/filters/test_nonadditive_arraylike_samples.py index ae6d5c316c..67907c49e3 100644 --- a/tests/filters/test_nonadditive_arraylike_samples.py +++ b/tests/filters/test_nonadditive_arraylike_samples.py @@ -1,5 +1,4 @@ import numpy.testing as npt - from pyrecest.backend import array from pyrecest.distributions import LinearDiracDistribution from pyrecest.filters.euclidean_particle_filter import EuclideanParticleFilter @@ -7,9 +6,7 @@ def test_predict_nonlinear_nonadditive_accepts_array_like_samples_and_weights(): particle_filter = EuclideanParticleFilter(n_particles=3, dim=1) - particle_filter.filter_state = LinearDiracDistribution( - array([[0.0], [1.0], [2.0]]) - ) + particle_filter.filter_state = LinearDiracDistribution(array([[0.0], [1.0], [2.0]])) particle_filter.predict_nonlinear_nonadditive( lambda particle, noise: particle + noise, diff --git a/tests/filters/test_particle_filter_count_precision.py b/tests/filters/test_particle_filter_count_precision.py index def36a006b..9dee320f71 100644 --- a/tests/filters/test_particle_filter_count_precision.py +++ b/tests/filters/test_particle_filter_count_precision.py @@ -35,9 +35,7 @@ def test_particle_filter_count_validation_is_exact(validator): np.timedelta64(3, "ns"), np.datetime64("1970-01-01T00:00:00.000000003"), np.array(np.timedelta64(3, "ns"), dtype=object), - np.array( - np.datetime64("1970-01-01T00:00:00.000000003"), dtype=object - ), + np.array(np.datetime64("1970-01-01T00:00:00.000000003"), dtype=object), ], ids=["timedelta", "datetime", "object-timedelta", "object-datetime"], ) diff --git a/tests/filters/test_relaxed_s3f_process_noise_validation.py b/tests/filters/test_relaxed_s3f_process_noise_validation.py index b8d1cdca07..a02a22037c 100644 --- a/tests/filters/test_relaxed_s3f_process_noise_validation.py +++ b/tests/filters/test_relaxed_s3f_process_noise_validation.py @@ -28,7 +28,9 @@ def test_rejects_nonsymmetric_process_noise_without_mutating_state(self): self.assertTrue( bool( - (filter_.filter_state.linear_distributions[0].C == covariance_before).all() + ( + filter_.filter_state.linear_distributions[0].C == covariance_before + ).all() ) ) @@ -45,7 +47,9 @@ def test_rejects_indefinite_process_noise_without_mutating_state(self): self.assertTrue( bool( - (filter_.filter_state.linear_distributions[0].C == covariance_before).all() + ( + filter_.filter_state.linear_distributions[0].C == covariance_before + ).all() ) ) diff --git a/tests/filters/test_sequence_association_temporal_validation.py b/tests/filters/test_sequence_association_temporal_validation.py index 895b4fc60d..a3fb56a458 100644 --- a/tests/filters/test_sequence_association_temporal_validation.py +++ b/tests/filters/test_sequence_association_temporal_validation.py @@ -6,7 +6,6 @@ solve_viterbi_sequence_association, ) - _TEMPORAL_VALUES = ( pytest.param(np.timedelta64(1, "ns"), id="timedelta-ns"), pytest.param(np.timedelta64(1, "us"), id="timedelta-us"), diff --git a/tests/models/test_linear_gaussian_finite_inputs.py b/tests/models/test_linear_gaussian_finite_inputs.py index 07c87cc393..0227adce6d 100644 --- a/tests/models/test_linear_gaussian_finite_inputs.py +++ b/tests/models/test_linear_gaussian_finite_inputs.py @@ -15,27 +15,19 @@ def test_models_reject_nonfinite_system_and_measurement_matrices(self): for value in (np.nan, np.inf, -np.inf): with self.subTest(model="transition", value=value): with self.assertRaisesRegex(ValueError, "matrix.*finite"): - LinearGaussianTransitionModel( - array([[value]]), array([[1.0]]) - ) + LinearGaussianTransitionModel(array([[value]]), array([[1.0]])) with self.subTest(model="measurement", value=value): with self.assertRaisesRegex(ValueError, "matrix.*finite"): - LinearGaussianMeasurementModel( - array([[value]]), array([[1.0]]) - ) + LinearGaussianMeasurementModel(array([[value]]), array([[1.0]])) def test_models_reject_nonfinite_noise_covariances(self): for value in (np.nan, np.inf, -np.inf): with self.subTest(model="transition", value=value): with self.assertRaisesRegex(ValueError, "noise_cov.*finite"): - LinearGaussianTransitionModel( - array([[1.0]]), array([[value]]) - ) + LinearGaussianTransitionModel(array([[1.0]]), array([[value]])) with self.subTest(model="measurement", value=value): with self.assertRaisesRegex(ValueError, "noise_cov.*finite"): - LinearGaussianMeasurementModel( - array([[1.0]]), array([[value]]) - ) + LinearGaussianMeasurementModel(array([[1.0]]), array([[value]])) def test_transition_model_rejects_nonfinite_offset(self): for value in (np.nan, np.inf, -np.inf): @@ -55,12 +47,8 @@ def test_identity_models_reject_nonfinite_scalar_noise(self): IdentityGaussianMeasurementModel(1, value) def test_prediction_rejects_nonfinite_state_inputs(self): - transition = LinearGaussianTransitionModel( - array([[1.0]]), array([[1.0]]) - ) - measurement = LinearGaussianMeasurementModel( - array([[1.0]]), array([[1.0]]) - ) + transition = LinearGaussianTransitionModel(array([[1.0]]), array([[1.0]])) + measurement = LinearGaussianMeasurementModel(array([[1.0]]), array([[1.0]])) for value in (np.nan, np.inf, -np.inf): with self.subTest(method="transition mean", value=value): diff --git a/tests/smoothers/test_mem_rbpf_ffbsi_option_validation.py b/tests/smoothers/test_mem_rbpf_ffbsi_option_validation.py index 0e6ba4fcfe..33fcc8e481 100644 --- a/tests/smoothers/test_mem_rbpf_ffbsi_option_validation.py +++ b/tests/smoothers/test_mem_rbpf_ffbsi_option_validation.py @@ -6,7 +6,6 @@ from pyrecest import backend from pyrecest.smoothers import MEMRBPFFFBSiSmoother, MEMRBPFForwardRecord - pytestmark = pytest.mark.skipif( backend.__backend_name__ != "numpy", reason="MEM-RBPF FFBSi tests use NumPy sampling paths", diff --git a/tests/test_deprecation_helper.py b/tests/test_deprecation_helper.py index ef851b7ed4..7251d5a62f 100644 --- a/tests/test_deprecation_helper.py +++ b/tests/test_deprecation_helper.py @@ -25,9 +25,9 @@ def test_deprecated_decorator_supports_partial_callables(): def add(left, right): return left + right - legacy_add_one = deprecated( - since="2.3.0", remove_in="3.0.0", replacement="add" - )(functools.partial(add, 1)) + legacy_add_one = deprecated(since="2.3.0", remove_in="3.0.0", replacement="add")( + functools.partial(add, 1) + ) with warnings.catch_warnings(record=True) as caught: warnings.simplefilter("always") diff --git a/tests/test_evidence_support_masked_flags.py b/tests/test_evidence_support_masked_flags.py index 8db18cec28..0e5da4518a 100644 --- a/tests/test_evidence_support_masked_flags.py +++ b/tests/test_evidence_support_masked_flags.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.diagnostics import EvidenceSupport diff --git a/tests/test_evidence_terminal_posterior_validation.py b/tests/test_evidence_terminal_posterior_validation.py index 0f0cf09aa5..33f52d94b3 100644 --- a/tests/test_evidence_terminal_posterior_validation.py +++ b/tests/test_evidence_terminal_posterior_validation.py @@ -1,5 +1,4 @@ import pytest - from pyrecest.evidence import EvidenceComputationMode diff --git a/tests/test_gaussian_sampler_zero_samples.py b/tests/test_gaussian_sampler_zero_samples.py index 22397d2cab..bd4d6b1083 100644 --- a/tests/test_gaussian_sampler_zero_samples.py +++ b/tests/test_gaussian_sampler_zero_samples.py @@ -1,5 +1,4 @@ import numpy as np - from pyrecest.sampling.euclidean_sampler import GaussianSampler diff --git a/tests/test_group_results_by_filter.py b/tests/test_group_results_by_filter.py index 7eb8b683f3..8ae2c73b79 100644 --- a/tests/test_group_results_by_filter.py +++ b/tests/test_group_results_by_filter.py @@ -28,9 +28,7 @@ def test_nan_parameter_does_not_disrupt_numeric_order(self): grouped = group_results_by_filter(rows)["pf"] - self.assertEqual( - grouped["score"], ["none", "zero", "one", "nan", "category"] - ) + self.assertEqual(grouped["score"], ["none", "zero", "one", "nan", "category"]) self.assertTrue(math.isnan(grouped["parameter"][3])) diff --git a/tests/test_history_recorder_masked_flags.py b/tests/test_history_recorder_masked_flags.py index ac228ccab6..f265d1fe3f 100644 --- a/tests/test_history_recorder_masked_flags.py +++ b/tests/test_history_recorder_masked_flags.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.utils import HistoryRecorder diff --git a/tests/test_history_recorder_masked_values.py b/tests/test_history_recorder_masked_values.py index ddf4e75bab..1761c85390 100644 --- a/tests/test_history_recorder_masked_values.py +++ b/tests/test_history_recorder_masked_values.py @@ -1,8 +1,7 @@ import numpy as np import numpy.testing as npt -import pytest - import pyrecest.backend as backend +import pytest from pyrecest.utils import HistoryRecorder diff --git a/tests/test_hypertoroidal_sampler_masked_controls.py b/tests/test_hypertoroidal_sampler_masked_controls.py index 690c0c0f82..95f4c43cf6 100644 --- a/tests/test_hypertoroidal_sampler_masked_controls.py +++ b/tests/test_hypertoroidal_sampler_masked_controls.py @@ -1,7 +1,6 @@ import unittest import numpy as np - from pyrecest.sampling.hypertoroidal_sampler import ( CircularUniformSampler, _validate_integral_scalar, diff --git a/tests/test_leopardi_small_symmetric_partitions.py b/tests/test_leopardi_small_symmetric_partitions.py index 90aa4b35cf..5a2a8376d9 100644 --- a/tests/test_leopardi_small_symmetric_partitions.py +++ b/tests/test_leopardi_small_symmetric_partitions.py @@ -3,7 +3,6 @@ import pytest from pyrecest.sampling.leopardi_sampler import get_partition_points_cartesian - pytestmark = pytest.mark.skipif( pyrecest.backend.__backend_name__ == "jax", reason="Leopardi sampling uses SciPy root finding.", diff --git a/tests/test_metrics_temporal_counts.py b/tests/test_metrics_temporal_counts.py index 84650c8ae4..99e0842753 100644 --- a/tests/test_metrics_temporal_counts.py +++ b/tests/test_metrics_temporal_counts.py @@ -1,9 +1,7 @@ import numpy as np import pytest - from pyrecest.utils.metrics import chi_square_confidence_bounds - _TEMPORAL_COUNTS = ( np.timedelta64(2, "ns"), np.timedelta64(2, "us"), diff --git a/tests/test_model_comparison_comparable_flags.py b/tests/test_model_comparison_comparable_flags.py index bef9fa05e9..8edaa14e9d 100644 --- a/tests/test_model_comparison_comparable_flags.py +++ b/tests/test_model_comparison_comparable_flags.py @@ -1,5 +1,4 @@ import pandas as pd - from pyrecest.evaluation.model_comparison import ( evidence_margin_table, paired_model_margin_decisions, diff --git a/tests/test_pytorch_array_equal_mixed_dtypes.py b/tests/test_pytorch_array_equal_mixed_dtypes.py index 8e318e0e8b..e9f8cdc19c 100644 --- a/tests/test_pytorch_array_equal_mixed_dtypes.py +++ b/tests/test_pytorch_array_equal_mixed_dtypes.py @@ -35,9 +35,7 @@ def test_mixed_int64_float32_comparison_matches_numpy(self): pytorch_backend.array_equal(integer_tensor, float_tensor), expected ) self.assertEqual( - pytorch_backend.array_equal( - integer_tensor, float_tensor, equal_nan=True - ), + pytorch_backend.array_equal(integer_tensor, float_tensor, equal_nan=True), expected, ) diff --git a/tests/test_pytorch_split_index_contract.py b/tests/test_pytorch_split_index_contract.py index e4b94f39cb..f066514b0f 100644 --- a/tests/test_pytorch_split_index_contract.py +++ b/tests/test_pytorch_split_index_contract.py @@ -2,7 +2,6 @@ from fractions import Fraction import numpy as np - from pyrecest.backend_support._pytorch_split_index_contract import ( _normalize_split_section_count, ) diff --git a/tests/test_sigma_points_masked_parameters.py b/tests/test_sigma_points_masked_parameters.py index 2c68cc30cf..1fbb9eede6 100644 --- a/tests/test_sigma_points_masked_parameters.py +++ b/tests/test_sigma_points_masked_parameters.py @@ -1,6 +1,5 @@ import numpy as np import pytest - from pyrecest.sampling import JulierSigmaPoints, MerweScaledSigmaPoints diff --git a/tests/test_sigma_points_temporal_parameters.py b/tests/test_sigma_points_temporal_parameters.py index bcfaacd403..b7185b3815 100644 --- a/tests/test_sigma_points_temporal_parameters.py +++ b/tests/test_sigma_points_temporal_parameters.py @@ -1,9 +1,7 @@ import numpy as np import pytest - from pyrecest.sampling import JulierSigmaPoints, MerweScaledSigmaPoints - _TEMPORAL_VALUES = ( np.timedelta64(2, "ns"), np.timedelta64(2, "us"), diff --git a/tests/tracking/test_hypothesis_replay_temporal_validation.py b/tests/tracking/test_hypothesis_replay_temporal_validation.py index 5a581260e2..4dfa2c21cb 100644 --- a/tests/tracking/test_hypothesis_replay_temporal_validation.py +++ b/tests/tracking/test_hypothesis_replay_temporal_validation.py @@ -8,7 +8,6 @@ rank_hypothesis_replays, ) - _TEMPORAL_VALUES = ( np.timedelta64(2, "ns"), np.datetime64("1970-01-01T00:00:00.000000002"), @@ -45,9 +44,7 @@ def test_temporal_record_statistics_are_ignored() -> None: records=[ { "nis": np.timedelta64(4, "ns"), - "residual_norm_m": np.datetime64( - "1970-01-01T00:00:00.000000005" - ), + "residual_norm_m": np.datetime64("1970-01-01T00:00:00.000000005"), }, { "nis": np.asarray(np.timedelta64(6, "ns"), dtype=object), diff --git a/tests/utils/test_association_model_failed_refit.py b/tests/utils/test_association_model_failed_refit.py index ee8abe1ed6..24e6e53be0 100644 --- a/tests/utils/test_association_model_failed_refit.py +++ b/tests/utils/test_association_model_failed_refit.py @@ -1,6 +1,5 @@ import numpy.testing as npt import pytest - from pyrecest.backend import array, zeros from pyrecest.utils import LogisticPairwiseAssociationModel @@ -17,9 +16,7 @@ def test_failed_refit_preserves_previous_fitted_state(): converged_before = model.converged_ class_weights_before = model.class_weights_ - replacement_features = array( - [[-2.0, 0.0], [-1.0, 0.0], [1.0, 0.0], [2.0, 0.0]] - ) + replacement_features = array([[-2.0, 0.0], [-1.0, 0.0], [1.0, 0.0], [2.0, 0.0]]) with pytest.raises( ValueError, match="At least one example must receive positive weight" ): diff --git a/tests/utils/test_history_recorder_empty_steps.py b/tests/utils/test_history_recorder_empty_steps.py index 75dd94f1e8..d8073885d6 100644 --- a/tests/utils/test_history_recorder_empty_steps.py +++ b/tests/utils/test_history_recorder_empty_steps.py @@ -14,9 +14,7 @@ def test_empty_padded_record_preserves_time_axis(): recorder.record("estimate", backend.array([1.0, 2.0]), pad_with_nan=True) recorder.record("estimate", backend.array([]), pad_with_nan=True) - history = recorder.record( - "estimate", backend.array([3.0]), pad_with_nan=True - ) + history = recorder.record("estimate", backend.array([3.0]), pad_with_nan=True) npt.assert_allclose( _to_numpy(history),