def testProperMotion(self): """Convert.proper_motion: multiple V6C values.""" ra = tpm.d2r(269.45402305) de = tpm.d2r(4.66828815) px = 549.01 / 1000.0 # To Arc seconds rv = 0.0 # pmra * cos(de) into pmra pmra = (-797.84 / 1000.0) / math.cos(de) pmra *= 100.0 # To Arcseconds per century. pmde = (10326.93 / 1000.0) pmde *= 100.0 # To Arcseconds per century. C = tpm.CJ v6 = tpm.cat2v6(ra, de, pmra, pmde, px, rv, C) v6_out = convert.proper_motion([v6, v6], tpm.J2000, tpm.jyear2jd(1991.25)) for i in v6_out: v6 = i.c2s() hms = tpm.HMS(r=v6.alpha) dms = tpm.DMS(r=v6.delta) hms.normalize() dms.normalize() self.assertAlmostEqual(hms.hh, -7.0) self.assertAlmostEqual(hms.mm, 57.0) self.assertAlmostEqual(hms.ss, 48.4986, 3) self.assertAlmostEqual(dms.dd, 4.0) self.assertAlmostEqual(dms.mm, 41.0) self.assertAlmostEqual(dms.ss, 36.1980, 3)
def testProperMotion(self): """Convert.proper_motion: multiple V6C values.""" ra = tpm.d2r(269.45402305) de = tpm.d2r(4.66828815) px = 549.01 / 1000.0 # To Arc seconds rv = 0.0 # pmra * cos(de) into pmra pmra = (-797.84 / 1000.0) / math.cos(de) pmra *= 100.0 # To Arcseconds per century. pmde = 10326.93 / 1000.0 pmde *= 100.0 # To Arcseconds per century. C = tpm.CJ v6 = tpm.cat2v6(ra, de, pmra, pmde, px, rv, C) v6_out = convert.proper_motion([v6, v6], tpm.J2000, tpm.jyear2jd(1991.25)) for i in v6_out: v6 = i.c2s() hms = tpm.HMS(r=v6.alpha) dms = tpm.DMS(r=v6.delta) hms.normalize() dms.normalize() self.assertAlmostEqual(hms.hh, -7.0) self.assertAlmostEqual(hms.mm, 57.0) self.assertAlmostEqual(hms.ss, 48.4986, 3) self.assertAlmostEqual(dms.dd, 4.0) self.assertAlmostEqual(dms.mm, 41.0) self.assertAlmostEqual(dms.ss, 36.1980, 3)
def testpm(self): """Proper motion => apply PM to position.""" import math ra = tpm.d2r(269.45402305) de = tpm.d2r(4.66828815) px = 549.01 / 1000.0 # To Arc seconds rv = 0.0 # pmra * cos(de) into pmra pmra = (-797.84 / 1000.0) / math.cos(de) pmra *= 100.0 # To Arcseconds per century. pmde = 10326.93 / 1000.0 pmde *= 100.0 # To Arcseconds per century. C = tpm.CJ v6 = tpm.cat2v6(ra, de, pmra, pmde, px, rv, C) v6 = tpm.proper_motion(v6, tpm.J2000, tpm.jyear2jd(1991.25)) v6 = v6.c2s() hms = tpm.HMS(r=v6.alpha) dms = tpm.DMS(r=v6.delta) hms.normalize() dms.normalize() self.assertAlmostEqual(hms.hh, -7.0) self.assertAlmostEqual(hms.mm, 57.0) self.assertAlmostEqual(hms.ss, 48.4986, 3) self.assertAlmostEqual(dms.dd, 4.0) self.assertAlmostEqual(dms.mm, 41.0) self.assertAlmostEqual(dms.ss, 36.1980, 3)
def testpm(self): """Proper motion => apply PM to position.""" import math ra = tpm.d2r(269.45402305) de = tpm.d2r(4.66828815) px = 549.01 / 1000.0 # To Arc seconds rv = 0.0 # pmra * cos(de) into pmra pmra = (-797.84 / 1000.0 ) / math.cos(de) pmra *= 100.0 # To Arcseconds per century. pmde = (10326.93 / 1000.0) pmde *= 100.0 # To Arcseconds per century. C = tpm.CJ v6 = tpm.cat2v6(ra, de, pmra, pmde, px, rv, C) v6 = tpm.proper_motion(v6, tpm.J2000, tpm.jyear2jd(1991.25)) v6 = v6.c2s() hms = tpm.HMS(r=v6.alpha) dms = tpm.DMS(r=v6.delta) hms.normalize() dms.normalize() self.assertAlmostEqual(hms.hh, -7.0) self.assertAlmostEqual(hms.mm, 57.0) self.assertAlmostEqual(hms.ss, 48.4986, 3) self.assertAlmostEqual(dms.dd, 4.0) self.assertAlmostEqual(dms.mm, 41.0) self.assertAlmostEqual(dms.ss, 36.1980, 3)
def get_state(system): # The table of TPM states is here # http://phn.github.com/pytpm/conversions.html#function-convert-convertv6 # We set the epoch and equinox to get consistent results with # astrolib.coords.Position, see Position._set_tpmstate there. d = dict() d['fk5'] = dict(state=tpm.TPM_S06, epoch=tpm.J2000, equinox=tpm.J2000) d['fk4'] = dict(state=tpm.TPM_S05, epoch=tpm.B1950, equinox=tpm.B1950) d['galactic'] = dict(state=tpm.TPM_S04, epoch=tpm.J2000, equinox=tpm.byear2jd(1958)) d['ecliptic'] = dict(state=tpm.TPM_S03, epoch=tpm.J2000, equinox=tpm.jyear2jd(1984)) # d['icrs'] = TPM_S06 return d[system]
def testJyear2Jd(self): """tpm.jyear2jd() => convert Julian year into Julian date.""" self.assertAlmostEqual(tpm.jyear2jd(2000.0), tpm.J2000)