Loading csst_ifs_sim/csst_ifs_sim.py +36 −40 Original line number Diff line number Diff line Loading @@ -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() Loading @@ -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 ############### Loading @@ -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) ############################################################################ ############################################################################ Loading tests/test_ifs_sim.py +6 −10 Original line number Diff line number Diff line Loading @@ -32,17 +32,13 @@ class TestDemoFunction(unittest.TestCase): """ # demo function test 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.", ) Loading Loading
csst_ifs_sim/csst_ifs_sim.py +36 −40 Original line number Diff line number Diff line Loading @@ -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() Loading @@ -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 ############### Loading @@ -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) ############################################################################ ############################################################################ Loading
tests/test_ifs_sim.py +6 −10 Original line number Diff line number Diff line Loading @@ -32,17 +32,13 @@ class TestDemoFunction(unittest.TestCase): """ # demo function test 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.", ) Loading