def testEllab(self):
     """tpm.ellab => apply elliptic aberration."""
     # pytpm/tests/c_tests/ellab_test.c
     v6 = tpm.V6S(r=1e9, alpha=tpm.h2r(20), delta=tpm.d2r(40.0))
     v6 = v6.s2c()
     v6 = tpm.ellab(tpm.J2000, v6, -1)
     v6 = v6.c2s()
     self.assertAlmostEqual(v6.r, 1e9, 5)
     self.assertAlmostEqual(tpm.r2h(tpm.r2r(v6.alpha)), 20.000007838, 8)
     self.assertAlmostEqual(tpm.r2d(tpm.r2r(v6.delta)), 39.999987574, 8)
Exemple #2
0
 def testEllab(self):
     """tpm.ellab => apply elliptic aberration."""
     # pytpm/tests/c_tests/ellab_test.c
     v6 = tpm.V6S(r=1e9, alpha=tpm.h2r(20), delta=tpm.d2r(40.0))
     v6 = v6.s2c()
     v6 = tpm.ellab(tpm.J2000, v6, -1)
     v6 = v6.c2s()
     self.assertAlmostEqual(v6.r, 1e9,5)
     self.assertAlmostEqual(tpm.r2h(tpm.r2r(v6.alpha)), 20.000007838,8)
     self.assertAlmostEqual(tpm.r2d(tpm.r2r(v6.delta)), 39.999987574,8)
 def testH2R(self):
     """tpm.h2r() => convert hours into radians."""
     import math
     self.assertAlmostEqual(tpm.h2r(12.0), math.pi)
     self.assertAlmostEqual(tpm.h2r(24.0), 2*math.pi)
     self.assertAlmostEqual(tpm.h2r(-12.5), -(12.5/12.0)*math.pi)
