Beispiel #1
0
 def test_get_airmass_lowest(self):
     """The lowest airmass occurs when dec=latitude"""
     t = astropy.time.Time('2020-01-01')
     ra = np.arange(360) * u.deg
     dec = utils.get_location().lat
     Xinv = 1 / utils.get_airmass(t, ra, dec)
     self.assertTrue(np.max(Xinv) > 0.999)
     dec = dec + 30 * u.deg
     Xinv = 1 / utils.get_airmass(t, ra, dec)
     self.assertTrue(np.max(Xinv) < 0.9)
 def test_moon_altaz(self):
     """Verify moon (alt,az) for first week of 2020"""
     ephem = get_ephem()
     location = get_location()
     for i, jd in enumerate(self.table['jd']):
         t = Time(jd, format='jd')
         night = ephem.get_night(t)
         f_moon = get_object_interpolator(night, 'moon', altaz=True)
         alt, az = f_moon(t.mjd)
         truth = AltAz(alt=self.table['alt'][i] * u.deg,
                       az=self.table['az'][i] * u.deg,
                       obstime=t,
                       location=location,
                       pressure=0)
         calc = AltAz(alt=alt * u.deg,
                      az=az * u.deg,
                      obstime=t,
                      location=location,
                      pressure=0)
         sep = truth.separation(calc)
         self.assertTrue(abs(sep.to(u.deg).value) < 0.3)
Beispiel #3
0
from    astropy.table            import  Table, vstack
from    scipy                    import  ndimage
from    multiprocessing          import  Pool, Array
from    desisurvey.utils         import  get_location
from    astropy.time             import  Time
from    astropy.coordinates      import  SkyCoord, EarthLocation, AltAz
from    specsim.atmosphere       import  krisciunas_schaefer, Moon
from    get_sky                  import  get_sky
from    pkg_resources            import  resource_filename
from    desiutil.iers            import  freeze_iers


freeze_iers()

mayall            = get_location()

emayall           = ephem.Observer()
emayall.lon       = ephem.degrees(mayall.lon.value * np.pi / 180.)
emayall.lat       = ephem.degrees(mayall.lat.value * np.pi / 180.)
emayall.elevation = mayall.height.value

moon              = ephem.Moon()
sun               = ephem.Sun()

def airmass(zd):
    # Airmass at given zenith distance.                                                                                                                                                                                                 
    return  (1. - 0.96 * np.sin(zd * np.pi / 180.)**2.)**-0.5

def get_solar(mjd, ras, decs):
    t                 = Time(mjd, format='mjd', scale='utc')
Beispiel #4
0
 def test_freeze_iers(self):
     """Test freezing from package data/"""
     utils.freeze_iers()
     future = astropy.time.Time('2024-01-01', location=utils.get_location())
     lst = future.sidereal_time('apparent')
Beispiel #5
0
 def test_get_location_cache(self):
     """Test location object caching"""
     self.assertEqual(id(utils.get_location()), id(utils.get_location()))
Beispiel #6
0
 def test_get_location(self):
     """Check for sensible coordinates"""
     loc = utils.get_location()
     self.assertTrue(np.fabs(loc.lat.to(u.deg).value - 32.0) < 0.1)
     self.assertTrue(np.fabs(loc.lon.to(u.deg).value + 111.6) < 0.1)
     self.assertTrue(np.fabs(loc.height.to(u.m).value - 2120) < 0.1)