def test_horizons_3d(): """ Test if Horizons properly reads file with 3D coordinates. We use the satellite that has the same position as Earth. """ file_in = os.path.join(dir_2, "earth_position_1.dat") file_out = os.path.join(dir_2, "earth_position_2.dat") satellite = mm.SatelliteSkyCoord(file_in) (times, vec_x, vec_y, vec_z) = np.loadtxt(file_out, unpack=True) output = satellite.get_satellite_coords(times).cartesian np.testing.assert_almost_equal(vec_x, output.x) np.testing.assert_almost_equal(vec_y, output.y) np.testing.assert_almost_equal(vec_z, output.z)
def get_d_perp(ra_deg, dec_deg, t_0_par, ephemeris_file): """ extract D_perp for satellite for given epoch """ parameters = { 't_0': t_0_par, 'u_0': 0, 't_E': 100., 'pi_E_N': 2.**-0.5, 'pi_E_E': 2.**-0.5, 't_0_par': t_0_par } params = MM.ModelParameters(parameters) coords = MM.Coordinates(SkyCoord(ra_deg, dec_deg, unit=u.deg)) satellite = MM.SatelliteSkyCoord(ephemerides_file=ephemeris_file) ephemeris = satellite.get_satellite_coords([t_0_par]) trajectory = MM.Trajectory([t_0_par], params, coords=coords, parallax={'satellite': True}, satellite_skycoord=ephemeris) return np.sqrt(trajectory.x**2 + trajectory.y**2)[0]