Exemple #4
0
 def testH2R(self):
     """tpm.h2r() => convert hours into radians."""
     import math
     self.assertAlmostEqual(tpm.h2r(12.0), math.pi)
     self.assertAlmostEqual(tpm.h2r(24.0), 2 * math.pi)
     self.assertAlmostEqual(tpm.h2r(-12.5), -(12.5 / 12.0) * math.pi)
    def testTPM(self):
        """tpm.tpm() => coordinate conversion."""
        # M100 FK5 J2000 from SIMBAD.
        # See pytpm/tests/c_tests/test_conversion.c.
        results = [
            dict(ra_dd=-175.00, ra_mm=43.0, ra_ss=43.4850, de_dd=15.00, de_mm=49.00, de_ss=20.5700),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=42.3616, de_dd=15.00, de_mm=49.00, de_ss=20.4480),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4850, de_dd=15.00, de_mm=49.00, de_ss=20.5700),
            dict(ra_dd=178.00, ra_mm=46.00, ra_ss=57.2326, de_dd=16.00, de_mm=45.00, de_ss=34.9209),
            dict(ra_dd=-89.00, ra_mm=8.00, ra_ss=10.1024, de_dd=76.00, de_mm=53.00, de_ss=55.9283),
            dict(ra_dd=-175.00, ra_mm=5.00, ra_ss=44.0262, de_dd=16.00, de_mm=5.00, de_ss=58.0246),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4850, de_dd=15.00, de_mm=49.00, de_ss=20.5700),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4852, de_dd=15.00, de_mm=49.00, de_ss=20.5699),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4819, de_dd=15.00, de_mm=49.00, de_ss=20.5712),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=44.9349, de_dd=15.00, de_mm=49.00, de_ss=13.4744),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=44.9350, de_dd=15.00, de_mm=49.00, de_ss=13.4743),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=30.6891, de_dd=15.00, de_mm=49.00, de_ss=19.5611),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4852, de_dd=15.00, de_mm=49.00, de_ss=20.5699),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4819, de_dd=15.00, de_mm=49.00, de_ss=20.5712),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=45.2053, de_dd=15.00, de_mm=49.00, de_ss=13.4529),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=45.2054, de_dd=15.00, de_mm=49.00, de_ss=13.4528),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=30.9595, de_dd=15.00, de_mm=49.00, de_ss=19.5396),
            dict(ra_dd=-17.00, ra_mm=8.00, ra_ss=52.8721, de_dd=15.00, de_mm=49.00, de_ss=19.5396),
            dict(ra_dd=132.00, ra_mm=32.00, ra_ss=57.5676, de_dd=67.00, de_mm=45.00, de_ss=9.6836),
            dict(ra_dd=132.00, ra_mm=32.00, ra_ss=57.5676, de_dd=67.00, de_mm=45.00, de_ss=34.3714),
            dict(ra_dd=-17.00, ra_mm=9.00, ra_ss=9.5430, de_dd=15.00, de_mm=49.00, de_ss=38.3077),
            dict(ra_dd=-17.00, ra_mm=14.00, ra_ss=6.8699, de_dd=-15.00, de_mm=10.00, de_ss=13.0062),
        ]

        ra = tpm.h2r(12 + 22 / 60.0 + 54.899 / 3600.0)
        de = tpm.d2r(15 + 49 / 60.0 + 20.57 / 3600.0)
        ep = tpm.J2000
        eq = tpm.J2000
        s1 = tpm.TPM_S06
        s2 = tpm.TPM_S00
        tstate = tpm.TSTATE()
        pvec = tpm.PVEC()

        for i in range(tpm.N_TPM_STATES):
            tpm.tpm_data(tstate, tpm.TPM_INIT)
            tstate.utc = tpm.J2000
            tstate.lon = tpm.d2r(-111.598333)
            tstate.lat = tpm.d2r(31.956389)
            tstate.alt = 2093.093
            tstate.delta_ut = tpm.delta_UT(tstate.utc)
            tpm.tpm_data(tstate, tpm.TPM_ALL)

            v6 = tpm.V6S()
            v6.r = 1e9
            v6.alpha = ra
            v6.delta = de

            pvec[s1] = v6.s2c()
            s2 = i
            tpm.tpm(pvec, s1, s2, ep, eq, tstate)
            v6 = pvec[s2].c2s()

            ra1 = v6.alpha
            de1 = v6.delta

            ra_dms = tpm.DMS(r=ra1)
            de_dms = tpm.DMS(r=de1)
            ra_dms.normalize()
            de_dms.normalize()
            self.assertAlmostEqual(ra_dms.dd, results[i]["ra_dd"], 4)
            self.assertAlmostEqual(ra_dms.mm, results[i]["ra_mm"], 4)
            self.assertAlmostEqual(ra_dms.ss, results[i]["ra_ss"], 4)
            self.assertAlmostEqual(de_dms.dd, results[i]["de_dd"], 4)
            self.assertAlmostEqual(de_dms.mm, results[i]["de_mm"], 4)
            self.assertAlmostEqual(de_dms.ss, results[i]["de_ss"], 4)
