Пример #1
0
def test_from_horizons():
    """ test from_horizons method"""

    # current epoch
    now = Time.now()
    data = Ephem.from_horizons('Ceres')
    assert_allclose(data.datetime_jd, now.jd * u.d)

    # date range - astropy.time.Time objects
    epochs = {
        'start': Time('2018-01-02', format='iso'),
        'stop': Time('2018-01-05', format='iso'),
        'step': '6h'
    }
    data = Ephem.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 13

    # date range - strings
    epochs = {'start': '2018-01-02', 'stop': '2018-01-05', 'step': '6h'}
    data = Ephem.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 13

    # astropy.time.Time object with list of Dates
    epochs = Time(['2018-01-01', '2018-01-02'])
    data = Ephem.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 2

    # query two objects
    data = Ephem.from_horizons(['Ceres', 'Pallas'])
    assert len(data.table) == 2

    # test bib service
    bib.track()
    data = Ephem.from_horizons(['Ceres', 'Pallas'])
    assert 'sbpy.data.Ephem' in bib.to_text()
Пример #2
0
def test_from_horizons():
    """ test from_horizons method"""

    # current epoch
    now = Time.now()
    data = Orbit.from_horizons('Ceres')
    assert_allclose(data.datetime_jd, now.jd*u.d)

    # date range - astropy.time.Time objects
    epochs = {'start': Time('2018-01-02', format='iso'),
              'stop': Time('2018-01-05', format='iso'),
              'step': '6h'}
    data = Orbit.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 13

    # date range - strings
    epochs = {'start': '2018-01-02',
              'stop': '2018-01-05',
              'step': '6h'}
    data = Orbit.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 13

    # discrete epochs - astropy.time.Time objects
    epochs = [Time('2018-01-02', format='iso'),
              Time('2018-01-05', format='iso')]
    data = Orbit.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 2

    # discrete epochs - Julian Dates
    epochs = [Time('2018-01-02', format='iso').jd,
              Time('2018-01-05', format='iso').jd]
    data = Orbit.from_horizons('Ceres', epochs=epochs)
    assert len(data.table) == 2

    # query two objects
    data = Orbit.from_horizons(['Ceres', 'Pallas'])
    assert len(data.table) == 2

    # test bib service
    bib.track()
    data = Orbit.from_horizons(['Ceres', 'Pallas'])
    assert 'sbpy.data.Orbit' in bib.to_text()
Пример #3
0
 def test_bib(self):
     bib.track()
     Ephem.from_horizons(['Ceres', 'Pallas'])
     assert 'sbpy.data.ephem.Ephem.from_horizons' in bib.to_text()
Пример #4
0
 def test_bib(self):
     bib.track()
     orbit = Orbit.from_horizons('Ceres')
     oo_ephem = Ephem.from_oo(orbit, scope='basic')
     assert 'sbpy.data.ephem.Ephem.from_oo' in bib.to_text()
Пример #5
0
 def test_bib(self):
     bib.track()
     data = Ephem.from_miriade(['Ceres', 'Pallas'])
     assert 'sbpy.data.ephem.Ephem.from_miriade' in bib.to_text()