def test_erfa_wrapper(): """ Runs a set of tests that mostly make sure vectorization is working as expected """ jd = np.linspace(2456855.5, 2456855.5+1.0/24.0/60.0, 60*2+1) ra = np.linspace(0.0, np.pi*2.0, 5) dec = np.linspace(-np.pi/2.0, np.pi/2.0, 4) aob, zob, hob, dob, rob, eo = erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd, 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5) assert aob.shape == (121,) aob, zob, hob, dob, rob, eo = erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd[0], 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5) assert aob.shape == () aob, zob, hob, dob, rob, eo = erfa.atco13(ra[:, None, None], dec[None, :, None], 0.0, 0.0, 0.0, 0.0, jd[None, None, :], 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5) (aob.shape) == (5, 4, 121) iy, im, id, ihmsf = erfa.d2dtf("UTC", 3, jd, 0.0) assert iy.shape == (121,) assert ihmsf.shape == (121,) assert ihmsf.dtype == erfa.dt_hmsf iy, im, id, ihmsf = erfa.d2dtf("UTC", 3, jd[0], 0.0) assert iy.shape == () assert ihmsf.shape == () assert ihmsf.dtype == erfa.dt_hmsf
da = di reprd("geocentric apparent:", ra, da) # CIRS to topocentric. aot, zot, hot, dot, rot = erfa.atio13( ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, np.array([0.0]), np.array([0.0]), np.array([0.0]), np.array([0.0]) ) reprd("CIRS -> topocentric:", rot, dot) # CIRS to topocentric. aob, zob, hob, dob, rob = erfa.atio13(ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl) reprd("CIRS -> observed:", rob, dob) # ICRS to observed. aob, zob, hob, dob, rob, eo = erfa.atco13( rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl ) reprd("ICRS -> observed:", rob, dob) # ICRS to CIRS using some user-supplied parameters. # SOFA heliocentric Earth ephemeris. pvh, pvb = erfa.epv00(tt1, tt2) # JPL DE405 barycentric Earth ephemeris. pvb = np.array( [ ( (-0.9741704366519668, -0.2115201000882231, -0.0917583114068277), (0.0036436589347388, -0.0154287318503146, -0.0066892203821059), ) ]
da = di reprd("geocentric apparent:", ra, da) # CIRS to topocentric. aot, zot, hot, dot, rot = erfa.atio13(ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, 0.0, 0.0, 0.0, 0.0) reprd("CIRS -> topocentric:", rot, dot) # CIRS to topocentric. aob, zob, hob, dob, rob = erfa.atio13(ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl) reprd("CIRS -> observed:", rob, dob) # ICRS to observed. aob, zob, hob, dob, rob, eo = erfa.atco13(rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl) reprd("ICRS -> observed:", rob, dob) # ICRS to CIRS using some user-supplied parameters. # SOFA heliocentric Earth ephemeris. pvh, pvb = erfa.epv00(tt1, tt2) # JPL DE405 barycentric Earth ephemeris. pvb = ((-0.9741704366519668, -0.2115201000882231, -0.0917583114068277), (0.0036436589347388, -0.0154287318503146, -0.0066892203821059)) # era 2000A CIP. r = erfa.pnm00a(tt1, tt2) x, y = erfa.bpn2xy(r)