Example #1
0
def equinox_jd(gyear):
    """Calculate Julian day during which the March equinox, reckoned from the
    Tehran meridian, occurred for a given Gregorian year."""
    mean_jd = Sun.get_equinox_solstice(gyear, target='spring')
    deltat_jd = mean_jd - Epoch.tt2ut(gyear, 3) / (24 * 60 * 60.)
    # Apparent JD in universal time
    apparent_jd = deltat_jd + (Sun.equation_of_time(deltat_jd)[0] / (24 * 60.))
    # Correct for meridian of Tehran + 52.5 degrees
    return floor(apparent_jd.jde() + (52.5 / 360))
Example #2
0
def test_epoch_tt2ut():
    """Tests the tt2ut() method of Epoch class"""

    assert abs(round(Epoch.tt2ut(1642, 1), 1) - 62.1) < TOL, \
        "ERROR: 1st tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1680, 1), 1) - 15.3) < TOL, \
        "ERROR: 2nd tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1774, 1), 1) - 16.7) < TOL, \
        "ERROR: 3rd tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1890, 1), 1) - (-6.1)) < TOL, \
        "ERROR: 4th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1928, 2), 1) - 24.2) < TOL, \
        "ERROR: 5th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(2015, 7), 1) - 69.3) < TOL, \
        "ERROR: 6th tt2ut() test, output doesn't match"
Example #3
0
def test_epoch_tt2ut():
    """Tests the tt2ut() method of Epoch class"""

    assert abs(round(Epoch.tt2ut(1642, 1), 1) - 62.1) < TOL, \
        "ERROR: 1st tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1680, 1), 1) - 15.3) < TOL, \
        "ERROR: 2nd tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1774, 1), 1) - 16.7) < TOL, \
        "ERROR: 3rd tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1890, 1), 1) - (-6.1)) < TOL, \
        "ERROR: 4th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1928, 2), 1) - 24.2) < TOL, \
        "ERROR: 5th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(2015, 7), 1) - 69.3) < TOL, \
        "ERROR: 6th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1000, 1), 1) - 1574.2) < TOL, \
        "ERROR: 7th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(-501, 1), 1) - 17218.5) < TOL, \
        "ERROR: 8th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1801, 1), 1) - 13.4) < TOL, \
        "ERROR: 9th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1930, 1), 1) - 24.1) < TOL, \
        "ERROR: 10th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1945, 1), 1) - 26.9) < TOL, \
        "ERROR: 11th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(1970, 1), 1) - 40.2) < TOL, \
        "ERROR: 12th tt2ut() test, output doesn't match"

    assert abs(round(Epoch.tt2ut(2000, 1), 1) - 63.9) < TOL, \
        "ERROR: 13th tt2ut() test, output doesn't match"