Commit 437f372d authored by Fang Yuedong's avatar Fang Yuedong
Browse files

Merge branch 'develop' into sim_scheduler

Showing with 409 additions and 311 deletions
+409 -311
This diff is collapsed.
File deleted
......@@ -104,7 +104,7 @@ setup(name='csst_msc_sim',
'ObservationSim.Instrument.data.filters': ['*.txt', '*.list', '*.dat'],
'ObservationSim.Instrument.data.throughputs': ['*.txt', '*.dat'],
'ObservationSim.Instrument.data.sls_conf': ['*.conf', '*.fits'],
'ObservationSim.Instrument.data.flatCube': ['*.fits'],
# 'ObservationSim.Instrument.data.flatCube': ['*.fits'],
'Catalog.data': ['*.fits', '*.so'],
'ObservationSim.Config.Header': ['*.fits', '*.lst'],
'ObservationSim.Straylight.data': ['*.dat'],
......
......@@ -80,7 +80,7 @@ class detModule_coverage(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(detModule_coverage, self).__init__(methodName)
##self.dataPath = "/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA" ##os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_gc1')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc')
self.iccd = 1
......
......@@ -39,7 +39,7 @@ def defineFilt(chip):
class PSFInterpModule_coverage(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(PSFInterpModule_coverage, self).__init__(methodName)
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc')
self.iccd = 8
def test_loadPSFSet(self):
......
......@@ -145,16 +145,22 @@ class TestSpecDisperse(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(TestSpecDisperse,self).__init__(methodName)
self.filePath('csst_fz_gc0')
self.filePath('csst_msc_sim/test_sls_and_straylight')
# self.conff = conff
# self.throughputf = throughputf
def filePath(self, file_name):
fn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name)
self.conff= os.path.join(fn, 'CSST_GI2.conf')
self.throughputf= os.path.join(fn, 'GI.Throughput.1st.fits')
self.testDir = fn
self.outDataFn = os.path.join(fn,'output')
if os.path.isdir(self.outDataFn):
pass
else:
os.mkdir(self.outDataFn)
def test_rotate901(self):
m = np.array([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20],[21,22,23,24,25]])
......@@ -484,7 +490,7 @@ class TestSpecDisperse(unittest.TestCase):
print('Spec double disperse test')
from astropy.io import fits
fits.writeto('test.fits',chip.img.array, overwrite = True)
fits.writeto(os.path.join(self.outDataFn,'test_sls_doubleDisp.fits'),chip.img.array, overwrite = True)
# plt.figure()
# plt.imshow(chip.img.array)
......
......@@ -20,11 +20,11 @@ import os
hubbleAverZodiacal = {'nuv':0.0035,'u':0.0163,'g':0.1109,'r':0.1471,'i':0.1568,'z':0.0953,'y':0.0283}
hubbleAverEarthShine = {'nuv':0.00024,'u':0.0051,'g':0.0506,'r':0.0591,'i':0.0568,'z':0.0315,'y':0.0090}
def transRaDec2D(ra, dec):
x1 = np.cos(dec / 57.2957795) * np.cos(ra / 57.2957795);
y1 = np.cos(dec / 57.2957795) * np.sin(ra / 57.2957795);
z1 = np.sin(dec / 57.2957795);
return np.array([x1, y1, z1])
# def transRaDec2D(ra, dec):
# x1 = np.cos(dec / 57.2957795) * np.cos(ra / 57.2957795);
# y1 = np.cos(dec / 57.2957795) * np.sin(ra / 57.2957795);
# z1 = np.sin(dec / 57.2957795);
# return np.array([x1, y1, z1])
def getAngle132(x1=0, y1=0, z1=0, x2=0, y2=0, z2=0, x3=0, y3=0, z3=0):
......@@ -74,7 +74,7 @@ class TestStraylight(unittest.TestCase):
# print(file_name)
# fn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name)
# self.pointingData = np.loadtxt(os.path.join(fn, 'Straylight_test.dat'), dtype=np.double)
self.filePath('csst_fz_gc0')
self.filePath('csst_msc_sim/test_sls_and_straylight')
self.filter = filter
self.grating = grating
......@@ -192,13 +192,13 @@ class TestStraylight(unittest.TestCase):
if __name__ == '__main__':
os.environ['UNIT_TEST_DATA_ROOT']="/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
suit = unittest.TestSuite()
case1 = TestStraylight('test_EarthShineFilter', filter = 'i')
suit.addTest(case1)
case2 = TestStraylight('test_ZodiacalFilter',filter = 'i')
suit.addTest(case2)
case3 = TestStraylight('test_StarFilter', filter='i')
suit.addTest(case3)
case4 = TestStraylight('test_GratingStraylight', grating = 'GI')
suit.addTest(case4)
unittest.TextTestRunner(verbosity=2).run(suit)
\ No newline at end of file
# suit = unittest.TestSuite()
# case1 = TestStraylight('test_EarthShineFilter', filter = 'i')
# suit.addTest(case1)
# case2 = TestStraylight('test_ZodiacalFilter',filter = 'i')
# suit.addTest(case2)
# case3 = TestStraylight('test_StarFilter', filter='i')
# suit.addTest(case3)
# case4 = TestStraylight('test_GratingStraylight', grating = 'GI')
# suit.addTest(case4)
# unittest.TextTestRunner(verbosity=2).run(suit)
\ No newline at end of file
......@@ -60,7 +60,7 @@ def defineFilt(chip):
class detModule_coverage(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(detModule_coverage, self).__init__(methodName)
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc')
self.iccd = 1
def test_add_dark(self):
......
......@@ -17,7 +17,7 @@ class DetTest(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(DetTest,self).__init__(methodName)
self.filePath('csst_fz_gc0')
self.filePath('csst_msc_sim/test_sls_and_straylight')
def filePath(self, file_name):
self.datafn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name)
......
......@@ -97,8 +97,8 @@ def _load_gals(file_path):
param['av'] = 0.0
param['redden'] = 0
pcs = h5.File("/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/"+"pcs.h5", "r")
lamb = h5.File("/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg/sedlibs/"+"lamb.h5", "r")
pcs = h5.File(os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc/sedlibs/pcs.h5'), "r")
lamb = h5.File(os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc/sedlibs/lamb.h5'), "r")
lamb_gal = lamb['lamb'][()]
pcs = pcs['pcs'][()]
......@@ -158,7 +158,7 @@ def defineFilt(chip):
class imagingModule_coverage(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(imagingModule_coverage, self).__init__(methodName)
self.dataPath = "/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA" ##os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_gc1')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc')
self.iccd = 8
def test_imaging(self):
......@@ -170,7 +170,7 @@ class imagingModule_coverage(unittest.TestCase):
print(chip.cen_pix_x, chip.cen_pix_y)
obj = _load_gals("UNIT_TEST_DATA/galaxies_C6_bundle000287.h5")
obj = _load_gals(os.path.join(self.dataPath, 'galaxies_C6_bundle000287.h5')) #("UNIT_TEST_DATA/galaxies_C6_bundle000287.h5")
sed_data = obj['sed']
norm_filt = None
......
......@@ -81,7 +81,7 @@ def defineFilt(chip):
class detModule_coverage(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(detModule_coverage, self).__init__(methodName)
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_msc')
self.dataPath = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc')
self.iccd = 1
def test_add_prescan_overscan(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment