<commit_before>"""Coordinate systems."""

from numpy import (arcsin, arctan2, array, cos, einsum, isscalar,
                   ndarray, pi, sin, sqrt)
from skyfield.angles import interpret_longitude, interpret_latitude, Angle, \
    HourAngle, tau
from skyfield.framelib import ICRS_to_J2000
from skyfield.nutationlib import compute_nutation
from skyfield.precessionlib import compute_precession
from skyfield.relativity import add_aberration, add_deflection

J2000 = 2451545.0
C_AUDAY = 173.1446326846693

ecliptic_obliquity = (23 + (26/60.) + (21.406/3600.)) * pi / 180.
quarter_tau = 0.25 * tau

class XYZ(object):

    def __init__(self, position, velocity=None, jd=None):
        self.jd = jd
        if getattr(jd, 'shape', ()) == ():
            self.position = position.reshape((3,))
            self.velocity = velocity.reshape((3,))
        else:
            self.position = position
            self.velocity = velocity

    def __repr__(self):
        return '<%s position x,y,z AU%s%s>' % (
            self.__class__.__name__,
            '' if (self.velocity is None) else
            ' and velocity xdot,ydot,zdot AU/day',
            '' if self.jd is None else ' at date jd',
            )

    @property
    def x(self): return self.position[0]

    @property
    def y(self): return self.position[1]

    @property
    def z(self): return self.position[2]

    @property
    def xdot(self): return self.velocity[0]

    @property
    def ydot(self): return self.velocity[1]

    @property
    def zdot(self): return self.velocity[2]

class ICRS(XYZ):

    geocentric = True

    def __sub__(self, body):
        if self.velocity is None or body.velocity is None:
            velocity = None
        else:
            velocity = body.velocity - self.velocity
        return XYZ(self.position - body.position, velocity, self.jd)

class Topos(object):

    def __init__(self, longitude, latitude, elevation=0.,
                 temperature=10.0, pressure=1010.0):
        self.longitude = interpret_longitude(longitude)
        self.latitude = interpret_latitude(latitude)
        self.elevation = elevation

    def __call__(self, jd_tt):
        from skyfield.earthlib import geocentric_position_and_velocity
        if not hasattr(jd_tt, 'shape'):<commit_msg>Re-instate the .observe() method<commit_after>"""Coordinate systems."""

from numpy import (arcsin, arctan2, array, cos, einsum, isscalar,
                   ndarray, pi, sin, sqrt)
from skyfield.angles import interpret_longitude, interpret_latitude, Angle, \
    HourAngle, tau
from skyfield.framelib import ICRS_to_J2000
from skyfield.nutationlib import compute_nutation
from skyfield.precessionlib import compute_precession
from skyfield.relativity import add_aberration, add_deflection

J2000 = 2451545.0
C_AUDAY = 173.1446326846693

ecliptic_obliquity = (23 + (26/60.) + (21.406/3600.)) * pi / 180.
quarter_tau = 0.25 * tau

class XYZ(object):

    def __init__(self, position, velocity=None, jd=None):
        self.jd = jd
        if getattr(jd, 'shape', ()) == ():
            self.position = position.reshape((3,))
            self.velocity = velocity.reshape((3,))
        else:
            self.position = position
            self.velocity = velocity

    def __repr__(self):
        return '<%s position x,y,z AU%s%s>' % (
            self.__class__.__name__,
            '' if (self.velocity is None) else
            ' and velocity xdot,ydot,zdot AU/day',
            '' if self.jd is None else ' at date jd',
            )

    @property
    def x(self): return self.position[0]

    @property
    def y(self): return self.position[1]

    @property
    def z(self): return self.position[2]

    @property
    def xdot(self): return self.velocity[0]

    @property
    def ydot(self): return self.velocity[1]

    @property
    def zdot(self): return self.velocity[2]

class ICRS(XYZ):

    geocentric = True

    def __sub__(self, body):
        if self.velocity is None or body.velocity is None:
            velocity = None
        else:
            velocity = body.velocity - self.velocity
        return XYZ(self.position - body.position, velocity, self.jd)

    def observe(self, body):
        return body.observe_from(self)

class Topos(object):

    def __init__(self, longitude, latitude, elevation=0.,
                 temperature=10.0, pressure=1010.0):
        self.longitude = interpret_longitude(longitude)
        self.latitude = interpret_latitude(latitude)
        self.elevation = elevation

    def __call__(self, jd_tt):
        from skyfield.earthlib import geocentric_position_and_velocity
        if not hasattr(jd_tt, 'shape'):
{'fraction_non_alphanumeric': 0.1070198105081826, 'fraction_numerical': 0.0305770887166236, 'mean_word_length': 2.660362490149724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1424973', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1436, 'n_words': 369}