コード例 #1
0
def test_o1():
    o = obs80.parseOpt(
        '00433         A1893 10 29.4132  06 08 59.32 +53 39 04.2                 HA053802'
    )  # noqa E501
    assert o.num == '00433'
    assert o.desig == ''
    assert o.disc == ''
    assert o.note1 == ''
    assert o.note2 == 'A'
    t = astropy.time.Time(o.jdutc, format='jd').datetime
    assert t.year == 1893
    assert t.month == 10
    assert t.day == 29
    assert numpy.isclose(
        .4132, (t.hour + (t.minute +
                          (t.second + t.microsecond / 1e6) / 60) / 60) / 24)
    h, m, s = astropy.coordinates.Angle(o.ra, unit='h').hms
    assert h == 6
    assert m == 8
    assert numpy.isclose(s, 59.32)
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == 1
    assert d == 53
    assert m == 39
    assert numpy.isclose(s, 4.2)
    assert o.mag is None
    assert o.band == ''
    assert o.cod == "802"
コード例 #2
0
def test_o2():
    """negative dec"""
    o = obs80.parseOpt(
        '00433         A1894 02 17.1174  07 36 21.35 -00 38 13.2                 HA053802'
    )  # noqa E501
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == -1
    assert d == 0
    assert m == 38
    assert numpy.isclose(s, 13.2)
コード例 #3
0
def test_o4():
    """one decimal place in sec of ra, no decimal places in sec dec"""
    o = obs80.parseOpt(
        '00433         A1898 08 14.96732 21 31 50.8  -05 57 43            11.0   AN147537'
    )  # noqa E501
    h, m, s = astropy.coordinates.Angle(o.ra, unit='h').hms
    assert h == 21
    assert m == 31
    assert numpy.isclose(s, 50.8)
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == -1
    assert d == 5
    assert m == 57
    assert numpy.isclose(s, 43)
コード例 #4
0
def test_o3():
    """decimal minutes in RA, missing seconds in dec, mag, no band"""
    o = obs80.parseOpt(
        '00433         A1898 08 13.89338 21 33.8     -05 58               10.0   AN147020'
    )  # noqa E501
    h, m, s = astropy.coordinates.Angle(o.ra, unit='h').hms
    assert h == 21
    assert numpy.isclose(m + s / 60., 33.8)
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == -1
    assert d == 5
    assert m == 58
    assert numpy.isclose(s, 0)
    assert o.mag == 10
    assert o.band == ''
コード例 #5
0
def test_o9():
    """note2, extra precision, band"""
    o = obs80.parseOpt(
        '00433         T1988 10 05.04698200 52 27.557+38 16 05.91         10.74V CMC05950'
    )  # noqa E501
    assert o.note2 == 'T'
    t = astropy.time.Time(o.jdutc, format='jd').datetime
    assert t.year == 1988
    assert t.month == 10
    assert t.day == 5
    assert numpy.isclose(
        .046982, (t.hour + (t.minute +
                            (t.second + t.microsecond / 1e6) / 60) / 60) / 24)
    h, m, s = astropy.coordinates.Angle(o.ra, unit='h').hms
    assert h == 0
    assert m == 52
    assert numpy.isclose(s, 27.557)
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == 1
    assert d == 38
    assert m == 16
    assert numpy.isclose(s, 5.91)
    assert o.mag == 10.74
    assert o.band == 'V'
コード例 #6
0
def test_o6():
    """both perm and prov, disc *, very coarse time, ra, dec, one dp in mag"""
    o = obs80.parseOpt(
        '00433J56P00C* A1956 08 07.14    19 43.6     -20 47               14.4   M1581760'
    )  # noqa E501
    assert o.num == '00433'
    assert o.desig == 'J56P00C'
    assert o.disc == '*'
    t = astropy.time.Time(o.jdutc, format='jd').datetime
    assert t.year == 1956
    assert t.month == 8
    assert t.day == 7
    assert numpy.isclose(
        .14, (t.hour + (t.minute +
                        (t.second + t.microsecond / 1e6) / 60) / 60) / 24)
    h, m, s = astropy.coordinates.Angle(o.ra, unit='h').hms
    assert h == 19
    assert numpy.isclose(m + s / 60., 43.6)
    sign, d, m, s = astropy.coordinates.Angle(o.dec, unit='deg').signed_dms
    assert sign == -1
    assert d == 20
    assert m == 47
    assert numpy.isclose(s, 0)
    assert o.mag == 14.4
コード例 #7
0
def test_o10():
    """note2"""
    o = obs80.parseOpt(
        '00433         C1993 09 29.84946 19 43 43.22 -14 20 51.0                z22620107'
    )  # noqa E501
    assert o.note2 == 'C'
コード例 #8
0
def test_o8():
    """note1"""
    o = obs80.parseOpt(
        '00433        4A1979 08 27.24896 21 15 51.51 -05 15 55.5                 M5026688'
    )  # noqa E501
    assert o.note1 == '4'
コード例 #9
0
def test_o7():
    """note2"""
    o = obs80.parseOpt(
        '00433         E1975 01 24.01889007 44 23.906+24 23 59.87                v4566244'
    )  # noqa E501
    assert o.note2 == 'E'
コード例 #10
0
def test_o5():
    """empty note2"""
    o = obs80.parseOpt(
        '00433          1898 09 20.88897 20 42 53.05 -05 59 42.4                m24429000'
    )  # noqa E501
    assert o.note2 == ''