import unittest import os import galsim from ObservationSim.Instrument import FocalPlane, Chip class TestFocalPlane(unittest.TestCase): def __init__(self, methodName='runTest'): super(TestFocalPlane, self).__init__(methodName) self.dataPath = os.path.join( os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') self.focal_plane = FocalPlane( chip_list=['8']) self.assertTrue(self.focal_plane.cen_pix_x == 0) self.assertTrue(self.focal_plane.cen_pix_y == 0) test_focal_plane_phot = FocalPlane(survey_type='Photometric') test_focal_plane_spec = FocalPlane(survey_type='Spectroscopic') test_focal_plane_FGS = FocalPlane(survey_type='FGS') test_focal_plane_bad_chips = FocalPlane(bad_chips=["1"]) def test_fp_method(self): wcs = self.focal_plane.getTanWCS( 192.8595, 0., 0.*galsim.degrees, 0.074) sky_coverage = self.focal_plane.getSkyCoverage( wcs, x0=-1, x1=0, y0=-1, y1=0) print(sky_coverage.area()) self.assertTrue(abs(sky_coverage.area() - 0.074**2/(3600.**2)) < 1e13) if __name__ == '__main__': unittest.main()