Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-sims
csst_ifs_sim
Commits
9351e427
Commit
9351e427
authored
Sep 30, 2024
by
Yan Zhaojun
Browse files
debug
parents
aa40fa36
3c92e871
Changes
7
Show whitespace changes
Inline
Side-by-side
README.md
View file @
9351e427
# 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/if
s/csst_ifs_
common
.git
git remote add origin https://csst-tb.bao.ac.cn/code/csst-
sim
s/csst_ifs_
sim
.git
git branch -M main
git push -uf origin main
```
...
...
csst_ifs_sim/csst_ifs_sim.py
View file @
9351e427
...
...
@@ -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')
>>>>>>>
3
c92e871e126af516215590e5354597cadc796d9
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
=======
>>>>>>>
3
c92e871e126af516215590e5354597cadc796d9
# 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
,
s
imnumber
):
def
configure
(
self
,
s
ourcein
,
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
)
...
...
csst_ifs_sim/help/CSST-IFS-Cycle9.pdf
0 → 100644
View file @
9351e427
File added
csst_ifs_sim/ifs_data/IFS_sim_C90.config
View file @
9351e427
...
...
@@ -8,7 +8,6 @@ CCDygap = 8.116
sky_fitsin
=
IFS_inputdata
/
FengshuaiData
/
NGC6397_S6102
.
fits
result_path
=
ifs_sim_result
debug
=
yes
...
...
requirements.txt
View file @
9351e427
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
setup.py
View file @
9351e427
...
...
@@ -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
,
)
tests/test_ifs_sim.py
View file @
9351e427
...
...
@@ -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."
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment