def test_multi_traceback_and_forward(): np.random.seed(0) NPOSITIONS = 10 init_positions = np.random.rand(NPOSITIONS, 6) * 20 - 10 time_spans = np.random.rand(NPOSITIONS) * 30 for pos, time in zip(init_positions, time_spans): final_pos = torb.traceforward_from_now(pos, time) init_pos = torb.traceback_to_now(final_pos, time) assert np.allclose(pos, init_pos, atol=1e-3) for pos, time in zip(init_positions, time_spans): print('time: {}'.format(time)) final_pos = torb.traceback_from_now(pos, time) init_pos = torb.traceforward_to_now(final_pos, time) assert np.allclose(pos, init_pos, atol=1e-3)
def test_traceback_and_forward(): """The test that shows things are broken""" time = 10. #Myr times = np.array([0., 10.]) init_pos_chron = np.array([10.,0.,30.,0.,0.,0.]) # init_pos_chron = np.zeros(6) init_pos_chron = np.array([4000, 8000.*np.sqrt(3)/2, 0, np.sin(np.pi/3)*220., -np.cos(np.pi/3)*220., 0]) final_pos_chron = torb.trace_cartesian_orbit( init_pos_chron, times=times, single_age=False)[-1] final_pos_chron = torb.traceforward_from_now( init_pos_chron, time=time, ) assert np.allclose( init_pos_chron, torb.traceback_to_now( final_pos_chron, time, ), atol=1e-5 )
def test_traceback_and_forward(): """The test that shows things are broken""" time = 10. # Myr times = np.array([0., 10.]) init_pos_chron = np.array([10., 0., 30., 0., 0., 0.]) # init_pos_chron = np.zeros(6) init_pos_chron = np.array([4000, 8000. * np.sqrt(3) / 2, 0, np.sin(np.pi / 3) * 220., -np.cos(np.pi / 3) * 220., 0]) final_pos_chron = torb.trace_cartesian_orbit( init_pos_chron, times=times, single_age=False)[-1] final_pos_chron = torb.traceforward_from_now( init_pos_chron, time=time, ) assert np.allclose( init_pos_chron, torb.traceback_to_now( final_pos_chron, time, ), atol=1e-5 )