예제 #1
0
    def radec(self, epoch=None):
        """Return this position as a tuple (RA, declination, distance).

        >>> ra, dec, distance = ICRS([1.0, 1.0, 1.0]).radec()
        >>> ra
        <Angle 03h 00m 00.00s>
        >>> dec
        <Angle +35deg 15' 51.8">
        >>> distance
        <Distance 1.73205 AU>

        """
        position_AU = self.position.AU
        if epoch is not None:
            if isinstance(epoch, JulianDate):
                pass
            elif isinstance(epoch, float):
                epoch = JulianDate(tt=epoch)
            elif epoch == 'date':
                epoch = self.jd
            else:
                raise ValueError('the epoch= must be a Julian date,'
                                 ' a floating point Terrestrial Time (TT),'
                                 ' or the string "date" for epoch-of-date')
            position_AU = einsum('ij...,j...->i...', epoch.M, position_AU)
        r_AU, dec, ra = to_polar(position_AU)
        return (Angle(radians=ra,
                      preference='hours'), Angle(radians=dec,
                                                 signed=True), Distance(r_AU))
예제 #2
0
    def altaz(self, temperature_C=None, pressure_mbar='standard'):
        """Return the position as a tuple ``(alt, az, distance)``.

        `alt` - Altitude in degrees above the horizon.
        `az` - Azimuth angle east around the horizon from due-north.
        `distance` - Distance to the object.

        """
        try:
            topos = self.observer.topos
            R = self.observer.altaz_rotation
        except AttributeError:
            raise ValueError('to compute an apparent position, you must'
                             ' observe from a specific Earth location that'
                             ' you specify using a Topos instance')

        # TODO: wobble

        position_AU = einsum('ij...,j...->i...', R, self.position.AU)
        r_AU, alt, az = to_polar(position_AU)

        if temperature_C is None:
            alt = Angle(radians=alt)
        else:
            if temperature_C == 'standard':
                temperature_C = 10.0
            if pressure_mbar == 'standard':
                pressure_mbar = 1010.0 * exp(-topos.elevation.m / 9.1e3)
            alt = refract(alt * RAD2DEG, temperature_C, pressure_mbar)
            alt = Angle(degrees=alt)

        return alt, Angle(radians=az), Distance(r_AU)
예제 #3
0
 def __init__(self, position_AU, velocity_AU_per_d=None, jd=None):
     self.jd = jd
     self.position = Distance(position_AU)
     if velocity_AU_per_d is None:
         self.velocity = None
     else:
         self.velocity = Velocity(velocity_AU_per_d)
예제 #4
0
    def __init__(self,
                 latitude=None,
                 longitude=None,
                 latitude_degrees=None,
                 longitude_degrees=None,
                 elevation_m=0.0):

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

        if longitude_degrees is not None:
            longitude = Angle(degrees=longitude_degrees)
        elif isinstance(longitude, str):
            longitude = _interpret_ltude(longitude, 'longitude', 'E', 'W')
        elif not isinstance(longitude, Angle):
            raise TypeError('please provide either longitude_degrees=<float>'
                            ' or longitude=<skyfield.units.Angle object>'
                            ' with east being positive')

        self.latitude = latitude
        self.longitude = longitude
        self.elevation = Distance(m=elevation_m)

        self.R_lat = rot_y(latitude.radians)[::-1]
예제 #5
0
    def distance(self):
        """Return the length of this vector.

        >>> v = ICRS([1.0, 1.0, 0.0])
        >>> print(v.distance())
        1.41421 AU

        """
        return Distance(length_of(self.position.AU))
예제 #6
0
 def ecliptic_latlon(self):
     """Return ecliptic latitude, longitude, and distance."""
     vector = rotation_to_ecliptic.dot(self.position.AU)
     d, lat, lon = to_polar(vector)
     return (Angle(radians=lat,
                   signed=True), Angle(radians=lon), Distance(AU=d))
예제 #7
0
 def ecliptic_position(self):
     """Return an x,y,z position relative to the ecliptic plane."""
     vector = rotation_to_ecliptic.dot(self.position.AU)
     return Distance(vector)
예제 #8
0
def festoon_ephemeris(ephemeris):
    for name, radius_km in radii_km:
        name = name.lower().split()[-1]
        getattr(ephemeris, name).radius = Distance(km=radius_km)