Need to work out better the convergence bound on the true_anomaly computation. One test is failing with K=0.1 and ecc=0.999. (Does not converge before 10000 iterations)
Here is the travis output.
This will be a fail randomly until fixed.
____________________________ test_RV_from_params ______________________________
@settings(deadline=400) # double deadline for this test
> @given(st.floats(min_value=0.01, max_value=1e6, allow_nan=False, allow_infinity=False),
st.floats(min_value=0.1, max_value=1e5, allow_nan=False, allow_infinity=False),
st.floats(min_value=0.1, max_value=1e6, allow_nan=False, allow_infinity=False),
st.floats(min_value=0, max_value=360, allow_nan=False, allow_infinity=False),
st.floats(min_value=0, max_value=0.999, allow_nan=False, allow_infinity=False))
def test_RV_from_params(k1, period, tau, omega, ecc):
tests/test_old_code.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
...
ta = RV.true_anomaly(ma, ecc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ma = array([ 0. , 0.0315738 , 0.06314759, 0.09472139, 0.12629518,
0.15786898, 0.18944277, 0.22101657, ...059494, 6.06216874, 6.09374253, 6.12531633,
6.15689013, 6.18846392, 6.22003772, 6.25161151, 6.28318531])
ecc = 0.9989999999963652, niterationmax = 10000
@staticmethod
def true_anomaly(ma, ecc, niterationmax=10000):
# type: (Any, float, int) -> Any
...
if not isinstance(ma, (int, float)):
ea = ma
else:
ea = np.array([ma, ], dtype=np.float)
if isinstance(ea, list):
raise TypeError("Unsupported type 'list', input a numpy array or an int/float.")
if len(ea) == 0:
raise ValueError("A empty array was given.")
# Initialise at ea0 = ma
niteration = 0
ea0 = ma
while np.linalg.norm(ea - ea0, ord=1) > 1e-5 or niteration == 0:
ea0 = ea
ff = ea - ecc * np.sin(ea) - ma # Function
dff = 1 - ecc * np.cos(ea) # Derivative
# Use Newton method
ea = ea0 - ff / dff
# Increase iteration number; if above limit, break with exception.
niteration += 1
if niteration >= niterationmax:
> raise RuntimeError('Eccentric anomaly computation '
'not converged.')
E RuntimeError: Eccentric anomaly computation not converged.
/home/travis/miniconda/envs/test-env/lib/python3.6/site-packages/ObservationTools-0.1-py3.6.egg/utils/rv_utils.py:201: RuntimeError
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_RV_from_params(k1=0.01, period=12524.503774713052, tau=62500.093750000015, omega=0.0, ecc=0.9989999999963652)
You can add @seed(151146495245698969667814574467189155361) to this test or run pytest with --hypothesis-seed=151146495245698969667814574467189155361 to reproduce this failure.
=============== 1 failed, 134 passed, 3 xfailed in 67.64 seconds ===============
Need to work out better the convergence bound on the true_anomaly computation. One test is failing with K=0.1 and ecc=0.999. (Does not converge before 10000 iterations)
Here is the travis output.
This will be a fail randomly until fixed.