Skip to content

Commit

Permalink
Add benchmarks for CoordinateCovariances.to/from_matrix (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
moeyensj authored Aug 9, 2023
1 parent 6947443 commit d22f90e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions adam_core/coordinates/tests/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ..cartesian import CartesianCoordinates
from ..cometary import CometaryCoordinates
from ..covariances import CoordinateCovariances
from ..keplerian import KeplerianCoordinates
from ..origin import Origin, OriginCodes
from ..spherical import SphericalCoordinates
Expand Down Expand Up @@ -50,3 +51,22 @@ def test_benchmark_transform_cartesian_coordinates(
frame_out=frame,
origin_out=origin,
)


@pytest.mark.benchmark(group="coordinate_covariances")
def test_benchmark_CoordinateCovariances_to_matrix(benchmark):

covariances_filled = [np.random.random(36) for _ in range(500)]
covariances_missing = [None for _ in range(500)]
coordinate_covariances = CoordinateCovariances.from_kwargs(
values=covariances_filled + covariances_missing
)
benchmark(coordinate_covariances.to_matrix)


@pytest.mark.benchmark(group="coordinate_covariances")
def test_benchmark_CoordinateCovariances_from_matrix(benchmark):

covariances = np.random.random((1000, 6, 6))
covariances[500:, :, :] = np.nan
benchmark(CoordinateCovariances.from_matrix, covariances)

0 comments on commit d22f90e

Please sign in to comment.