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
80c8efca
Commit
80c8efca
authored
Apr 10, 2024
by
Yan Zhaojun
Browse files
update setup.py
parent
c81ef19b
Pipeline
#3962
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
csst_ifs_sim/csst_ifs_sim.py
View file @
80c8efca
...
@@ -5017,7 +5017,7 @@ class IFSsimulator():
...
@@ -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
()
opts
,
args
=
processArgs
()
...
@@ -5031,11 +5031,7 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
...
@@ -5031,11 +5031,7 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
else
:
else
:
simulate
[
iLoop
].
information
[
'holemask'
]
=
'no'
simulate
[
iLoop
].
information
[
'holemask'
]
=
'no'
if
CSST_unittest
:
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim/'
)
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim'
)
else
:
dir_path
=
'../'
simulate
[
iLoop
].
information
[
'dir_path'
]
=
dir_path
simulate
[
iLoop
].
information
[
'dir_path'
]
=
dir_path
###############
###############
...
@@ -5049,53 +5045,53 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
...
@@ -5049,53 +5045,53 @@ def runIFSsim(sourcein, skyfitsin, configfile, iLoop, CSST_unittest, applyhole='
return
1
return
1
########################## begin main fucntion #######################################
#
########################## begin main fucntion #######################################
##############################################################################################
#
##############################################################################################
##############################################################################################
#
##############################################################################################
if
__name__
==
"__main__"
:
#
if __name__ == "__main__":
CSST_unittest
=
True
#
CSST_unittest = True
sourcein
=
'SCI'
#
sourcein = 'SCI'
applyhole
=
'no'
#
applyhole = 'no'
if
CSST_unittest
:
#
if CSST_unittest:
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim/'
)
#
dir_path = os.path.join(os.environ['UNIT_TEST_DATA_ROOT'], 'ifs_sim/')
else
:
#
else:
dir_path
=
'../'
#
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
:
#
if len(sys.argv[:]) < 2:
configfile
=
configfile0
#
configfile = configfile0
if
len
(
sys
.
argv
[:])
>=
2
:
#
if len(sys.argv[:]) >= 2:
configfile
=
sys
.
argv
[
1
]
+
'IFS_inputdata/configData/IFS_sim_C90.config'
#
configfile = sys.argv[1]+'IFS_inputdata/configData/IFS_sim_C90.config'
if
not
os
.
path
.
exists
(
configfile
):
#
if not os.path.exists(configfile):
print
(
'The given input fonfigfile path is wrong......'
)
#
print('The given input fonfigfile path is wrong......')
sys
.
exit
(
1
)
#
sys.exit(1)
configfile
=
configfile0
#
configfile = configfile0
if
len
(
sys
.
argv
[:])
>=
3
:
#
if len(sys.argv[:]) >= 3:
sourcein
=
sys
.
argv
[
2
]
#
sourcein = sys.argv[2]
CSST_unittest
if
sourcein
not
in
[
'BIAS'
,
'DARK'
,
'LAMP'
,
'FLAT'
,
'SCI'
]:
#
if sourcein not in ['BIAS', 'DARK', 'LAMP', 'FLAT', 'SCI']:
print
(
'The input sourcein parameter input is wrong......'
)
#
print('The input sourcein parameter input is wrong......')
sys
.
exit
(
1
)
#
sys.exit(1)
if
len
(
sys
.
argv
[:])
>=
4
:
#
if len(sys.argv[:]) >= 4:
applyhole
=
sys
.
argv
[
3
]
#
applyhole = sys.argv[3]
if
sourcein
not
in
[
'yes'
,
'no'
]:
#
if sourcein not in ['yes', 'no']:
print
(
'The input applyhole parameter should be yes or no!'
)
#
print('The input applyhole parameter should be yes or no!')
sys
.
exit
(
1
)
#
sys.exit(1)
#############################################################
#
#############################################################
################## sky test ############################
#
################## sky test ############################
runIFSsim
(
sourcein
,
skyfitsin
,
configfile
,
1
,
CSST_unittest
,
applyhole
)
#
runIFSsim(sourcein, skyfitsin, configfile, 1, CSST_unittest, applyhole)
############################################################################
############################################################################
############################################################################
############################################################################
...
...
tests/test_ifs_sim.py
View file @
80c8efca
...
@@ -31,18 +31,14 @@ class TestDemoFunction(unittest.TestCase):
...
@@ -31,18 +31,14 @@ class TestDemoFunction(unittest.TestCase):
This case aims to test whether the demo function returns `1` if input is `None`.
This case aims to test whether the demo function returns `1` if input is `None`.
"""
"""
# demo function test
# demo function test
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim/'
)
dir_path
=
os
.
path
.
join
(
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
],
'ifs_sim/'
)
print
(
dir_path
)
print
(
dir_path
)
configfile
=
dir_path
+
'IFS_data/IFS_sim_C90.config'
d
=
1
skyfitsin
=
dir_path
+
'IFS_inputdata/FengshuaiData/NGC6397_S6102.fits'
sourcein
=
'SCI'
subprocess
.
run
([
'csst_ifs_sim.py'
,
dir_path
])
csst_ifs_sim
.
runIFSsim
(
sourcein
,
skyfitsin
,
configfile
,
1
,
'no'
)
#csst_ifs_sim dir_path
self
.
assertEqual
(
self
.
assertEqual
(
d
,
1
,
1
,
1
,
"case 1: SCI sim passes."
,
"case 1: SCI 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