Exemple #1
0
 def test_another_specific_set_topic(self):
     ad = BasicProposal2()
     in_topic = scheduler_generalPropConfigC()
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal2")
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertEqual(out_topic.num_filters, 3)
Exemple #2
0
 def test_another_specific_set_topic(self):
     ad = BasicProposal2()
     in_topic = scheduler_generalPropConfigC()
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal2")
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertEqual(out_topic.num_filters, 3)
     self.assertEqual(out_topic.time_weight, 0.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "GalacticPlane")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertEqual(out_topic.region_minimums[0], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "GalacticPlane")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertEqual(out_topic.region_minimums[0], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "SouthCelestialPole")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "SouthCelestialPole")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
Exemple #7
0
 def test_a_time_ordered_proposal_set_topic(self):
     gen = BasicProposal4()
     in_topic = scheduler_generalPropConfigC()
     out_topic = gen.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal4")
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.num_time_ranges, 2)
     self.assertEqual(out_topic.time_range_starts[0], 1)
     self.assertEqual(out_topic.time_range_ends[0], 1825)
     self.assertEqual(out_topic.time_range_starts[1], 1826)
     self.assertEqual(out_topic.time_range_ends[1], 3650)
     self.assertEqual(out_topic.num_selection_mappings[0], 1)
     self.assertEqual(out_topic.num_selection_mappings[1], 1)
     self.assertEqual(out_topic.selection_mappings[0], 0)
     self.assertEqual(out_topic.selection_mappings[1], 1)
Exemple #8
0
 def test_a_hybrid_proposal_set_topic(self):
     ad = BasicProposal3()
     in_topic = scheduler_generalPropConfigC()
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal3")
     self.assertEqual(out_topic.num_filters, 4)
     filter_names = out_topic.filter_names.split(',')
     idx1 = filter_names.index('u')
     idx2 = filter_names.index('g')
     self.assertEqual(out_topic.num_grouped_visits[idx1], 1)
     self.assertEqual(out_topic.num_grouped_visits[idx2], 2)
     self.assertFalse(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, 30 * 60)
     self.assertEqual(out_topic.time_window_start, -0.5)
     self.assertEqual(out_topic.time_window_max, 0.5)
     self.assertEqual(out_topic.time_window_end, 1.0)
Exemple #9
0
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "WideFastDeep")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 1.5)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
     self.assertEqual(out_topic.num_grouped_visits[1], 2)
     self.assertEqual(out_topic.exposures[3], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, self.time_interval)
     self.assertEqual(out_topic.time_window_end, 2.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "NorthEclipticSpur")
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertNotEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.region_combiners, "and")
     self.assertEqual(out_topic.num_filters, 4)
     self.assertEqual(out_topic.max_seeing[1], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[1], 2)
     self.assertEqual(out_topic.num_grouped_visits[1], 2)
     self.assertEqual(out_topic.exposures[3], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, self.time_interval)
     self.assertEqual(out_topic.time_window_end, 2.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "WideFastDeep")
     self.assertEqual(out_topic.num_region_selections, 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(out_topic.max_seeing[5], 1.5)
     self.assertEqual(out_topic.num_filter_exposures[5], 2)
     self.assertEqual(out_topic.exposures[11], 15.0)
     self.assertEqual(out_topic.num_grouped_visits[1], 2)
     self.assertEqual(out_topic.exposures[3], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, self.time_interval)
     self.assertEqual(out_topic.time_window_end, 2.0)
 def test_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.prop.set_topic(in_topic)
     self.assertEqual(out_topic.name, "NorthEclipticSpur")
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.num_exclusion_selections, 0)
     self.assertNotEqual(out_topic.region_minimums[1], 0.0)
     self.assertEqual(out_topic.region_combiners, "and")
     self.assertEqual(out_topic.num_filters, 4)
     self.assertEqual(out_topic.max_seeing[1], 2.0)
     self.assertEqual(out_topic.num_filter_exposures[1], 2)
     self.assertEqual(out_topic.num_grouped_visits[1], 2)
     self.assertEqual(out_topic.exposures[3], 15.0)
     self.assertEqual(out_topic.max_cloud, 0.7)
     self.assertEqual(out_topic.airmass_bonus, 0.5)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, self.time_interval)
     self.assertEqual(out_topic.time_window_end, 2.0)
