How to use the skyfield.units.Angle function in skyfield

To help you get started, we’ve selected a few skyfield examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skyfielders / python-skyfield / skyfield / elementslib.py View on Github external
def inclination(self):
        i = inclination(self._h_vec)
        return Angle(radians=i)
github skyfielders / python-skyfield / skyfield / elementslib.py View on Github external
def true_longitude(self):
        Om = self.longitude_of_ascending_node.radians
        w = self.argument_of_periapsis.radians
        v = self.true_anomaly.radians
        l = (Om + w + v)%tau
        return Angle(radians=l)
github skyfielders / python-skyfield / skyfield / data / hipparcos.py View on Github external
def parse(line):
    "DEPRECATED; see :func:`~skyfield.data.hipparcos.load_dataframe() instead."
    # See ftp://cdsarc.u-strasbg.fr/cats/I/239/ReadMe
    star = Star(
        ra=Angle(degrees=float(line[51:63])),
        dec=Angle(degrees=float(line[64:76])),
        ra_mas_per_year=float(line[87:95]),
        dec_mas_per_year=float(line[96:104]),
        parallax_mas=float(line[79:86]),
        names=[('HIP', int(line[8:14]))],
        )
    star._position_au += star._velocity_au_per_d * days
    distance, dec, ra = to_spherical(star._position_au)
    star.ra = Angle(radians=ra, preference='hours')
    star.dec = Angle(radians=dec)
    return star
github skyfielders / python-skyfield / skyfield / elementslib.py View on Github external
def eccentric_anomaly(self):
        E = eccentric_anomaly(self.true_anomaly.radians,
                              self.eccentricity,
                              self.semi_latus_rectum.km)
        return Angle(radians=E)
github skyfielders / python-skyfield / skyfield / positionlib.py View on Github external
def cirs_radec(self, epoch):
        """Get spherical CIRS coordinates at a given epoch (ra, dec, distance).

        Calculate coordinates in the Celestial Intermediate Reference System
        (CIRS), a dynamical coordinate system referenced to the Celestial
        Intermediate Origin (CIO). As this is a dynamical system it must be
        calculated at a specific epoch.
        """
        r_au, dec, ra = to_spherical(self.cirs_xyz(epoch).au)

        return (Angle(radians=ra, preference='hours'),
                Angle(radians=dec, signed=True),
                Distance(r_au))
github skyfielders / python-skyfield / skyfield / toposlib.py View on Github external
def __init__(self, latitude=None, longitude=None, latitude_degrees=None,
                 longitude_degrees=None, elevation_m=0.0, x=0.0, y=0.0):

        if latitude_degrees is not None:
            latitude = Angle(degrees=latitude_degrees)
        elif isinstance(latitude, (str, float, tuple)):
            latitude = _interpret_ltude(latitude, 'latitude', 'N', 'S')
        elif not isinstance(latitude, Angle):
            raise TypeError('please provide either latitude_degrees='
                            ' or latitude='
                            ' with north being positive')

        if longitude_degrees is not None:
            longitude = Angle(degrees=longitude_degrees)
        elif isinstance(longitude, (str, float, tuple)):
            longitude = _interpret_ltude(longitude, 'longitude', 'E', 'W')
        elif not isinstance(longitude, Angle):
            raise TypeError('please provide either longitude_degrees='
                            ' or longitude='
                            ' with east being positive')
github consensys-space / trusat-orbit / iod_db_gooding_analyze.py View on Github external
t = ts.utc(tm.year,tm.month,tm.day,tm.hour,tm.minute,tmseconds)

            #astrometric = observer_location.at(t).observe(mars)
            #alt, az, d = astrometric.apparent().altaz()

            days = t - satellite.epoch
            difference = satellite - observer_location[i]
            topocentric = difference.at(t)
            oe = osculating_elements_of(satellite.at(t))
            # print(topocentric.speed().km_per_s)
            # print(topocentric.position.km)
            
            # (dx,dy,dz) = topocentric.position.km
            # print(dx,dy,dz)

            fake_sat = Star(ra=Angle(degrees=ra_obs[i]),
               dec=Angle(degrees=decl_obs[i]))
            earth_station = earth + observer_location[i]
            astrometric = earth_station.at(t).observe(fake_sat)
            (sfalt, sfaz, _) = astrometric.apparent().altaz(temperature_C=-273.25, pressure_mbar=0)
            sfalti.append(sfalt.radians)
            sfazi.append(sfaz.radians)

            if (i == 0):
                print("Time: {}".format(observation_list[i]['obs_time'].isoformat()))
            else:
                delta = observation_list[i]['obs_time'] - observation_list[i-1]['obs_time']
                print("Time delta: {:5.1f}s from prev".format(delta.total_seconds()))
            print("{} using station {} Observing Satellite {} : {:.3f} days away from epoch".format(obs_name[i],station_number[i],satellite.model.satnum,days))
            ra_predict, dec_predict, distance = topocentric.radec() # ICRF ("J2000")
            (alt_predict, az_predict, _) = topocentric.altaz()      # ICRF ("J2000")
github skyfielders / python-skyfield / skyfield / positionlib.py View on Github external
def _to_spice_frame(self, name):
        vector = self.position.au
        vector = inertial_frames[name].dot(vector)
        d, dec, ra = to_polar(vector)
        return (Angle(radians=ra, preference='hours', signed=True),
                Angle(radians=dec),
                Distance(au=d))
github skyfielders / python-skyfield / skyfield / positionlib.py View on Github external
def cirs_radec(self, epoch):
        """Get spherical CIRS coordinates at a given epoch (ra, dec, distance).

        Calculate coordinates in the Celestial Intermediate Reference System
        (CIRS), a dynamical coordinate system referenced to the Celestial
        Intermediate Origin (CIO). As this is a dynamical system it must be
        calculated at a specific epoch.
        """
        r_au, dec, ra = to_spherical(self.cirs_xyz(epoch).au)

        return (Angle(radians=ra, preference='hours'),
                Angle(radians=dec, signed=True),
                Distance(r_au))