Exemplo n.º 1
0
def test_mjds_to_jds_pulsar_ok_near_leap_second():
    """
    Since we've never had a negative leap second, there are no pulsar_mjd
    times that don't correspond to any real moment. Check we got this the
    right way around.
    """
    i = 41498
    f = 86400.5 / 86401
    mjds_to_jds_pulsar(i, f)
Exemplo n.º 2
0
def test_mjds_to_jds_pulsar_array(sif):
    s, i, f = sif
    jd1, jd2 = mjds_to_jds_pulsar(i, f)
    assert np.shape(jd1) == np.shape(jd2) == s
    for jd1_i, jd2_i, i_i, f_i in np.nditer([jd1, jd2, i, f]):
        assert jd1_i, jd2_i == mjds_to_jds_pulsar(i_i, f_i)
Exemplo n.º 3
0
def test_mjd_jd_pulsar_round_trip_leap_sec_day_edge(dec, i_f):
    jds = mjds_to_jds_pulsar(*i_f)
    assert_closer_than_ns(jds_to_mjds_pulsar(*jds), i_f, 1)
Exemplo n.º 4
0
def test_mjd_jd_pulsar_round_trip(dec, i_f):
    i, f = i_f
    assume(not (i in leap_sec_days and (1 - f) * 86400 < 1e-9))
    jds = mjds_to_jds_pulsar(*i_f)
    assert_closer_than_ns(jds_to_mjds_pulsar(*jds), i_f, 1)
Exemplo n.º 5
0
def test_mjd_jd_pulsar_round_trip_leap_sec_day_edge(i_f):
    with decimal.localcontext(decimal.Context(prec=40)):
        jds = mjds_to_jds_pulsar(*i_f)
        assert_closer_than_ns(jds_to_mjds_pulsar(*jds), i_f, 1)
Exemplo n.º 6
0
def test_mjd_jd_pulsar_round_trip(i_f):
    i, f = i_f
    assume(not (i in leap_sec_days and (1 - f) * 86400 < 1e-9))
    with decimal.localcontext(decimal.Context(prec=40)):
        jds = mjds_to_jds_pulsar(*i_f)
        assert_closer_than_ns(jds_to_mjds_pulsar(*jds), i_f, 1)