예제 #1
0
def test_position_of_radec():
    epsilon = _GIGAPARSEC_AU * 1e-16

    p = api.position_of_radec(0, 0)
    assert length_of(p.position.au - [_GIGAPARSEC_AU, 0, 0]) < epsilon

    p = api.position_of_radec(6, 0)
    assert length_of(p.position.au - [0, _GIGAPARSEC_AU, 0]) < epsilon

    epsilon = 2e-16

    p = api.position_of_radec(12, 90, 2)
    assert length_of(p.position.au - [0, 0, 2]) < epsilon

    p = api.position_of_radec(12, 90, distance_au=2)
    assert length_of(p.position.au - [0, 0, 2]) < epsilon

    ts = api.load.timescale()
    epoch = ts.tt_jd(api.B1950)
    p = api.position_of_radec(0, 0, 1, epoch=epoch)
    assert length_of(p.position.au - [1, 0, 0]) > 1e-16
    ra, dec, distance = p.radec(epoch=epoch)
    assert abs(ra.hours) < 1e-12
    assert abs(dec.degrees) < 1e-12
    assert abs(distance.au - 1) < 1e-16
def test_constellations():
    lookup = load_constellation_map()

    assert lookup(position_of_radec(0, 0)) == 'Psc'
    assert lookup(position_of_radec(360, 90)) == 'UMi'

    # (4.65, 0) used to be in Orion, but, precession
    assert lookup(position_of_radec(4.65, 0)) == 'Eri'
    assert lookup(position_of_radec(4.75, 0.3)) == 'Ori'

    # Test vectorization.
    assert list(lookup(position_of_radec([4.65, 4.75],
                                         [0, 0.3]))) == ['Eri', 'Ori']
예제 #3
0
def test_constellations():
    ts = load.timescale(builtin=True)
    t = ts.utc(2000)
    lookup = load_constellation_map()

    assert lookup(position_of_radec(0, 0)) == 'Psc'
    assert lookup(position_of_radec(360, 90)) == 'UMi'

    # (4.65, 0) used to be in Orion, but, precession
    assert lookup(position_of_radec(4.65, 0)) == 'Eri'
    assert lookup(position_of_radec(4.75, 0.3)) == 'Ori'

    # Test vectorization.
    assert (lookup(position_of_radec([4.65, 4.75],
                                     [0, 0.3])) == ['Eri', 'Ori']).all()
예제 #4
0
def test_constellations():
    lookup = load_constellation_map()

    assert lookup(position_of_radec(0, 0)) == 'Psc'
    assert lookup(position_of_radec(360, 90)) == 'UMi'

    # (4.65, 0) used to be in Orion, but, precession
    assert lookup(position_of_radec(4.65, 0)) == 'Eri'
    assert lookup(position_of_radec(4.75, 0.3)) == 'Ori'

    # exploit extend() bug, issue 547
    B1875 = Time(None, julian_date_of_besselian_epoch(1875))
    assert lookup(position_of_radec(18.1747, 39., epoch=B1875)) == 'Her'
    assert lookup(position_of_radec(18.1753, 39., epoch=B1875)) == 'Lyr'

    # Test vectorization.
    assert list(
        lookup(position_of_radec([4.65, 4.75], [0, 0.3]))
    ) == ['Eri', 'Ori']
예제 #5
0
                       int(month),
                       int(date),
                       int(hour),
                       int(mins),
                       tzinfo=tz)
t1 = dt.astimezone(pytz.utc)
ts = api.load.timescale()
y, m, d, h, mns = t1.year, t1.month, t1.date, t1.hour, t1.minute
t = ts.utc(y, m, h, mns)

topos = api.Topos(latitude_degrees=lat, longitude_degrees=lon)
observer = topos.at(t)
pos = observer.from_altaz(alt_degrees=alt, az_degrees=azi)
ra, dec, distance = pos.radec()
constellation_at = load_constellation_map()
coord = position_of_radec(ra.hours, dec.degrees)
print(constellation_at(coord))
print("RA = ", ra)
print("Dec = ", dec)

t2 = (2020, 11, 14, 22, 00)
topos = api.Topos(latitude_degrees=31.77,
                  longitude_degrees=76.98)  #coordinates of iit mandi
observer = topos.at(t)
pos = observer.from_altaz(alt_degrees=90, az_degrees=0)
ra, dec, distance = pos.radec()
constellation_at = load_constellation_map()
coord = position_of_radec(ra.hours, dec.degrees)
print("Constellation right above Lucy: ", constellation_at(coord))

pos = observer.from_altaz(alt_degrees=270, az_degrees=0)
예제 #6
0
#100K times between 2022 and 2024

n_steps = 10000
jdrange = np.linspace(2459690.5,2460055.75,n_steps)


utrange = ts.ut1_jd(jdrange)
utrange._nutation_angles = iau2000b(utrange.tt)

#Crab Nebula
target_ra = 83.63308333
target_dec = 22.0145

#My RA is in degrees, hence the division by 15. 
target_pos = position_of_radec(target_ra / 15., target_dec)


#Currently not optimized for speed
bool_list = []
t_list = []
for this_ut in tqdm.tqdm(utrange):
    this_bool = this_sat.is_target_occulted(this_ut, target_pos, earth)
    dist_intersect = this_sat.intersect_line_with_sphere(this_ut, target_pos, earth)
    t_list.append(dist_intersect)
    bool_list.append(this_bool)

bool_mask = np.array(bool_list)
t_arr = np.array(t_list)

t_bool1 = np.isfinite(t_arr)
예제 #7
0
"""Compute the tilt of Saturn, for planetary_magnitude()."""

from skyfield.api import position_of_radec

# pc = PlanetaryConstants()
# pc.read_text(load('pck00008.tpc'))

# TODO: Figure out how to extract this from "pck00008.tpc".  For now,
# these values are copied and pasted.

BODY699_POLE_RA = 40.589
BODY699_POLE_DEC = 83.537

p = position_of_radec(BODY699_POLE_RA / 15.0, BODY699_POLE_DEC, 1.0).xyz.au
print('Saturn:', p)

BODY799_POLE_RA = 257.311
BODY799_POLE_DEC = -15.175

p = position_of_radec(BODY799_POLE_RA / 15.0, BODY799_POLE_DEC, 1.0).xyz.au
print('Uranus:', p)