From 62bb13ae04ca7a676058c151cefc4be4f0b52b62 Mon Sep 17 00:00:00 2001 From: yan Date: Tue, 16 Apr 2024 08:57:58 +0800 Subject: [PATCH] debug --- csst_ifs_sim/csst_ifs_sim.py | 10 ++++------ tests/test_ifs_sim.py | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/csst_ifs_sim/csst_ifs_sim.py b/csst_ifs_sim/csst_ifs_sim.py index a0c4bfc..e8d2134 100644 --- a/csst_ifs_sim/csst_ifs_sim.py +++ b/csst_ifs_sim/csst_ifs_sim.py @@ -5355,11 +5355,7 @@ class IFSsimulator(): self.simnumber = simnumber self.configure(simnumber) # print the configfile name and path; - if self.information['debug']=='yes': - - self.debug = True - else: - self.debug = False + self.debug = self.information['debug'] self.dt = datetime.utcnow() @@ -5617,7 +5613,7 @@ class IFSsimulator(): ############################################################################ -def runIFSsim(sourcein, configfile, dir_path, iLoop, applyhole='no'): +def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): """ @@ -5650,6 +5646,8 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, applyhole='no'): ### dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/') simulate[iLoop].information['dir_path'] = dir_path + simulate[iLoop].information['debug'] =debug + simulate[iLoop].simulate(sourcein, iLoop) return 1 diff --git a/tests/test_ifs_sim.py b/tests/test_ifs_sim.py index 62b0cdc..2e9feec 100644 --- a/tests/test_ifs_sim.py +++ b/tests/test_ifs_sim.py @@ -41,8 +41,9 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'SCI' print(configfile) - - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'no') + + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') self.assertEqual( 1 , 1, "case 1: SCI sim passes.", @@ -75,7 +76,9 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'BIAS' print(configfile) - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'no') + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + self.assertEqual( 1 , 1, "case 2: sim passes.", @@ -108,7 +111,9 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'DARK' print(configfile) - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'no') + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + self.assertEqual( 1 , 1, "case 3: sim passes.", @@ -141,7 +146,8 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'LAMP' print(configfile) - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'no') + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') self.assertEqual( 1 , 1, "case 4: sim passes.", @@ -174,7 +180,8 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'LAMP' print(configfile) - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'yes') + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') self.assertEqual( 1 , 1, "case 5: sim passes.", @@ -207,7 +214,8 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'FLAT' print(configfile) - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, 'no') + debug=True + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') self.assertEqual( 1 , 1, "case 6: sim passes.", -- GitLab