diff --git a/README.md b/README.md index aed373c9603307c3bddd511cc45de92fabdf830a..c022ed20135ea0b2eb09808cae45c93d6aaf0584 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# csst_ifs_common +# csst_ifs_sim @@ -15,7 +15,7 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea ``` cd existing_repo -git remote add origin https://csst-tb.bao.ac.cn/code/csst-l1/ifs/csst_ifs_common.git +git remote add origin https://csst-tb.bao.ac.cn/code/csst-sims/csst_ifs_sim.git git branch -M main git push -uf origin main ``` diff --git a/csst_ifs_sim/csst_ifs_sim.py b/csst_ifs_sim/csst_ifs_sim.py index 47afae882c3cf6e444b7b0536c241ba2863a98e5..ad3dff9bf960f9b8e82b0aa55fb3ac78337e0169 100644 --- a/csst_ifs_sim/csst_ifs_sim.py +++ b/csst_ifs_sim/csst_ifs_sim.py @@ -27,8 +27,14 @@ from scipy.interpolate import interp1d import astropy.coordinates as coord import ctypes import sys +<<<<<<< HEAD sys.path.append('./csst_ifs_sim') +======= +from .ifs_so import cdm03bidir + +##sys.path.append('./csst_ifs_sim') +>>>>>>> 3c92e871e126af516215590e5354597cadc796d9 conf.auto_max_age = None """ @@ -235,11 +241,15 @@ class CDM03bidir(): ################################################################################# ###modify #sys.path.append('../so') +<<<<<<< HEAD try: from ifs_so import cdm03bidir except: from .ifs_so import cdm03bidir +======= + +>>>>>>> 3c92e871e126af516215590e5354597cadc796d9 # from ifs_so.cdm03.cpython-38-x86_64-linux-gnu import cdm03bidir # import cdm03bidir CTIed = cdm03bidir.cdm03(np.asfortranarray(data), @@ -1937,7 +1947,7 @@ class IFSsimulator(): ############################################################################### ############################################################################### - def configure(self, simnumber): + def configure(self, sourcein, dir_path, result_path, simnumber, debug, applyhole): """ @@ -1961,6 +1971,16 @@ class IFSsimulator(): self.processConfigs() self._createEmpty() + + self.information['dir_path']=dir_path + + self.information['result_path']=result_path + + self.information['debug'] = debug + + self.source=sourcein + + self.simnumber=simnumber ############################################################ @@ -1968,10 +1988,9 @@ class IFSsimulator(): result_day = now.strftime("%Y-%m-%d") - # self.information['holemask'] - + if self.source == 'LAMP': - if self.information['holemask'] == 'yes': + if applyhole == 'yes': ss = '_with_hole_' else: ss = '_no_hole_' @@ -1979,18 +1998,23 @@ class IFSsimulator(): else: ss = '_' - if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/': - self.result_path = self.information['dir_path'] + \ - self.information['result_path']+'/'+self.source+ss+result_day - else: + # if self.information['dir_path'] == '/nfsdata/share/simulation-unittest/ifs_sim/': + # self.result_path = self.information['dir_path'] + \ + # self.information['result_path']+'/'+self.source+ss+result_day + # else: - home_path = os.environ['HOME'] + # home_path = os.environ['HOME'] - if home_path == '/home/yan': + # if home_path == '/home/yan': - self.result_path = '../IFS_simData/'+self.source+ss+result_day - else: - self.result_path = '/data/ifspip/CCD_ima/'+self.source+ss+result_day + # self.result_path = '../IFS_simData/'+self.source+ss+result_day + # else: + # self.result_path = '/data/ifspip/CCD_ima/'+self.source+ss+result_day + + + + self.result_path= self.information['result_path']+'/'+self.source+ss+result_day + print(self.information['result_path']) if os.path.isdir(self.result_path) == False: os.mkdir(self.result_path) @@ -5467,7 +5491,8 @@ class IFSsimulator(): self.source = sourcein self.simnumber = simnumber - self.configure(simnumber) # print the configfile name and path; + + #self.configure(simnumber,dir_path,result_path) # print the configfile name and path; self.debug = self.information['debug'] @@ -5737,7 +5762,7 @@ class IFSsimulator(): ############################################################################ -def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): +def runIFSsim(sourcein, configfile, dir_path, result_path, iLoop, debug, applyhole): """ @@ -5761,6 +5786,9 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): simulate = dict() simulate[iLoop] = IFSsimulator(configfile) + + simulate[iLoop].configure(sourcein, dir_path, result_path, iLoop, debug, applyhole) # load the configfile; + if applyhole == 'yes' and sourcein == 'LAMP': simulate[iLoop].information['holemask'] = 'yes' @@ -5768,10 +5796,12 @@ def runIFSsim(sourcein, configfile, dir_path, iLoop, debug, applyhole='no'): simulate[iLoop].information['holemask'] = '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].information['dir_path'] = dir_path + # simulate[iLoop].information['debug'] = debug + + # simulate[iLoop].information['result_path'] = result_path + simulate[iLoop].simulate(sourcein, iLoop) return 1 diff --git a/csst_ifs_sim/help/CSST-IFS-Cycle9.pdf b/csst_ifs_sim/help/CSST-IFS-Cycle9.pdf new file mode 100644 index 0000000000000000000000000000000000000000..eb5e4ad8f8001a2fd97af50208c33e248990f618 Binary files /dev/null and b/csst_ifs_sim/help/CSST-IFS-Cycle9.pdf differ diff --git a/csst_ifs_sim/ifs_data/IFS_sim_C90.config b/csst_ifs_sim/ifs_data/IFS_sim_C90.config index 943ff03183073528f20a476f6fa72b52f024be3e..36f626a510cce772461349d565bda11ddcf90870 100644 --- a/csst_ifs_sim/ifs_data/IFS_sim_C90.config +++ b/csst_ifs_sim/ifs_data/IFS_sim_C90.config @@ -8,7 +8,6 @@ CCDygap = 8.116 sky_fitsin =IFS_inputdata/FengshuaiData/NGC6397_S6102.fits -result_path =ifs_sim_result debug =yes diff --git a/requirements.txt b/requirements.txt index cb45a51cea45ad8f67d7fd552d8b1470231409c8..8306c6887b31449bca149b01cd041c350c7771ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -numpy==1.23.3 +numpy==1.23.5 scipy==1.9.2 -setuptools==65.5.1 -pandas==1.2.3 +setuptools==65.6.3 +pandas==1.5.3 julian==0.14 astropy==5.1 -tqdm==4.59.0 +tqdm==4.64.1 galsim==2.4.9 diff --git a/setup.py b/setup.py index ac038023a2325680abcfc1b8611ca41fa64c2172..d2c89f114b6237fb3041dd8926588b67a669e977 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ with open("requirements.txt", "r") as f: setuptools.setup( name='csst_ifs_sim', # 包名 - version="1.2.0", # 版本号 + version="3.0.0", # 版本号 author="Zhaojun Yan", # 作者 author_email="zhaojunyan@shao.ac.cn", # 邮箱 description="The CSST IFS simulation - prototype", # 短描述 @@ -41,10 +41,10 @@ setuptools.setup( include_package_data=True, # 设置包含随包数据 package_data={"": ["LICENSE", "README.md"], - "csst_ifs_sim": ["ifs_so/*", "ifs_data/*","CTI/*", "support/*","ifs_data/refs/*", "ifs_data/refs/orbit20160925/*"]}, + "csst_ifs_sim": ["ifs_so/*", "ifs_data/*"]}, # 请注意检查,防止临时文件或其他不必要的文件被提交到仓库,否则会一同安装 - python_requires=">=3.11", # Python版本要求 + python_requires=">=3.8", # Python版本要求 install_requires=requirements, ) diff --git a/tests/test_ifs_sim.py b/tests/test_ifs_sim.py index fa7b8eeb98773d79f281ac5f84fce2de557999fc..854cc0102871fef60a61f392afb0c1a6e4ff03ad 100644 --- a/tests/test_ifs_sim.py +++ b/tests/test_ifs_sim.py @@ -42,8 +42,12 @@ class TestDemoFunction(unittest.TestCase): sourcein = 'SCI' print(configfile) - debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + debug=True + + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no') + self.assertEqual( 1 , 1, "case 1: SCI sim passes.", @@ -77,7 +81,9 @@ class TestDemoFunction(unittest.TestCase): print(configfile) debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no') self.assertEqual( 1 , 1, @@ -112,7 +118,9 @@ class TestDemoFunction(unittest.TestCase): print(configfile) debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no') self.assertEqual( 1 , 1, @@ -147,7 +155,11 @@ class TestDemoFunction(unittest.TestCase): print(configfile) debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'no') + self.assertEqual( 1 , 1, "case 4: sim passes.", @@ -181,7 +193,9 @@ class TestDemoFunction(unittest.TestCase): print(configfile) debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'yes') + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug,'yes') self.assertEqual( 1 , 1, "case 5: sim passes.", @@ -215,7 +229,10 @@ class TestDemoFunction(unittest.TestCase): print(configfile) debug=True - csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, 1, debug,'no') + + result_path=dir_path+'ifs_sim_result' + + csst_ifs_sim.runIFSsim(sourcein, configfile, dir_path, result_path, 1, debug, 'no') self.assertEqual( 1 , 1, "case 6: sim passes.",