Esempio n. 1
0
def args2orbit(args):
    try:
        Tp = float(args.Tp)
    except ValueError:
        Tp = args.Tp

    try:
        epoch = float(args.epoch)
    except ValueError:
        epoch = args.epoch

    orbit = Orbit.from_dict({
        'M': args.M,
        'K': args.K,
        'H': 5,
        'G': 0.15,
        'q': args.q * u.au,
        'e': args.e,
        'incl': args.i * u.deg,
        'Omega': args.node * u.deg,
        'w': args.argperi * u.deg,
        'Tp_jd': epochs_to_time([Tp], scale='tt').jd * u.day
    })
    orbit['orbittype'] = ['COM']
    orbit['epoch'] = epochs_to_time([epoch], scale='tt')
    return orbit
Esempio n. 2
0
def test_from_oo():
    """test from_oo method"""

    try:
        import pyoorb
    except ImportError:
        return None

    orbit = Orbit.from_horizons('Ceres')
    horizons_ephem = Ephem.from_horizons('Ceres', location='500')
    oo_ephem = Ephem.from_oo(orbit)

    u.isclose(horizons_ephem['ra'][0], oo_ephem['ra'][0])
    u.isclose(horizons_ephem['dec'][0], oo_ephem['dec'][0])
    u.isclose(horizons_ephem['RA*cos(Dec)_rate'][0],
              oo_ephem['RA*cos(Dec)_rate'][0])
    u.isclose(horizons_ephem['dec_rate'][0], oo_ephem['dec_rate'][0])
    u.isclose(horizons_ephem['alpha'][0], oo_ephem['alpha'][0])
    u.isclose(horizons_ephem['r'][0], oo_ephem['r'][0])
    u.isclose(horizons_ephem['delta'][0], oo_ephem['delta'][0])
    u.isclose(horizons_ephem['V'][0], oo_ephem['V'][0])
    u.isclose(horizons_ephem['hlon'][0], oo_ephem['hlon'][0])
    u.isclose(horizons_ephem['hlat'][0], oo_ephem['hlat'][0])
    u.isclose(horizons_ephem['EL'][0], oo_ephem['EL'][0])

    # test manual orbit definition lacking units
    manorbit = Orbit.from_dict({
        'targetname': orbit['targetname'][0],
        'a': orbit['a'].value[0],
        'e': orbit['e'][0],
        'i': orbit['i'].value[0],
        'w': orbit['w'].value[0],
        'Omega': orbit['Omega'].value[0],
        'datetime_jd': orbit['datetime_jd'][0].value,
        'M': orbit['M'].value[0],
        'H': orbit['H'].value[0],
        'G': orbit['G'][0],
        'timescale': orbit['timescale'][0]
    })

    oo_ephem = Ephem.from_oo(manorbit)

    u.isclose(horizons_ephem['ra'][0], oo_ephem['ra'][0])
    u.isclose(horizons_ephem['dec'][0], oo_ephem['dec'][0])
    u.isclose(horizons_ephem['RA*cos(Dec)_rate'][0],
              oo_ephem['RA*cos(Dec)_rate'][0])
    u.isclose(horizons_ephem['dec_rate'][0], oo_ephem['dec_rate'][0])
    u.isclose(horizons_ephem['alpha'][0], oo_ephem['alpha'][0])
    u.isclose(horizons_ephem['r'][0], oo_ephem['r'][0])
    u.isclose(horizons_ephem['delta'][0], oo_ephem['delta'][0])
    u.isclose(horizons_ephem['V'][0], oo_ephem['V'][0])
    u.isclose(horizons_ephem['hlon'][0], oo_ephem['hlon'][0])
    u.isclose(horizons_ephem['hlat'][0], oo_ephem['hlat'][0])
    u.isclose(horizons_ephem['EL'][0], oo_ephem['EL'][0])