Exemple #6
0
    def testTPM(self):
        """tpm.tpm() => coordinate conversion."""
        # M100 FK5 J2000 from SIMBAD.
        # See pytpm/tests/c_tests/test_conversion.c.
        results = [
            dict(ra_dd=-175.00, ra_mm=43.0, ra_ss=43.4850,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5700),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=42.3616,
                 de_dd=15.00, de_mm=49.00, de_ss=20.4480),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4850,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5700),
            dict(ra_dd=178.00, ra_mm=46.00, ra_ss=57.2326,
                 de_dd=16.00, de_mm=45.00, de_ss=34.9209),
            dict(ra_dd=-89.00, ra_mm=8.00, ra_ss=10.1024,
                 de_dd=76.00, de_mm=53.00, de_ss=55.9283),
            dict(ra_dd=-175.00, ra_mm=5.00, ra_ss=44.0262,
                 de_dd=16.00, de_mm=5.00, de_ss=58.0246 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4850,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5700 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4852,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5699 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4819,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5712 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=44.9349,
                 de_dd=15.00, de_mm=49.00, de_ss=13.4744 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=44.9350,
                 de_dd=15.00, de_mm=49.00, de_ss=13.4743 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=30.6891,
                 de_dd=15.00, de_mm=49.00, de_ss=19.5611 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4852,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5699 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=43.4819,
                 de_dd=15.00, de_mm=49.00, de_ss=20.5712 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=45.2053,
                 de_dd=15.00, de_mm=49.00, de_ss=13.4529 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=45.2054,
                 de_dd=15.00, de_mm=49.00, de_ss=13.4528 ),
            dict(ra_dd=-175.00, ra_mm=43.00, ra_ss=30.9595,
                 de_dd=15.00, de_mm=49.00, de_ss=19.5396 ),
            dict(ra_dd=-17.00, ra_mm=8.00, ra_ss=52.8721,
                 de_dd=15.00, de_mm=49.00, de_ss=19.5396 ),
            dict(ra_dd=132.00, ra_mm=32.00, ra_ss=57.5676,
                 de_dd=67.00, de_mm=45.00, de_ss=9.6836 ),
            dict(ra_dd=132.00, ra_mm=32.00, ra_ss=57.5676,
                 de_dd=67.00, de_mm=45.00, de_ss=34.3714 ),
            dict(ra_dd=-17.00, ra_mm=9.00, ra_ss=9.5430,
                 de_dd=15.00, de_mm=49.00, de_ss=38.3077 ),
            dict(ra_dd=-17.00, ra_mm=14.00, ra_ss=6.8699,
                 de_dd=-15.00, de_mm=10.00, de_ss=13.0062 )
            ]
        
        ra = tpm.h2r(12+22/60.0+54.899/3600.0)
        de = tpm.d2r(15+49/60.0+20.57/3600.0)
        ep = tpm.J2000
        eq = tpm.J2000
        s1 = tpm.TPM_S06
        s2 = tpm.TPM_S00
        tstate = tpm.TSTATE()
        pvec = tpm.PVEC()
         
        for i in range(tpm.N_TPM_STATES):
            tpm.tpm_data(tstate, tpm.TPM_INIT)
            tstate.utc = tpm.J2000
            tstate.lon = tpm.d2r(-111.598333)
            tstate.lat = tpm.d2r(31.956389)
            tstate.alt = 2093.093
            tstate.delta_ut = tpm.delta_UT(tstate.utc)
            tpm.tpm_data(tstate, tpm.TPM_ALL)
         
            v6 = tpm.V6S()
            v6.r = 1e9
            v6.alpha = ra
            v6.delta = de
            
            pvec[s1] = v6.s2c()
            s2 = i
            tpm.tpm(pvec, s1, s2, ep, eq, tstate)
            v6 = pvec[s2].c2s()
         
            ra1 = v6.alpha
            de1 = v6.delta

            ra_dms = tpm.DMS(r=ra1)
            de_dms = tpm.DMS(r=de1)
            ra_dms.normalize()
            de_dms.normalize()
            self.assertAlmostEqual(ra_dms.dd, results[i]['ra_dd'], 4)
            self.assertAlmostEqual(ra_dms.mm, results[i]['ra_mm'], 4)
            self.assertAlmostEqual(ra_dms.ss, results[i]['ra_ss'], 4)
            self.assertAlmostEqual(de_dms.dd, results[i]['de_dd'], 4)
            self.assertAlmostEqual(de_dms.mm, results[i]['de_mm'], 4)
            self.assertAlmostEqual(de_dms.ss, results[i]['de_ss'], 4)
# Take coordinates of M100 through all states.
from pytpm import tpm

ra = tpm.h2r(12+22/60.0+54.899/3600.0)
de = tpm.d2r(15+49/60.0+20.57/3600.0)
ep = tpm.J2000
eq = tpm.J2000
s1 = tpm.TPM_S06
s2 = tpm.TPM_S00
tstate = tpm.TSTATE()
pvec = tpm.PVEC()

for i in range(tpm.N_TPM_STATES):
    tpm.tpm_data(tstate, tpm.TPM_INIT)
    tstate.utc = tpm.J2000
    tstate.lon = tpm.d2r(-111.598333)
    tstate.lat = tpm.d2r(31.956389)
    tstate.alt = 2093.093
    tstate.delta_ut = tpm.delta_UT(tstate.utc)
    tpm.tpm_data(tstate, tpm.TPM_ALL)

    v6 = tpm.V6S()
    v6.r = 1e9
    v6.alpha = ra
    v6.delta = de
    

    pvec[s1] = v6.s2c()
    s2 = i
    tpm.tpm(pvec, s1, s2, ep, eq, tstate)
    v6 = pvec[s2].c2s()