コード例 #1
0
def test_teme_loopback():
    from_coo = TEME(1 * u.AU, 2 * u.AU, 3 * u.AU, obstime='2001-01-01')
    to_frame = TEME(obstime='2001-06-30')

    explicit_coo = from_coo.transform_to(ICRS()).transform_to(to_frame)
    implicit_coo = from_coo.transform_to(to_frame)

    # Confirm that the explicit transformation changes the coordinate
    assert not allclose(
        explicit_coo.cartesian.xyz, from_coo.cartesian.xyz, rtol=1e-10)

    # Confirm that the loopback matches the explicit transformation
    assert_allclose(explicit_coo.cartesian.xyz,
                    implicit_coo.cartesian.xyz,
                    rtol=1e-10)
コード例 #2
0
def el2rv(inc, raan, ecc, argp, mean_anomaly, mean_motion, epoch):
    """
    Converts mean orbital elements to state vector
    """

    time_tle = epoch.jd - 2433281.5
    sat = Satrec()
    sat.sgp4init(
        WGS84,
        "i",
        0,
        time_tle,
        0.0,
        0.0,
        0.0,
        ecc,
        argp,
        inc,
        mean_anomaly,
        mean_motion,
        raan,
    )

    errorCode, rTEME, vTEME = sat.sgp4(epoch.jd1, epoch.jd2)
    if errorCode != 0:
        raise RuntimeError(SGP4_ERRORS[errorCode])

    pTEME = coord.CartesianRepresentation(rTEME * u.km)
    vTEME = coord.CartesianDifferential(vTEME * u.km / u.s)
    svTEME = TEME(pTEME.with_differentials(vTEME), obstime=epoch)

    svITRS = svTEME.transform_to(coord.ITRS(obstime=epoch))

    orb = Orbit.from_coords(Earth, svITRS)

    return orb.r, orb.v
コード例 #3
0
def test_teme_to_tirs_no_vel():
    """Check whether coord transform without velocity is possible."""
    rv_teme_no_vel = TEME(r_teme_true,
                          obstime=time,
                          representation_type="cartesian")
    rv_teme_no_vel.transform_to(TIRS(obstime=time))
コード例 #4
0
        0.0,
        0.0,
        ecc,
        argp,
        inc,
        m_ano,
        m_mot,
        raan,
    )
    errorCode, rTEME, vTEME = sat.sgp4(epoch.jd1, epoch.jd2)
    if errorCode != 0:
        raise RuntimeError(SGP4_ERRORS[errorCode])

    # Convert state vector from TEME (True Equator Mean Equinox) to ITRS
    pTEME = coord.CartesianRepresentation(rTEME * u.km)
    vTEME = coord.CartesianDifferential(vTEME * u.km / u.s)
    svTEME = TEME(pTEME.with_differentials(vTEME), obstime=iss.epoch)
    svITRS = svTEME.transform_to(coord.ITRS(obstime=iss.epoch))
    sv = Orbit.from_coords(Earth, svITRS)

    # Display results
    print("State vector [rv2el]")
    print(f"     r = {sv.r}")
    print(f"     v = {sv.v}")
    print()

    print("State vector differences [poliastro - rv2el]")
    print(f"    dr = {iss.r - sv.r}")
    print(f"    dv = {iss.v - sv.v}")
    print()
コード例 #5
0
ファイル: keepLooking.py プロジェクト: pdelteil/HackASat2020
	raise RuntimeError(SGP4_ERRORS[error_code])

# Convert SGP4 TEME to Astropy native TEME
teme_p = CartesianRepresentation(teme_p*u.km)
teme_v = CartesianDifferential(teme_v*u.km/u.s)
teme = TEME(teme_p.with_differentials(teme_v), obstime=t)

'''
itrs = teme.transform_to(ITRS(obstime=t))  
location = itrs.earth_location  
print(location.geodetic)
'''

# Lat/Lon/Alt of the Washington Monumnet
monumentLat = 38.889484
monumentLon = -77.035278
monumnetAlt = 169			# meters

# get the locations into similar coordinate system objects
#satellilteEarthLocation = ?.from_geocentric(xSat,ySat,zSat)
monumentEarthLocation = EarthLocation.from_geodetic(monumentLon,monumentLat,monumnetAlt)

aa = teme.transform_to(AltAz(obstime=t, location=monumentEarthLocation))
print('Altitude: ', aa.alt.degree)
print('Azimuth: ', aa.az.degree)

# Range is hyp of ground distance and sat geodetic altitude-monument altitude

# file, lat, lon, alt, heading, tilt, range, url
MakeKML('outFile.kml', monumentLat, monumentLon, monumnetAlt, aa.az.degree-180.0, 90.0-aa.alt.degree, 609374.8, url)