Beispiel #1
0
    def test_get_script_config_spec_with_additional_config(self):

        observation = self.make_fbs_observation(note="spec:HD12345")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
            script_configuration_spec=dict(
                filter_sequence=["SDSSg", "SDSSg"],
                grating_sequence=["empty_1", "empty_1"],
            ),
        )

        script_config_expected = {
            "object_name":
            observation["note"][0],
            "object_dec":
            Angle(float(observation["dec"][0]),
                  unit=units.rad).to_string(unit=units.degree, sep=":"),
            "object_ra":
            Angle(float(observation["RA"][0]),
                  unit=units.rad).to_string(unit=units.hourangle, sep=":"),
            "filter_sequence": ["SDSSg", "SDSSg"],
            "grating_sequence": ["empty_1", "empty_1"],
        }

        script_config_yaml = target.get_script_config()

        script_config_unpacked = yaml.safe_load(script_config_yaml)

        self.assertEqual(script_config_expected, script_config_unpacked)
Beispiel #2
0
    def test_get_script_config_spec(self):

        observation = self.make_fbs_observation(note="spec:HD12345")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
        )

        script_config_expected = {
            "object_name":
            observation["note"][0],
            "object_dec":
            Angle(float(observation["dec"][0]),
                  unit=units.rad).to_string(unit=units.degree, sep=":"),
            "object_ra":
            Angle(float(observation["RA"][0]),
                  unit=units.rad).to_string(unit=units.hourangle, sep=":"),
        }

        script_config_yaml = target.get_script_config()

        script_config_unpacked = yaml.safe_load(script_config_yaml)

        self.assertEqual(script_config_expected, script_config_unpacked)
Beispiel #3
0
    def test_get_script_config_cwfs_with_additional_config(self):

        observation = self.make_fbs_observation(note="cwfs")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
            script_configuration_cwfs=dict(filter="SDSSg", grating="empty_1"),
        )

        script_config_expected = dict(
            find_target=dict(
                az=math.degrees(float(observation["az"][0])),
                el=math.degrees(float(observation["alt"][0])),
            ),
            filter="SDSSg",
            grating="empty_1",
        )

        script_config_yaml = target.get_script_config()

        script_config_unpacked = yaml.safe_load(script_config_yaml)

        self.assertEqual(script_config_expected, script_config_unpacked)
Beispiel #4
0
    def test_get_script_config(self):

        observation = self.make_fbs_observation(note="std")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
        )

        script_config_expected = {
            "targetid":
            target.targetid,
            "band_filter":
            target.filter,
            "ra":
            Angle(float(observation["RA"][0]),
                  unit=units.rad).to_string(unit=units.hourangle, sep=":"),
            "dec":
            Angle(float(observation["dec"][0]),
                  unit=units.rad).to_string(unit=units.degree, sep=":"),
            "name":
            observation["note"][0],
            "program":
            observation["note"][0].rsplit("_", maxsplit=1)[0],
            "rot_sky":
            target.ang,
            "obs_time":
            target.obs_time,
            "num_exp":
            target.num_exp,
            "exp_times":
            target.exp_times,
            "estimated_slew_time":
            target.slewtime,
        }

        script_config_yaml = target.get_script_config()

        script_config_unpacked = yaml.safe_load(script_config_yaml)

        self.assertEqual(script_config_expected, script_config_unpacked)
Beispiel #5
0
    def test_get_script_config_cwfs(self):

        observation = self.make_fbs_observation(note="cwfs")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
        )

        script_config_expected = dict(find_target=dict(
            az=math.degrees(float(observation["az"][0])),
            el=math.degrees(float(observation["alt"][0])),
        ))

        script_config_yaml = target.get_script_config()

        script_config_unpacked = yaml.safe_load(script_config_yaml)

        self.assertEqual(script_config_expected, script_config_unpacked)
Beispiel #6
0
    def test_get_script_config_multiple_observations(self):

        filter_obs = "gri"
        observations = self.make_fbs_observation("std", filter_obs=filter_obs)

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observations,
        )

        slew_time, error = self.observatory_model.get_slew_delay(target)

        script_config = yaml.safe_load(target.get_script_config())

        self.assertEqual(len(script_config["exp_times"]), len(filter_obs) * 2)
        for filter_name in filter_obs:
            self.assertIn(filter_name, script_config["band_filter"])

        self.assertEqual(error, 0)
        self.assertGreater(slew_time, 0.0)
Beispiel #7
0
    def test_constructor(self):

        observation = self.make_fbs_observation(note="std")

        target = FeatureSchedulerTarget(
            observing_script_name="observing_script",
            observing_script_is_standard=True,
            observation=observation,
        )

        slew_time, error = self.observatory_model.get_slew_delay(target)

        self.assertEqual(error, 0)
        self.assertGreater(slew_time, 0.0)