Beispiel #1
0
def helper_pv_multiplication(f, unit1, unit2):
    check_structured_unit(unit1, dt_pv)
    check_structured_unit(unit2, dt_pv)
    result_unit = StructuredUnit((unit1[0] * unit2[0], unit1[1] * unit2[0]))
    converter = get_converter(
        unit2, StructuredUnit((unit2[0], unit1[1] * unit2[0] / unit1[0])))
    return [None, converter], result_unit
Beispiel #2
0
def helper_pvstar(f, unit1):
    from astropy.units.astrophys import AU
    from astropy.units.si import arcsec, day, km, radian, s, year

    return [get_converter(unit1, StructuredUnit(
        (AU, AU / day)))], (radian, radian, radian / year, radian / year,
                            arcsec, km / s, None)
Beispiel #3
0
def astrom_unit():
    from astropy.units.astrophys import AU
    from astropy.units.si import rad, year
    one = rel2c = dimensionless_unscaled

    return StructuredUnit((year, AU, one, AU, rel2c, one, one, rad, rad, rad,
                           rad, one, one, rel2c, rad, rad, rad),
                          erfa_ufunc.dt_eraASTROM)
Beispiel #4
0
def helper_s2pv(f, unit_theta, unit_phi, unit_r, unit_td, unit_pd, unit_rd):
    from astropy.units.si import radian
    time_unit = unit_r / unit_rd
    return [
        get_converter(unit_theta, radian),
        get_converter(unit_phi, radian), None,
        get_converter(unit_td, radian / time_unit),
        get_converter(unit_pd, radian / time_unit), None
    ], StructuredUnit((unit_r, unit_rd))
Beispiel #5
0
def helper_starpv(f, unit_ra, unit_dec, unit_pmr, unit_pmd, unit_px, unit_rv):
    from astropy.units.astrophys import AU
    from astropy.units.si import arcsec, day, km, radian, s, year

    return [
        get_converter(unit_ra, radian),
        get_converter(unit_dec, radian),
        get_converter(unit_pmr, radian / year),
        get_converter(unit_pmd, radian / year),
        get_converter(unit_px, arcsec),
        get_converter(unit_rv, km / s)
    ], (StructuredUnit((AU, AU / day)), None)
Beispiel #6
0
def helper_pvtob(f, unit_elong, unit_phi, unit_hm, unit_xp, unit_yp, unit_sp,
                 unit_theta):
    from astropy.units.si import m, radian, s

    return [
        get_converter(unit_elong, radian),
        get_converter(unit_phi, radian),
        get_converter(unit_hm, m),
        get_converter(unit_xp, radian),
        get_converter(unit_yp, radian),
        get_converter(unit_sp, radian),
        get_converter(unit_theta, radian)
    ], StructuredUnit((m, m / s))
Beispiel #7
0
def ldbody_unit():
    from astropy.units.astrophys import AU, Msun
    from astropy.units.si import day, radian

    return StructuredUnit((Msun, radian, (AU, AU / day)),
                          erfa_ufunc.dt_eraLDBODY)
Beispiel #8
0
def helper_s2xpv(f, unit1, unit2, unit_pv):
    check_structured_unit(unit_pv, dt_pv)
    return [None, None, None], StructuredUnit(
        (_d(unit1) * unit_pv[0], _d(unit2) * unit_pv[1]))
Beispiel #9
0
def helper_p2pv(f, unit1):
    from astropy.units.si import s
    if isinstance(unit1, StructuredUnit):
        raise UnitTypeError("p vector unit cannot be a structured unit.")
    return [None], StructuredUnit((unit1, unit1 / s))