<commit_before>from skyfield.trigonometry import position_angle_of
from skyfield.units import Angle

def test_position_angle():
    a = Angle(degrees=0), Angle(degrees=0)
    b = Angle(degrees=1), Angle(degrees=1)
    assert str(position_angle_of(a, b)) == '315deg 00\' 15.7"'<commit_msg>Add test of Position Angle from NASA HORIZONS<commit_after>from skyfield.api import Angle, Topos, load, load_file
from skyfield.trigonometry import position_angle_of

def test_position_angle():
    a = Angle(degrees=0), Angle(degrees=0)
    b = Angle(degrees=1), Angle(degrees=1)
    assert str(position_angle_of(a, b)) == '315deg 00\' 15.7"'

def test_position_angle_against_nasa_horizons():
    ts = load.timescale(builtin=True)
    t = ts.utc(2053, 10, 9)

    eph = load_file('./skyfield/tests/data/jup310-2053-10-08.bsp')
    boston = eph['earth'] + Topos(longitude_degrees=(-71, 3, 24.8),
                                  latitude_degrees=(42, 21, 24.1))

    b = boston.at(t)
    j = b.observe(eph['jupiter'])#.apparent()
    i = b.observe(eph['io'])#.apparent()

    a = position_angle_of(j.radec(epoch='date')[1::-1],
                          i.radec(epoch='date')[1::-1])
    # TODO: eliminate the need for this reversal step
    from skyfield.api import tau
    a2 = Angle(radians=(-a.radians) % tau)
    print(abs(a2.degrees - 293.671), 0.002)
    assert abs(a2.degrees - 293.671) < 0.002
{'fraction_non_alphanumeric': 0.15035971223021583, 'fraction_numerical': 0.058992805755395686, 'mean_word_length': 3.530944625407166, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3813292', 'n_tokens_mistral': 586, 'n_tokens_neox': 525, 'n_words': 102}