Exemple #13
0
 def test_a_hybrid_proposal_set_topic(self):
     ad = BasicProposal3()
     in_topic = scheduler_generalPropConfigC()
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal3")
     self.assertEqual(out_topic.num_filters, 4)
     filter_names = out_topic.filter_names.split(',')
     idx1 = filter_names.index('u')
     idx2 = filter_names.index('g')
     self.assertEqual(out_topic.num_grouped_visits[idx1], 1)
     self.assertEqual(out_topic.num_grouped_visits[idx2], 2)
     self.assertEqual(out_topic.hour_angle_bonus, 0.5)
     self.assertEqual(out_topic.hour_angle_max, 9.0)
     self.assertFalse(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, 30 * 60)
     self.assertEqual(out_topic.time_window_start, -0.5)
     self.assertEqual(out_topic.time_window_max, 0.5)
     self.assertEqual(out_topic.time_window_end, 1.0)
     self.assertEqual(out_topic.time_weight, 1.0)
Exemple #14
0
    def configure_scheduler(self, **kwargs):

        # FIXME:
        # This is extremely ugly I know, but the idea is that the user subclass this method to run
        # their own configuration and return a survey topology.
        from lsst.ts.scheduler.sal_utils import SALUtils
        from SALPY_scheduler import scheduler_generalPropConfigC
        from SALPY_scheduler import scheduler_sequencePropConfigC

        config = kwargs['config']
        self.propid_counter = 0
        survey_topology = SurveyTopology()

        general_topic = scheduler_generalPropConfigC()
        if config.science.general_props.active is not None:
            for general_config in config.science.general_props.active:
                set_topic = general_config.set_topic(general_topic)
                conf_dict = SALUtils.rtopic_area_prop_config(set_topic)
                self.log.debug(
                    'configure_scheduler [%s-%i]: %s' %
                    (general_config.name, self.propid_counter, conf_dict))
                self.create_area_proposal(self.propid_counter + 1,
                                          general_config.name, conf_dict)
                survey_topology.num_general_props += 1
                survey_topology.general_propos.append(general_config.name)

        seq_topic = scheduler_sequencePropConfigC()
        if config.science.sequence_props.active is not None:
            for sequence_props in config.science.sequence_props.active:
                set_topic = sequence_props.set_topic(seq_topic)
                conf_dict = SALUtils.rtopic_seq_prop_config(set_topic)
                self.log.debug(
                    'configure_scheduler [%s-%i] : %s' %
                    (sequence_props.name, self.propid_counter, conf_dict))
                self.create_sequence_proposal(self.propid_counter + 1,
                                              sequence_props.name, conf_dict)
                survey_topology.num_seq_props += 1
                survey_topology.sequence_propos.append(sequence_props.name)
        return survey_topology
