def setup(self): self.start = datetime(2011, 11, 1, 0, 0, 0) self.end = datetime(2011, 11, 3, 0, 0, 0) self.tels = { '1m0a.doma.bpl': dict(name='1m0a.doma.bpl', tel_class='1m0', latitude=34.433157, longitude=-119.86308, horizon=25, ha_limit_neg=-12.0, ha_limit_pos=12.0, zenith_blind_spot=0.0) } self.target = ICRSTarget( # ra = '20 41 25.91', # dec = '+45 16 49.22', ra=310.35795833333333, dec=45.280338888888885) self.prop_mot_target = ICRSTarget( # ra = '20 41 25.91', # dec = '+45 16 49.22', ra=316.73026646, dec=38.74205644, proper_motion_ra=4106.90, proper_motion_dec=3144.68) self.instrument_config = dict(exposure_count=1, bin_x=2, bin_y=2, exposure_time=30, optical_elements={'filter': 'B'}) self.guiding_config = dict(mode='ON', optional=True, optical_elements={}, exposure_time=10) self.acquisition_config = dict(mode='OFF') self.constraints = {'max_airmass': None, 'min_lunar_distance': 0} self.configuration = Configuration( dict(id=5, target=self.target, instrument_type='1M0-SCICAM-SINISTRO', type='expose', instrument_configs=[self.instrument_config], guiding_config=self.guiding_config, acquisition_config=self.acquisition_config, constraints=self.constraints))
def setup(self): self.target = ICRSTarget( name='deneb', # ra = '20 41 25.91', # dec = '+45 16 49.22', ra=310.35795833333333, dec=45.280338888888885, epoch=2000, ) self.telescope = dict( name='maui', latitude=20.7069444444, longitude=-156.258055556, ) self.proposal = Proposal( proposal_name='LCOSchedulerTest', user='******', tag='admin', time_remaining=10, # In hours priority=1) self.instrument_config = dict( exposure_count=1, bin_x=2, bin_y=2, exposure_time=20, extra_params={}, optical_elements={'filter': 'BSSL-UX-020'}) self.guiding_config = dict(mode='ON', optional=True, optical_elements={}, extra_params={}, exposure_time=10) self.acquisition_config = dict(mode='OFF', extra_params={}) self.constraints = {'max_airmass': None, 'min_lunar_distance': 0} self.configuration = Configuration( dict(id=5, target=self.target, type='expose', instrument_type='1M0-SCICAM-SBIG', priority=1, instrument_configs=[self.instrument_config], acquisition_config=self.acquisition_config, guiding_config=self.guiding_config, extra_params={}, constraints=self.constraints)) self.semester_start = datetime(2011, 11, 1, 0, 0, 0) self.semester_end = datetime(2011, 11, 8, 0, 0, 0) self.windows = [(self.semester_start, self.semester_end)] self.duration = 60 self.id = 1
def test_build_rr_observation(self): reservation = Reservation(priority=None, duration=10, possible_windows_dict={}) reservation.scheduled_start = 0 reservation.scheduled_resource = '1m0a.doma.bpl' proposal = Proposal({ 'id': 'testPro', 'tag': 'tagPro', 'tac_priority': 39, 'pi': 'me' }) target = ICRSTarget({'name': 'test', 'ra': 23.3, 'dec': 22.2}) request_group = RequestGroup(operator='single', requests=None, proposal=proposal, expires=None, rg_id=333333, is_staff=False, name=None, ipp_value=1.0, observation_type="RAPID_RESPONSE", submitter='') configuration = Mock() configuration.guiding_config = {'mode': 'ON', 'optional': True} configuration.type = 'EXPOSE' configuration.instrument_type = '1M0-FAKE-SCICAM' configuration.constraints = {} configuration.id = 13 configuration.target = target request = Request( configurations=[configuration], windows=None, request_id=22223, ) reservation.request = request reservation.request_group = request_group configdb_interface = Mock() configdb_interface.get_specific_instrument.return_value = 'xx03' configdb_interface.get_autoguider_for_instrument.return_value = 'xx04' received = build_observation(reservation, self.start, configdb_interface) assert_equal(received['request'], 22223) assert_equal(received['site'], 'bpl') assert_equal(received['enclosure'], 'doma') assert_equal(received['telescope'], '1m0a') assert_equal(received['configuration_statuses'][0]['configuration'], 13) assert_equal(received['configuration_statuses'][0]['instrument_name'], 'xx03') assert_equal( received['configuration_statuses'][0]['guide_camera_name'], 'xx04')
def setup(self): # Metadata missing proposal and tag parameters self.proposal = Proposal(pi='Eric Saunders') self.configdb_interface = ConfigDBInterface( configdb_url='', telescope_classes=[], telescopes_file='test/telescopes.json', active_instruments_file='test/active_instruments.json') self.valid_proposal = Proposal( pi='Eric Saunders', id='Scheduler Testing', tag='admin', tac_priority=2, ) self.valid_target = ICRSTarget( name='deneb', type='ICRS', # ra = '20 41 25.91', # dec = '+45 16 49.22', ra=310.35795833333333, dec=45.280338888888885, rot_mode='SKY', rot_angle=0.0, acquire_mode='OPTIONAL', ) self.valid_expose_mol = dict( type='expose', exposure_count=1, bin_x=2, bin_y=2, instrument_name='1m0-SciCam-SINISTRO', filter='B', exposure_time=30, priority=1, ag_mode='Optional', defocus=0.0, )
def test_visibility_intervals_at_low_horizon_are_allowed_by_hour_angle( self): window_dict = { 'start': datetime(2013, 3, 22, 0, 0, 0), 'end': datetime(2013, 3, 23, 0, 0, 0), } tel_name = '1m0a.doma.coj' tel = dict(name=tel_name, tel_class='1m0', latitude=-31.273, longitude=149.070593, horizon=15, ha_limit_neg=-4.6, ha_limit_pos=4.6, zenith_blind_spot=0.0) tels = { tel_name: tel, } target = ICRSTarget( # RA 15:41:25.91 ra=235.357958333, dec=-60.0, ) window = Window(window_dict, tel['name']) dt_windows = Windows() dt_windows.append(window) configuration = copy.deepcopy(self.configuration) configuration.target = target req = Request( configurations=[configuration], windows=dt_windows, request_id='1', duration=10, ) sem_start = datetime(2013, 3, 1, 0, 0, 0) sem_end = datetime(2013, 3, 31, 0, 0, 0) visibilities = construct_visibilities(tels, sem_start, sem_end) intervals_for_resource = self.make_rise_set_intervals( req, visibilities) compute_request_availability(req, intervals_for_resource, {}) received = req_windows_to_kernel_intervals( req.windows.windows_for_resource) # Hour angle not violated independently confirmed by hand-cranking through SLALIB expected_tps = [ { 'type': 'start', 'time': datetime(2013, 3, 22, 13, 9, 28, 988253) }, { 'type': 'end', 'time': datetime(2013, 3, 22, 19, 16, 27, 292072) }, ] for received_tp, expected_tp in zip(received[tel_name].toDictList(), expected_tps): assert_equal(received_tp['type'], expected_tp['type']) assert_equal(received_tp['time'], expected_tp['time'])
def setup(self): self.target = ICRSTarget( name='deneb', ra=310.35795833333333, dec=45.280338888888885, epoch=2000, ) self.telescope = dict(name='1m0a.doma.ogg', latitude=20.7069444444, longitude=-156.258055556, tel_class='1m0', horizon=15, status='online', ha_limit_neg=-4.6, ha_limit_pos=4.6, zenith_blind_spot=0.0) self.telescopes = {'1m0a.doma.ogg': self.telescope} self.proposal = Proposal(id='LCOSchedulerTest', pi='Eric Saunders', tag='admin', tac_priority=1) self.instrument_config = dict(exposure_count=1, bin_x=2, bin_y=2, exposure_time=60 * 25, optical_elements={'filter': 'b'}) self.guiding_config = dict(mode='ON', optional=True, optical_elements={}, exposure_time=10) self.acquisition_config = dict(mode='OFF') self.constraints = {'max_airmass': None, 'min_lunar_distance': 0} self.configuration = Configuration( **dict(id=5, target=self.target, type='expose', instrument_type='1M0-SCICAM-SBIG', priority=1, instrument_configs=[self.instrument_config], acquisition_config=self.acquisition_config, guiding_config=self.guiding_config, constraints=self.constraints)) self.base_time = datetime(2016, 9, 14, 6, 0) resource_1 = '1m0a.doma.ogg' self.window_1 = Window( { 'start': self.base_time, 'end': self.base_time + timedelta(hours=0, minutes=30) }, resource_1) self.windows_1 = Windows() self.windows_1.append(self.window_1) resource_2 = '1m0a.doma.ogg' self.window_2 = Window( { 'start': self.base_time + timedelta(hours=0, minutes=30), 'end': self.base_time + timedelta(hours=1, minutes=0) }, resource_2) self.windows_2 = Windows() self.windows_2.append(self.window_2) self.resource_3 = '1m0a.doma.ogg' self.window_3 = Window( { 'start': self.base_time + timedelta(hours=1, minutes=0), 'end': self.base_time + timedelta(hours=1, minutes=30) }, self.resource_3) self.windows_3 = Windows() self.windows_3.append(self.window_3) self.request_1 = Request(configurations=[self.configuration], windows=self.windows_1, request_id=1, duration=1750) self.request_2 = Request(configurations=[self.configuration], windows=self.windows_2, request_id=2, duration=1750) self.request_3 = Request(configurations=[self.configuration], windows=self.windows_2, request_id=3, duration=1750) self.request_4 = Request(configurations=[self.configuration], windows=self.windows_3, request_id=4, duration=1750) self.request_5 = Request(configurations=[self.configuration], windows=self.windows_3, request_id=5, duration=1750) self.and_request_group_1 = RequestGroup( operator='and', requests=[self.request_1, self.request_2], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=1, is_staff=False, observation_type='NORMAL', ipp_value=1.0, name='ur 1', submitter='') self.and_request_group_2 = RequestGroup( operator='and', requests=[self.request_3, self.request_4], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=2, is_staff=False, observation_type='NORMAL', ipp_value=1.0, name='ur 2', submitter='') self.many_request_group_1 = RequestGroup( operator='many', requests=[self.request_1, self.request_2], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=3, is_staff=False, observation_type='NORMAL', ipp_value=1.5, name='ur 3', submitter='') self.many_request_group_2 = RequestGroup( operator='many', requests=[self.request_3, self.request_4], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=4, is_staff=False, observation_type='NORMAL', ipp_value=1.5, name='ur 4', submitter='') self.rr_request_group_1 = RequestGroup( operator='many', requests=[self.request_5], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=5, is_staff=False, observation_type='RAPID_RESPONSE', ipp_value=1.5, name='ur 5', submitter='') self.rr_request_group_2 = RequestGroup( operator='many', requests=[self.request_1, self.request_3], proposal=self.proposal, expires=datetime(2050, 1, 1), rg_id=6, is_staff=False, observation_type='RAPID_RESPONSE', ipp_value=1.5, name='ur 6', submitter='')