Beispiel #1
0
    def validate(self):
        """
        Checks to see if all files exist and can be found by SimCADO

        Also forces any other overriding behaviour like:
            - OBS_ZENITH_DIST overrides ATMO_AIRMASS

        Returns
        -------
        valid : Bool
            True if all files are found.

        """

        # If OBS_ZENITH_DIST is specified it overrides ATMO_AIRMASS,
        if self.cmds["OBS_ZENITH_DIST"] is not None:
            airmass = zendist2airmass(self.cmds["OBS_ZENITH_DIST"])
            self.cmds["ATMO_AIRMASS"] = airmass

        # Update filenames to absolute paths
        try:
            missing_files = self._find_files()
        except ValueError:
            warnings.warn("Local package database couldn't be found")
            missing_files = -1
        files_exist = len(missing_files) == 0

        # .. todo:: implement a method to check that the file formats are happy
        data_format_ok = True

        return files_exist and data_format_ok
 def test_airmass2zendist_undoes_exactly_what_zendist2airmass_does(self):
     zendist = 12.31334
     assert np.allclose(airmass2zendist(zendist2airmass(zendist)),
                        zendist)
 def test_zendist2airmass_undoes_exactly_what_airmass2zendist_does(self):
     airmass = 1.78974234
     assert np.allclose(zendist2airmass(airmass2zendist(airmass)),
                        airmass)
 def test_zendist2airmass_pass_for_known_quanities_ZD_60_equals_ZD_2(self):
     assert np.allclose(zendist2airmass(60), 2.0)
 def test_zendist2airmass_pass_for_known_quanities_ZD_0_equals_AM_1(self):
     assert np.allclose(zendist2airmass(0), 1.0)