Exemple #15
0
    def __init__(self, timeout):

        super(SALUtils, self).__init__()

        self.log = logging.getLogger("SALUtils")

        self.setDebugLevel(0)

        self.sal_sleeper = 0.1
        self.main_loop_timeouts = timeout

        self.topic_summaryState = scheduler_logevent_summaryStateC()
        self.topicTarget = scheduler_logevent_targetC()
        self.topicFilterSwap = scheduler_logevent_needFilterSwapC()
        self.topicValidSettings = scheduler_logevent_validSettingsC()

        self.topic_schedulerConfig = scheduler_schedulerConfigC()
        self.topic_driverConfig = scheduler_driverConfigC()
        self.topic_obsSiteConfig = scheduler_obsSiteConfigC()
        self.topic_telescopeConfig = scheduler_telescopeConfigC()
        self.topic_domeConfig = scheduler_domeConfigC()
        self.topic_rotatorConfig = scheduler_rotatorConfigC()
        self.topic_cameraConfig = scheduler_cameraConfigC()
        self.topic_slewConfig = scheduler_slewConfigC()
        self.topic_opticsConfig = scheduler_opticsLoopCorrConfigC()
        self.topic_parkConfig = scheduler_parkConfigC()
        self.topic_areaDistPropConfig = scheduler_generalPropConfigC()
        self.topic_sequencePropConfig = scheduler_sequencePropConfigC()
        self.topicTime = scheduler_timeHandlerC()
        self.topicObservatoryState = scheduler_observatoryStateC()
        self.topic_cloud = scheduler_bulkCloudC()
        self.topic_seeing = scheduler_seeingC()
        self.topicObservation = scheduler_observationC()
        self.tInterestedProposal = scheduler_interestedProposalC()
        self.topic_schedulerTopology = scheduler_surveyTopologyC()

        self.topic_command_enterControl = scheduler_command_enterControlC()
        self.topic_command_enable = scheduler_command_enableC()
        self.topic_command_start = scheduler_command_startC()
Exemple #16
0
 def test_specific_set_topic(self):
     ad = BasicProposal1()
     in_topic = scheduler_generalPropConfigC()
     self.assertTrue(hasattr(in_topic, "max_airmass"))
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal1")
     self.assertEqual(out_topic.max_airmass, 2.5)
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.region_types.split(',')[1], "RA")
     self.assertTrue(math.isnan(out_topic.region_bounds[1]))
     self.assertEqual(len(out_topic.region_combiners.split(',')), 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.exclusion_types.split(',')[0], "GP")
     self.assertEqual(out_topic.exclusion_bounds[0], 90.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(len(out_topic.filter_names.split(',')), 6)
     self.assertEqual(out_topic.num_grouped_visits[0], 1)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, 0.0)
     self.assertEqual(out_topic.time_window_start, 0.0)
     self.assertEqual(out_topic.time_window_max, 0.0)
     self.assertEqual(out_topic.time_window_end, 0.0)
Exemple #17
0
 def test_specific_set_topic(self):
     ad = BasicProposal1()
     in_topic = scheduler_generalPropConfigC()
     self.assertTrue(hasattr(in_topic, "max_airmass"))
     out_topic = ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "BasicProposal1")
     self.assertEqual(out_topic.max_airmass, 2.5)
     self.assertEqual(out_topic.min_distance_moon, 30.0)
     self.assertTrue(out_topic.exclude_planets)
     self.assertEqual(out_topic.num_region_selections, 2)
     self.assertEqual(out_topic.region_types.split(',')[1], "RA")
     self.assertTrue(math.isnan(out_topic.region_bounds[1]))
     self.assertEqual(len(out_topic.region_combiners.split(',')), 1)
     self.assertEqual(out_topic.num_exclusion_selections, 1)
     self.assertEqual(out_topic.exclusion_types.split(',')[0], "GP")
     self.assertEqual(out_topic.exclusion_bounds[0], 90.0)
     self.assertEqual(out_topic.num_filters, 6)
     self.assertEqual(len(out_topic.filter_names.split(',')), 6)
     self.assertEqual(out_topic.num_grouped_visits[0], 1)
     self.assertTrue(out_topic.restrict_grouped_visits)
     self.assertEqual(out_topic.time_interval, 0.0)
     self.assertEqual(out_topic.time_window_start, 0.0)
     self.assertEqual(out_topic.time_window_max, 0.0)
     self.assertEqual(out_topic.time_window_end, 0.0)
Exemple #18
0
 def test_default_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "None")
Exemple #19
0
 def test_default_set_topic(self):
     in_topic = scheduler_generalPropConfigC()
     out_topic = self.ad.set_topic(in_topic)
     self.assertEqual(out_topic.name, "None")