Commit 9351e427 authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

debug

parents aa40fa36 3c92e871
# 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
```
......
......@@ -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):
"""
......@@ -1962,16 +1972,25 @@ class IFSsimulator():
self._createEmpty()
self.information['dir_path']=dir_path
self.information['result_path']=result_path
self.information['debug'] = debug
self.source=sourcein
self.simnumber=simnumber
############################################################
now = datetime.utcnow()
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):
"""
......@@ -5762,15 +5787,20 @@ 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'
else:
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['dir_path'] = dir_path
# simulate[iLoop].information['debug'] = debug
simulate[iLoop].information['debug'] = debug
# simulate[iLoop].information['result_path'] = result_path
simulate[iLoop].simulate(sourcein, iLoop)
......
......@@ -8,7 +8,6 @@ CCDygap = 8.116
sky_fitsin =IFS_inputdata/FengshuaiData/NGC6397_S6102.fits
result_path =ifs_sim_result
debug =yes
......
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
......@@ -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,
)
......@@ -43,7 +43,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 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.",
......
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