Commit 691505e7 authored by Zhang Xin's avatar Zhang Xin
Browse files

update unitest model spec and straylight, ust environment parameter

parent 20b4f01c
INSTRUMETN CSSTSLS
GRATING GI
WAVELENGTH 6200 10000
# 1 order (BEAM A) *******************
BEAMA 505 1238
MMAG_EXTRACT_A 30
MMAG_MARK_A 30
#
# Trace description
#
DYDX_ORDER_A 1
DYDX_A_0 1.6521968560197104 -0.00023636575255565063 0.00014657966669906052 5.5353251643711546e-08 -6.875491197053945e-09 1.898528225132234e-09
DYDX_A_1 -0.00823033845070988 8.828905689160072e-08 -4.959096708134394e-07 -1.9481266745599912e-11 1.1236282464271542e-11 -7.748796599795913e-12
#
# X and Y Offsets
#
XOFF_A 0.0
YOFF_A 0.0
#
# Dispersion solution
#
DISP_ORDER_A 1
DLDP_A_0 368.406778602958 0.003046565833724366 0.0008085615398225785 -2.139787644130709e-07 -1.1201107471275321e-07 -3.4449662405229706e-08
DLDP_A_1 8.461359683949652 0.00022163929626988009 -6.114607283280979e-07 7.123049245778616e-09 1.99766396430199e-11 2.5539201322842942e-11
#
SENSITIVITY_A GI.Throughput.1st.fits
#
# 0 order (BEAM B) *******************
BEAMB -121 80
MMAG_EXTRACT_B 30
MMAG_MARK_B 30
#
# Trace description
#
DYDX_ORDER_B 0
DYDX_B_0 -0.15118122059806027 -0.00014883011863745443 7.638889641475754e-05 3.208928684076908e-08 -2.743527540058062e-16 -5.917502574749109e-09
#
# X and Y Offsets
#
XOFF_B 0.0
YOFF_B 0.0
#
# Dispersion solution
#
DISP_ORDER_B 1
DLDP_B_0 -69799.9181918991 7.954241458130043e-08 -4.318951729587184e-08 2.591993568563933e-12 -5.884436166492418e-12 3.83253047082687e-12
DLDP_B_1 -3799.99600104444 7.250278281031939e-09 -3.3418691029874735e-09 -1.6236581010798935e-12 -4.3502364485117337e-13 4.507009220450333e-13
#
SENSITIVITY_B GI.Throughput.0st.fits
#
# -1 order (BEAM C) *******************
BEAMC -1251 -537
MMAG_EXTRACT_C 30
MMAG_MARK_C 30
#
# Trace description
#
DYDX_ORDER_C 1
DYDX_C_0 1.6274259827507076 -0.00034821339283356466 0.0002392999867887435 1.5635809977657976e-07 -7.514174027001749e-09 -6.566395011125117e-09
DYDX_C_1 -5.3689415286860876e-05 -1.912489940030657e-07 -1.070383333548475e-08 1.53386647062175e-10 -1.1208241918489809e-11 3.406912464353884e-12
#
# X and Y Offsets
#
XOFF_C 0.0
YOFF_C 0.0
#
# Dispersion solution
#
DISP_ORDER_C 1
DLDP_C_0 -132.55108204545758 -0.002194041658487836 -0.0011882168059149318 4.510589778063266e-08 5.420547634024377e-08 9.930897689686617e-08
DLDP_C_1 -8.799340620412947 -0.00021774440141256442 -9.53499834632785e-07 -6.889561983057868e-09 -1.6142159956150814e-10 1.0347079457327646e-10
#
SENSITIVITY_C GI.Throughput.-1st.fits
#
# 2 order (BEAM D) *******************
BEAMD 1154 2507
MMAG_EXTRACT_D 30
MMAG_MARK_D 30
#
# Trace description
#
DYDX_ORDER_D 1
DYDX_D_0 6.882799280484086 -0.00027753891131284954 0.0004922039820404395 3.082997123523641e-08 -9.49966186877231e-09 -2.3656818322711693e-09
DYDX_D_1 -0.011947813534498112 4.093696016714032e-08 -7.435107573317389e-07 2.5528541317977112e-12 3.192792142602198e-12 -2.453919520892182e-12
#
# X and Y Offsets
#
XOFF_D 0.0
YOFF_D 0.0
#
# Dispersion solution
#
DISP_ORDER_D 1
DLDP_D_0 681.5215546431494 -0.003828618628269481 0.00025066858071110036 8.289914582311179e-08 -8.404758131147936e-08 2.9680890659588283e-08
DLDP_D_1 3.8798704838712443 0.0001054229718827677 -6.676804799370928e-08 3.250115236230527e-09 1.9094002846781994e-11 -2.387851784113332e-11
#
SENSITIVITY_D GI.Throughput.2st.fits
#
# -2 order (BEAM E) *******************
BEAME -2429 -1162
MMAG_EXTRACT_E 30
MMAG_MARK_E 30
#
# Trace description
#
DYDX_ORDER_E 1
DYDX_E_0 7.677233822131253 -0.00048041060058740204 0.0004956385735024366 6.868585247565035e-08 -9.175237278696478e-09 1.2566962458208905e-09
DYDX_E_1 0.003983370254635055 -1.232787560255339e-08 2.1234388976109016e-07 1.6204618268328708e-11 3.983819645370279e-12 4.263520014579825e-12
#
# X and Y Offsets
#
XOFF_E 0.0
YOFF_E 0.0
#
# Dispersion solution
#
DISP_ORDER_E 1
DLDP_E_0 225.51253672373838 0.004993681854364764 -0.0005008288340946528 -3.699489889412266e-07 9.185967746730138e-10 3.449301385107925e-08
DLDP_E_1 -4.201429796832916 -0.0001002659886793457 -1.5067099385104427e-07 -3.422412459135902e-09 -4.7864621219451994e-11 1.2110924433274547e-11
#
SENSITIVITY_E GI.Throughput.-2st.fits
#
......@@ -18,6 +18,7 @@ from lmfit.models import LinearModel, GaussianModel
from ObservationSim.Config.Header import generateExtensionHeader
import math
import yaml
import os
def getAngle132(x1=0, y1=0, z1=0, x2=0, y2=0, z2=0, x3=0, y3=0, z3=0):
......@@ -136,10 +137,15 @@ def produceObj(x,y,chip, ra, dec, pa):
class TestSpecDisperse(unittest.TestCase):
def __init__(self, methodName='runTest',conff = '', throughputf = ''):
def __init__(self, methodName='runTest'):
super(TestSpecDisperse,self).__init__(methodName)
self.conff = conff
self.throughputf = throughputf
self.conff= os.path.join(os.getenv('TEST_HOME'), 'CSST_GI2.conf')
self.throughputf= os.path.join(os.getenv('TEST_HOME'), 'GI.Throughput.1st.fits')
self.testDir = os.getenv('TEST_HOME')
# self.conff = conff
# self.throughputf = throughputf
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]])
......@@ -167,6 +173,7 @@ class TestSpecDisperse(unittest.TestCase):
def test_Specdistperse1(self):
star = galsim.Gaussian(fwhm=0.39)
g_img = galsim.Image(100, 100, scale=0.074)
starImg = star.drawImage(image=g_img)
......@@ -398,8 +405,8 @@ class TestSpecDisperse(unittest.TestCase):
# work_dir = "/public/home/fangyuedong/CSST_unittest/CSST/test/"
# data_dir = "/Volumes/Extreme SSD/SimData/"
# data_dir = "/data/simudata/CSSOSDataProductsSims/data/"
configFn = 'config_C6.yaml'
normFilterFn = "SLOAN_SDSS.g.fits"
configFn = os.path.join(self.testDir, 'config_C6.yaml')
normFilterFn = os.path.join(self.testDir, 'SLOAN_SDSS.g.fits')
norm_star = Table.read(normFilterFn)
with open(configFn, "r") as stream:
try:
......@@ -478,7 +485,7 @@ class TestSpecDisperse(unittest.TestCase):
def test_SLSImage_rotation(self):
from astropy.wcs import WCS
configFn = 'config_C6.yaml'
configFn = os.path.join(self.testDir,'config_C6.yaml')
with open(configFn, "r") as stream:
try:
......@@ -684,17 +691,19 @@ class TestSpecDisperse(unittest.TestCase):
if __name__ == '__main__':
conff='/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_C6/csst-simulation/ObservationSim/Instrument/data/sls_conf/CSST_GI2.conf'
throughputf='/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_C6/csst-simulation/ObservationSim/Instrument/data/sls_conf/GI.Throughput.1st.fits'
os.environ['TEST_HOME']="/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
testDir = os.getenv('TEST_HOME')
# conff= os.path.join(testDir, 'CSST_GI2.conf')
# throughputf= os.path.join(testDir, 'GI.Throughput.1st.fits')
suit = unittest.TestSuite()
case1 = TestSpecDisperse('test_Specdistperse1',conff,throughputf)
case1 = TestSpecDisperse('test_Specdistperse1')
suit.addTest(case1)
case2 = TestSpecDisperse('test_Specdistperse2', conff, throughputf)
case2 = TestSpecDisperse('test_Specdistperse2')
suit.addTest(case2)
case3 = TestSpecDisperse('test_Specdistperse3', conff, throughputf)
case3 = TestSpecDisperse('test_Specdistperse3')
suit.addTest(case3)
case4 = TestSpecDisperse('test_double_disperse', conff, throughputf)
case4 = TestSpecDisperse('test_double_disperse')
suit.addTest(case4)
case5 = TestSpecDisperse('test_SLSImage_rotation')
suit.addTest(case5)
......
......@@ -10,6 +10,8 @@ from scipy import interpolate
import matplotlib.pyplot as plt
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}
......@@ -62,9 +64,9 @@ def calculateAnglePwithEarth(sat = np.array([0,0,0]), pointing = np.array([0,0,0
class TestStraylight(unittest.TestCase):
def __init__(self, methodName='runTest',datFn = '', filter = 'i', grating = "GI"):
def __init__(self, methodName='runTest', filter = 'i', grating = "GI"):
super(TestStraylight,self).__init__(methodName)
self.pointingData = np.loadtxt(datFn, dtype=np.double)
self.pointingData = np.loadtxt(os.path.join(os.getenv('TEST_HOME'), 'Straylight_test.dat'), dtype=np.double)
self.filter = filter
self.grating = grating
......@@ -177,14 +179,15 @@ class TestStraylight(unittest.TestCase):
if __name__ == '__main__':
os.environ['TEST_HOME']="/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
suit = unittest.TestSuite()
# case1 = TestStraylight('test_EarthShineFilter',datFn = 'Straylight_test.dat', filter = 'i')
# suit.addTest(case1)
# case2 = TestStraylight('test_ZodiacalFilter',datFn = 'Straylight_test.dat',filter = 'i')
# suit.addTest(case2)
# case3 = TestStraylight('test_StarFilter', datFn='Straylight_test.dat', filter='i')
# suit.addTest(case3)
case4 = TestStraylight('test_GratingStraylight', datFn='Straylight_test.dat', grating = 'GI')
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
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