File tree Expand file tree Collapse file tree
tests/integration/simulation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def _cubic_eval_vec(
8181 float or np.ndarray
8282 The evaluated cubic polynomial value(s).
8383 """
84- return a + t * ( b + t * (c + t * d ) )
84+ return a + b * t + c * (t ** 2 ) + d * ( t ** 3 )
8585
8686
8787class Linear1DPolation (PolationBase ):
Original file line number Diff line number Diff line change 22
33import matplotlib as plt
44import numpy as np
5+ import numpy .testing as npt
56import pytest
67
78from rocketpy import Flight , HemisphericalParachute
@@ -447,7 +448,8 @@ def test_freestream_speed_at_apogee(example_plain_env, calisto):
447448 """
448449 # NOTE: this rocket doesn't move in x or z direction. There's no wind.
449450 hard_atol = 1e-12
450- soft_atol = 1e-6
451+ soft_atol = 1e-5
452+ soft_rtol = 1e-4
451453 test_flight = Flight (
452454 environment = example_plain_env ,
453455 rocket = calisto ,
@@ -458,25 +460,36 @@ def test_freestream_speed_at_apogee(example_plain_env, calisto):
458460 atol = 13 * [hard_atol ],
459461 )
460462
461- assert np . isclose (
463+ npt . assert_allclose (
462464 test_flight .stream_velocity_x (test_flight .apogee_time ),
463- 0.46415477243050873 ,
465+ 0.4641507314747016 ,
464466 atol = hard_atol ,
467+ rtol = soft_rtol ,
465468 )
466- assert np .isclose (
467- test_flight .stream_velocity_y (test_flight .apogee_time ), 0.0 , atol = hard_atol
469+ npt .assert_allclose (
470+ test_flight .stream_velocity_y (test_flight .apogee_time ),
471+ 0.0 ,
472+ atol = hard_atol ,
473+ rtol = soft_rtol ,
468474 )
469475 # NOTE: stream_velocity_z has a higher error due to apogee detection estimation
470- assert np .isclose (
471- test_flight .stream_velocity_z (test_flight .apogee_time ), 0.0 , atol = soft_atol
476+ npt .assert_allclose (
477+ test_flight .stream_velocity_z (test_flight .apogee_time ),
478+ 0.0 ,
479+ atol = soft_atol ,
480+ rtol = soft_rtol ,
472481 )
473- assert np . isclose (
482+ npt . assert_allclose (
474483 test_flight .free_stream_speed (test_flight .apogee_time ),
475- 0.46415477243050873 ,
484+ 0.46415073147558955 ,
476485 atol = hard_atol ,
486+ rtol = soft_rtol ,
477487 )
478- assert np .isclose (
479- test_flight .apogee_freestream_speed , 0.46415477243050873 , atol = hard_atol
488+ npt .assert_allclose (
489+ test_flight .apogee_freestream_speed ,
490+ 0.46415073147558955 ,
491+ atol = hard_atol ,
492+ rtol = soft_rtol ,
480493 )
481494
482495
You can’t perform that action at this time.
0 commit comments