当前位置: 首页>>代码示例>>Python>>正文


Python api.load函数代码示例

本文整理汇总了Python中skyfield.api.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    args = sys.argv[1:]
    if not args:
        print('usage: deprecations.py (a|b...)')
        sys.exit(2)
    arg = args[0]
    if arg == 'a':
        from skyfield.api import earth, mars, now
        earth(now()).observe(mars).radec()
    elif arg == 'b':
        from skyfield.api import earth
        earth.topos('42.3583 N', '71.0636 W')
    elif arg == 'c':
        from skyfield.api import load
        eph = load('de421.bsp')
        earth = eph['earth']
        earth(100)
    elif arg == 'd':
        from skyfield.api import JulianDate
        JulianDate(utc=(1980, 1, 1))
    elif arg == 'e':
        from skyfield.api import load
        eph = load('de421.bsp')
        earth = eph['earth']
        earth.at(utc=(1980, 1, 1))
开发者ID:SeanBE,项目名称:python-skyfield,代码行数:25,代码来源:deprecations.py

示例2: test_callisto_astrometric

def test_callisto_astrometric():
    e = api.load("jup310.bsp")
    a = e["earth"].at(utc=(2053, 10, 9)).observe(e["callisto"])
    ra, dec, distance = a.radec()
    compare(ra._degrees, 217.1839292, 0.001 * arcsecond)
    compare(dec.degrees, -13.6892791, 0.001 * arcsecond)
    compare(distance.au, 6.31079291776184, 0.1 * meter)
开发者ID:aerler,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例3: test_ecliptic_frame

def test_ecliptic_frame(ts):
    e = api.load("de421.bsp")
    jup = e["jupiter barycenter"]
    astrometric = e["sun"].at(ts.utc(1980, 1, 1, 0, 0)).observe(jup)
    hlat, hlon, d = astrometric.ecliptic_latlon()
    compare(hlat.degrees, 1.013, 0.001)
    compare(hlon.degrees, 151.3229, 0.001)
开发者ID:jochym,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例4: test_earth_deflection

def test_earth_deflection():
    # The NOVAS library includes the Earth's gravitational deflection of
    # light for both topocentric observers and observers in Earth orbit,
    # but shuts this effect off once the object is behind the Earth 20%
    # of the way from its limb towards its center.  This test determines
    # whether Skyfield puts the resulting discontinuity in the same
    # place as the NOVAS library does.
    #
    # For more details see:
    # https://github.com/skyfielders/astronomy-notebooks/blob/master/Skyfield-Notes/Fixing-earth-deflection.ipynb

    t = load.timescale(delta_t=0.0)
    t = t.tt(2016, 7, 2, arange(10.5628, 10.5639, 0.0002))
    planets = load('de405.bsp')
    earth = planets['earth']
    mars = planets['mars']
    lowell = earth + Topos(latitude_degrees=35.2029, longitude_degrees=-111.6646)
    ra, dec, distance = lowell.at(t).observe(mars).apparent().radec()
    h = ra.hours
    hprime = diff(h)
    assert hprime[0] > 1.8e-8
    assert hprime[1] > 1.8e-8
    assert hprime[2] < 1.3e-8   # moment when nadir angle crosses 0.8
    assert hprime[3] > 1.8e-8
    assert hprime[4] > 1.8e-8
开发者ID:skyfielders,项目名称:python-skyfield,代码行数:25,代码来源:test_earth_deflection.py

示例5: test_galactic_frame

def test_galactic_frame(ts):
    e = api.load("de421.bsp")
    astrometric = e["earth"].at(ts.utc(1980, 1, 1, 0, 0)).observe(e["moon"])
    glat, glon, d = astrometric.galactic_latlon()
    print(glat, glat.degrees, glon, glon.degrees)
    compare(glat.degrees, -8.047315, 0.005)  # TODO: awful! Track this down.
    compare(glon.degrees, 187.221794, 0.005)
开发者ID:jochym,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例6: test_fk4_frame

def test_fk4_frame(ts):
    e = api.load("de421.bsp")
    astrometric = e["earth"].at(ts.utc(1980, 1, 1, 0, 0)).observe(e["moon"])
    ra, dec, d = astrometric._to_spice_frame("B1950")
    print(ra._degrees, dec.degrees)
    compare(ra._degrees, 82.36186, 0.00006)  # TODO: why is this not 0.00001?
    compare(dec.degrees, 18.53432, 0.00006)
开发者ID:jochym,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例7: test_cirs_sofa

def test_cirs_sofa():
    ts = api.load.timescale()
    earth = api.load('de421.bsp')['earth']

    test_data = [
        [45.0, 46.0, 2458327],
        [200.0, -22.0, 2458327],
        [45.0, 46.0, 2459327]
    ]

    # Results output by SOFA. Calculated using the source code above.
    sofa_results = [
        [45.074343838325, 46.067831092355],
        [200.013551320030,  -22.096008994214],
        [45.077698288877,  46.082296559677]
    ]

    tol = 1e-5 / 3600.0  # 10 micro arc-seconds

    for ((ra_icrs, dec_icrs, tdb), (ra_sofa, dec_sofa)) in zip(test_data, sofa_results):
        ss = Star(ra_hours=(ra_icrs / 15.0), dec_degrees=dec_icrs)
        st = ts.tdb(jd=tdb)
        ra_cirs, dec_cirs, _ = earth.at(st).observe(ss).apparent().cirs_radec(st)

        assert np.allclose(ra_cirs._degrees, ra_sofa, rtol=0.0, atol=tol)
        assert np.allclose(dec_cirs._degrees, dec_sofa, rtol=0.0, atol=tol)
