test_focalplane.py 1.16 KB
Newer Older
Fang Yuedong's avatar
Fang Yuedong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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(
23
            192.8595, 0., 0.*galsim.degrees, 0.074)
Fang Yuedong's avatar
Fang Yuedong committed
24
25
26
        sky_coverage = self.focal_plane.getSkyCoverage(
            wcs, x0=-1, x1=0, y0=-1, y1=0)
        print(sky_coverage.area())
27
        self.assertTrue(abs(sky_coverage.area() - 0.074**2/(3600.**2)) < 1e13)
Fang Yuedong's avatar
Fang Yuedong committed
28
29


30
if __name__ == '__main__':
Fang Yuedong's avatar
Fang Yuedong committed
31
    unittest.main()