Ejemplo n.º 1
0
def test_angle_ops():

    sign, idmsf = erfa.a2af(6, -np.pi)
    assert sign == b'-'
    assert idmsf.item() == (180, 0, 0, 0)

    sign, ihmsf = erfa.a2tf(6, np.pi)
    assert sign == b'+'
    assert ihmsf.item() == (12, 0, 0, 0)

    rad = erfa.af2a('-', 180, 0, 0.0)
    np.testing.assert_allclose(rad, -np.pi)

    rad = erfa.tf2a('+', 12, 0, 0.0)
    np.testing.assert_allclose(rad, np.pi)

    rad = erfa.anp(3. * np.pi)
    np.testing.assert_allclose(rad, np.pi)

    rad = erfa.anpm(3. * np.pi)
    np.testing.assert_allclose(rad, -np.pi)

    sign, ihmsf = erfa.d2tf(1, -1.5)
    assert sign == b'-'
    assert ihmsf.item() == (36, 0, 0, 0)

    days = erfa.tf2d('+', 3, 0, 0.0)
    np.testing.assert_allclose(days, 0.125)
Ejemplo n.º 2
0
def reprd(title, r, d):
    print("%25s" % title)
    for c, a in erfa.a2tf(7, r):
        print("    = %s" % c, end="")
        print("%2.2d %2.2d %2.2d.%7.7d" % tuple(a))
    for c, a in erfa.a2af(6, d):
        print("    = %s" % c, end="")
        print("%2.2d %2.2d %2.2d.%6.6d" % tuple(a))
Ejemplo n.º 3
0
RN = erfa.numat(EPSA, DPSI, DEPS)

# Combine the matrices: PN = N x P
RNPB = erfa.rxr(RN, RP)
print("NPB matrix, equinox based:")
pprint(RNPB)

# Equation of the equinoxes, including nutation correction
EE = erfa.eqeq94(DJMJD0, TT) + DDP80 * math.cos(EPSA)

# Greenwich apparent sidereal time (IAU 1982/1994).
GST = erfa.anp(erfa.gmst82(DJMJD0 + DATE, TUT) + EE)
print("GST = %.17f radians" % GST)
print("    = %.17f degrees" % math.degrees(GST))
print("    = %s%dd%dm%d.%ds" % erfa.a2af(6, GST))
print("    = %s%dh%dm%d.%ds" % erfa.a2tf(6, GST))

# Form celestial-terrestrial matrix (no polar motion yet).
##RC2TI = erfa.cr(RNPB)
##RC2TI = erfa.rz(GST, RC2TI)
RC2TI = erfa.rz(GST, RNPB)
print("celestial to terrestrial matrix (no polar motion)")
pprint(RC2TI)

# Polar motion matrix (TIRS->ITRS, IERS 1996).
RPOM = erfa.ir()
RPOM = erfa.rx(-YP, RPOM)
RPOM = erfa.ry(-XP, RPOM)

# Form celestial-terrestrial matrix (including polar motion).
RC2IT = erfa.rxr(RPOM, RC2TI)
Ejemplo n.º 4
0
def print_ln(title, a, d):
        print(title, end=': ')
        print("%s%dh:%dm:%d.%ds"%erfa.a2tf(4, a), end=', ')
        print("%s%dd:%dm:%d.%ds"%erfa.a2af(4, d))
Ejemplo n.º 5
0
RN = erfa.numat(EPSA, DPSI, DEPS)

# Combine the matrices: PN = N x P
RNPB = erfa.rxr(RN, RP)
print("NPB matrix, equinox based:")
pprint(RNPB)

# Equation of the equinoxes, including nutation correction
EE = erfa.eqeq94(DJMJD0, TT) + DDP80 * math.cos(EPSA)

# Greenwich apparent sidereal time (IAU 1982/1994).
GST = erfa.anp(erfa.gmst82(DJMJD0+DATE, TUT) + EE)
print("GST = %.17f radians"%GST)
print("    = %.17f degrees"%math.degrees(GST))
print("    = %s%dd%dm%d.%ds"%erfa.a2af(6, GST))
print("    = %s%dh%dm%d.%ds"%erfa.a2tf(6, GST))

# Form celestial-terrestrial matrix (no polar motion yet).
##RC2TI = erfa.cr(RNPB)
##RC2TI = erfa.rz(GST, RC2TI)
RC2TI = erfa.rz(GST, RNPB)
print("celestial to terrestrial matrix (no polar motion)")
pprint(RC2TI)

# Polar motion matrix (TIRS->ITRS, IERS 1996).
RPOM = erfa.ir()
RPOM = erfa.rx(-YP, RPOM)
RPOM = erfa.ry(-XP, RPOM)

# Form celestial-terrestrial matrix (including polar motion).
RC2IT = erfa.rxr(RPOM, RC2TI)
Ejemplo n.º 6
0
# Combine the matrices: PN = N x P
RNPB = erfa.rxr(RN, RP)
print("NPB matrix, equinox based:")
pprint(RNPB)

# Equation of the equinoxes, including nutation correction
EE = erfa.eqeq94(DJMJD0, TT) + DDP80 * math.cos(EPSA)

# Greenwich apparent sidereal time (IAU 1982/1994).
GST = erfa.anp(erfa.gmst82(DJMJD0+DATE, TUT) + EE)
print("GST = %.17f radians"%GST)
print("    = %.17f degrees"%math.degrees(GST))
for c,a in erfa.a2af(6, GST):
    print("    = %s"%c, end='')
    print("%dd%dm%d.%ds"%tuple(a))
for c,a in erfa.a2tf(6, GST):
    print("    = %s"%c, end='')
    print("%dh%dm%d.%ds"%tuple(a))

# Form celestial-terrestrial matrix (no polar motion yet).
##RC2TI = erfa.cr(RNPB)
##RC2TI = erfa.rz(GST, RC2TI)
RC2TI = erfa.rz(GST, RNPB)
print("celestial to terrestrial matrix (no polar motion)")
pprint(RC2TI)

# Polar motion matrix (TIRS->ITRS, IERS 1996).
RPOM = np.array([np.identity(3)]) ##erfa.ir()
RPOM = erfa.rx(np.array([-YP]), RPOM)
RPOM = erfa.ry(np.array([-XP]), RPOM)
Ejemplo n.º 7
0
def reprd(title, r, d):
    print("%25s"%title, 
          " %s%2.2d %2.2d %2.2d.%7.7d"%erfa.a2tf(7, r),
          " %s%2.2d %2.2d %2.2d.%6.6d"%erfa.a2af(6, d))
Ejemplo n.º 8
0
def reprd(title, r, d):
    print("%25s" % title, " %s%2.2d %2.2d %2.2d.%7.7d" % erfa.a2tf(7, r),
          " %s%2.2d %2.2d %2.2d.%6.6d" % erfa.a2af(6, d))