Example #1
0
def test_sky_position(t1, t2):
    pos1 = sun.sky_position(t1)
    ra1 = sun.apparent_rightascension(t1)
    dec1 = sun.apparent_declination(t1)
    assert_quantity_allclose(pos1, (ra1, dec1))

    pos2 = sun.sky_position(t2, equinox_of_date=False)
    ra2 = sun.apparent_rightascension(t2, equinox_of_date=False)
    dec2 = sun.apparent_declination(t2, equinox_of_date=False)
    assert_quantity_allclose(pos2, (ra2, dec2))
Example #2
0
if l_vela > 180:
    l_vela -= 360
b_vela = c_vela.galactic.b.degree

l_vela = np.radians(l_vela)
b_vela = np.radians(b_vela)
ax0.scatter(l_vela, b_vela, alpha=0.7, color='g', marker='D', zorder=7)

## SUN
rng = pd.date_range(start='2015-01-01 00:00',
                    end='2016-01-01 00:00',
                    freq='3D')
l_sun = np.zeros(len(rng))
b_sun = np.zeros(len(rng))
for ii in range(0, len(rng)):
    ra_dec = sun.sky_position(rng[ii])
    c_sun = SkyCoord(ra=ra_dec[0].value,
                     dec=ra_dec[1].value,
                     unit=(u.hourangle, u.deg),
                     frame='icrs')

    l_sun[ii] = c_sun.galactic.l.degree
    if l_sun[ii] > 180:
        l_sun[ii] -= 360
    b_sun[ii] = c_sun.galactic.b.degree

print(l_sun, b_sun)
l_sun = np.radians(l_sun)
b_sun = np.radians(b_sun)

ax0.scatter(l_sun, b_sun, color='y', marker='o', s=3, alpha=0.8, zorder=5.4)