开发者ID:skyfielders,项目名称:python-skyfield,代码行数:26,代码来源:test_positions.py

示例8: test_callisto_geometry

def test_callisto_geometry(ts):
    e = api.load("jup310.bsp")
    a = e["earth"].geometry_of("callisto").at(ts.tdb(jd=2471184.5))
    compare(a.position.au, [-4.884815926454119e00, -3.705745549073268e00, -1.493487818022234e00], 0.001 * meter)
    compare(
        a.velocity.au_per_d, [9.604665478763035e-03, -1.552997751083403e-02, -6.678445860769302e-03], 0.000001 * meter
    )
开发者ID:jochym,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例9: test_galactic_frame

def test_galactic_frame():
    e = api.load('de421.bsp')
    astrometric = e['earth'].at(utc=(1980, 1, 1, 0, 0)).observe(e['moon'])
    glat, glon, d = astrometric.galactic_latlon()
    print(glat, glat.degrees, glon, glon.degrees)
    compare(glat.degrees, -8.047315, 0.005)  # TODO: awful! Track this down.
    compare(glon.degrees, 187.221794, 0.005)
开发者ID:bsipocz,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例10: test_fk4_frame

def test_fk4_frame():
    e = api.load('de421.bsp')
    astrometric = e['earth'].at(utc=(1980, 1, 1, 0, 0)).observe(e['moon'])
    ra, dec, d = astrometric.to_spice_frame('B1950')
    print(ra._degrees, dec.degrees)
    compare(ra._degrees, 82.36186, 0.00006) # TODO: why is this not 0.00001?
    compare(dec.degrees, 18.53432, 0.00006)
开发者ID:bsipocz,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例11: test_ecliptic_frame

def test_ecliptic_frame():
    e = api.load('de421.bsp')
    jup = e['jupiter barycenter']
    astrometric = e['sun'].at(utc=(1980, 1, 1, 0, 0)).observe(jup)
    hlat, hlon, d = astrometric.ecliptic_latlon()
    compare(hlat.degrees, 1.013, 0.001)
    compare(hlon.degrees, 151.3229, 0.001)
开发者ID:bsipocz,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例12: test_callisto_astrometric

def test_callisto_astrometric(ts):
    e = api.load('jup310.bsp')
    a = e['earth'].at(ts.utc(2053, 10, 8, 23, 59, 59)).observe(e['callisto'])
    ra, dec, distance = a.radec()
    compare(ra._degrees, 217.1839292, 0.001 * arcsecond)
    compare(dec.degrees, -13.6892791, 0.001 * arcsecond)
    compare(distance.au, 6.31079291776184, 0.1 * meter)
开发者ID:SeanBE,项目名称:python-skyfield,代码行数:7,代码来源:test_against_horizons.py

示例13: test_fraction_illuminated

def test_fraction_illuminated():
    ts = api.load.timescale()
    t0 = ts.utc(2018, 9, range(9, 19), 5)
    e = api.load('de421.bsp')
    i = almanac.fraction_illuminated(e, 'moon', t0[-1]).round(2)
    assert i == 0.62
    i = almanac.fraction_illuminated(e, 'moon', t0).round(2)
    assert (i == (0, 0, 0.03, 0.08, 0.15, 0.24, 0.33, 0.43, 0.52, 0.62)).all()
开发者ID:skyfielders,项目名称:python-skyfield,代码行数:8,代码来源:test_almanac.py

示例14: test_ecliptic_for_epoch_of_date

def test_ecliptic_for_epoch_of_date(ts):
    e = api.load('de421.bsp')
    mars = e['mars barycenter']
    astrometric = e['earth'].at(ts.utc(1956, 1, 14, 6, 0, 0)).observe(mars)
    apparent = astrometric.apparent()
    hlat, hlon, d = apparent.ecliptic_latlon(epoch='date')
    compare(hlat.degrees, 0.4753402, 0.00001)
    compare(hlon.degrees, 240.0965633, 0.0002)
开发者ID:skyfielders,项目名称:python-skyfield,代码行数:8,代码来源:test_against_horizons.py

示例15: test_boston_geometry

def test_boston_geometry():
    e = api.load("jup310.bsp")
    t = api.load.timescale(delta_t=67.185390 + 0.5285957).tdb(2015, 3, 2)
    boston = e["earth"].topos((42, 21, 24.1), (-71, 3, 24.8), x=0.003483, y=0.358609)
    a = boston.geometry_of("earth").at(t)
    compare(
        a.position.km, [-1.764697476371664e02, -4.717131288041386e03, -4.274926422016179e03], 0.0027
    )  # TODO: try to get this < 1 meter
开发者ID:jochym,项目名称:python-skyfield,代码行数:8,代码来源:test_against_horizons.py


注:本文中的skyfield.api.load函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。