Commit 80c8efca authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update setup.py

parent c81ef19b
Pipeline #3962 failed with stage
in 0 seconds
......@@ -5017,7 +5017,7 @@ class IFSsimulator():
##############################################################################################
def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='no'):
def runIFSsim(sourcein, skyfitsin, configfile, iLoop, applyhole='no'):
opts, args = processArgs()
......@@ -5031,11 +5031,7 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
else:
simulate[iLoop].information['holemask'] = 'no'
if CSST_unittest:
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim')
else:
dir_path = '../'
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
simulate[iLoop].information['dir_path'] = dir_path
###############
......@@ -5049,53 +5045,53 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
return 1
########################## begin main fucntion #######################################
##############################################################################################
##############################################################################################
if __name__ == "__main__":
# ########################## begin main fucntion #######################################
# ##############################################################################################
# ##############################################################################################
# if __name__ == "__main__":
CSST_unittest = True
# CSST_unittest = True
sourcein = 'SCI'
# sourcein = 'SCI'
applyhole = 'no'
# applyhole = 'no'
if CSST_unittest:
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
else:
dir_path = '../'
# if CSST_unittest:
# dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
# else:
# dir_path = '../'
configfile0 = dir_path+'IFS_data/IFS_sim_C90.config'
# configfile0 = dir_path+'IFS_data/IFS_sim_C90.config'
skyfitsin = dir_path+'IFS_inputdata/FengshuaiData/NGC6397_S6102.fits'
# skyfitsin = dir_path+'IFS_inputdata/FengshuaiData/NGC6397_S6102.fits'
if len(sys.argv[:]) < 2:
configfile = configfile0
# if len(sys.argv[:]) < 2:
# configfile = configfile0
if len(sys.argv[:]) >= 2:
configfile = sys.argv[1]+'IFS_inputdata/configData/IFS_sim_C90.config'
if not os.path.exists(configfile):
print('The given input fonfigfile path is wrong......')
sys.exit(1)
# if len(sys.argv[:]) >= 2:
# configfile = sys.argv[1]+'IFS_inputdata/configData/IFS_sim_C90.config'
# if not os.path.exists(configfile):
# print('The given input fonfigfile path is wrong......')
# sys.exit(1)
configfile = configfile0
# configfile = configfile0
if len(sys.argv[:]) >= 3:
sourcein = sys.argv[2]
# if len(sys.argv[:]) >= 3:
# sourcein = sys.argv[2]CSST_unittest
if sourcein not in ['BIAS', 'DARK', 'LAMP', 'FLAT', 'SCI']:
print('The input sourcein parameter input is wrong......')
sys.exit(1)
# if sourcein not in ['BIAS', 'DARK', 'LAMP', 'FLAT', 'SCI']:
# print('The input sourcein parameter input is wrong......')
# sys.exit(1)
if len(sys.argv[:]) >= 4:
applyhole = sys.argv[3]
if sourcein not in ['yes', 'no']:
print('The input applyhole parameter should be yes or no!')
sys.exit(1)
#############################################################
################## sky test ############################
# if len(sys.argv[:]) >= 4:
# applyhole = sys.argv[3]
# if sourcein not in ['yes', 'no']:
# print('The input applyhole parameter should be yes or no!')
# sys.exit(1)
# #############################################################
# ################## sky test ############################
runIFSsim(sourcein, skyfitsin, configfile, 1, CSST_unittest, applyhole)
# runIFSsim(sourcein, skyfitsin, configfile, 1, CSST_unittest, applyhole)
############################################################################
############################################################################
......
......@@ -31,18 +31,14 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
"""
# demo function test
dir_path=os.path.join(os.environ['UNIT_TEST_DATA_ROOT'],'ifs_sim/')
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'],'ifs_sim/')
print(dir_path)
d=1
subprocess.run(['csst_ifs_sim.py', dir_path])
#csst_ifs_sim dir_path
configfile = dir_path+'IFS_data/IFS_sim_C90.config'
skyfitsin = dir_path+'IFS_inputdata/FengshuaiData/NGC6397_S6102.fits'
sourcein = 'SCI'
csst_ifs_sim.runIFSsim(sourcein, skyfitsin, configfile, 1, 'no')
self.assertEqual(
d , 1,
1 , 1,
"case 1: SCI sim passes.",
)
......
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