def test_get_seeing_using_different_start_month(self): seeing1 = SeeingModel(TimeHandler("2020-05-24")) self.assertEqual(seeing1.offset, 12441600) seeing1.initialize(self.environment_config, Filters()) self.assertEqual(seeing1.get_seeing(75400), 0.437314003705978) self.assertEqual(seeing1.get_seeing(76700), 0.510206997394562) self.assertEqual(seeing1.get_seeing(63190400), 0.453994989395142) self.assertEqual(seeing1.get_seeing(189424900), 0.386815994977951)
def apply_overrides(self, config_files): """Apply configuration overrides. Parameters ---------- config_files : list The list of configuration file paths. """ filters = Filters() ModelHelper.load_config(filters, config_files) model = ModelHelper(filters) return model
class FiltersTest(unittest.TestCase): def setUp(self): self.filters = Filters() def test_basic_information_from_creation(self): self.assertEqual(self.filters.u_effective_wavelength, 367.0) self.assertEqual(self.filters.g_effective_wavelength, 482.5) self.assertEqual(self.filters.r_effective_wavelength, 622.2) self.assertEqual(self.filters.i_effective_wavelength, 754.5) self.assertEqual(self.filters.z_effective_wavelength, 869.1) self.assertEqual(self.filters.y_effective_wavelength, 971.0) def test_get_effective_wavelength(self): self.assertEqual(self.filters.get_effective_wavelength('g'), 482.5)
def setUp(self): self.filters = Filters()
def __init__(self, mjd_start=59580.035, readtime=2., filtername=None, f_change_time=140., nside=default_nside, sun_limit=-13., quickTest=True, alt_limit=20., seed=-1, cloud_limit=7., cloud_step=15.): """ Parameters ---------- mjd_start : float (59580.035) The Modified Julian Date to set the observatory to. readtime : float (2.) The time it takes to read out the camera (seconds). settle : float (2.) The time it takes the telescope to settle after slewing (seconds) filtername : str (None) The filter to start the observatory loaded with f_change_time : float (120.) The time it takes to change filters (seconds) nside : int (32) The healpixel nside to make sky calculations on. sun_limit : float (-12.) The altitude limit for the sun (degrees) quickTest : bool (True) Load only a small pre-computed sky array rather than a full year. seed : float Random seed to potentially pass to unscheduled downtime cloud_limit : float (7) Close dome for cloud values over this (traditionally measured in 8ths of the sky) cloud_step : float (15.) Minutes to close if clouds exceed cloud_limit """ self.mjd_start = mjd_start + 0 self.mjd = mjd_start self.f_change_time = f_change_time self.readtime = readtime self.sun_limit = np.radians(sun_limit) self.alt_limit = np.radians(alt_limit) # Load up the sky brightness model self.sky = sb.SkyModelPre(preload=False, speedLoad=quickTest) # Should realy set this by inspecting the map. self.sky_nside = 32 # Start out parked self.ra = None self.dec = None self.filtername = None # Set up all sky coordinates hpids = np.arange(hp.nside2npix(self.sky_nside)) self.ra_all_sky, self.dec_all_sky = _hpid2RaDec(self.sky_nside, hpids) self.status = None self.site = Site(name='LSST') self.obs = ephem.Observer() self.obs.lat = self.site.latitude_rad self.obs.lon = self.site.longitude_rad self.obs.elevation = self.site.height self.obs.horizon = 0. self.sun = ephem.Sun() # Generate sunset times so we can label nights by integers self.generate_sunsets() self.night = self.mjd2night(self.mjd) # Make a slewtime interpolator self.slew_interp = Slewtime_pre() # Compute downtimes self.down_nights = [] sdt = ScheduledDowntime() sdt.initialize() usdt = UnscheduledDowntime() usdt.initialize(random_seed=seed) for downtime in sdt.downtimes: self.down_nights.extend( range(downtime[0], downtime[0] + downtime[1], 1)) for downtime in usdt.downtimes: self.down_nights.extend( range(downtime[0], downtime[0] + downtime[1], 1)) self.down_nights.sort() # Instatiate a seeing model env_config = Environment() filter_config = Filters() self.seeing_model = SeeingModel_no_time() self.seeing_model.initialize(env_config, filter_config) self.cloud_model = CloudModel_no_time() self.cloud_model.initialize() self.cloud_limit = cloud_limit self.cloud_step = cloud_step / 60. / 24.
def __init__(self): """Initialize the class. """ ModelHelper.__init__(self, Filters())
def initialize(self, seeing_dbfile=""): self.seeing.initialize(self.environment_config, Filters())