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_msc_sim
Commits
b2aeca28
Commit
b2aeca28
authored
Nov 07, 2023
by
Zhang Xin
Browse files
modify unit test data folder name by Bo's request
parent
7bd207f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/test_SpecDisperse.py
View file @
b2aeca28
#
#
#need add environment parameter
TEST_HOME
, link to "testData/"
#need add environment parameter
UNIT_TEST_DATA_ROOT
, link to "testData/"
#linx and mac can run as follow, need modify the name of file directory
#linx and mac can run as follow, need modify the name of file directory
#export
TEST_HOME
=/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData
#export
UNIT_TEST_DATA_ROOT
=/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData
#
#
import
unittest
import
unittest
from
ObservationSim.MockObject.SpecDisperser
import
rotate90
,
SpecDisperser
from
ObservationSim.MockObject.SpecDisperser
import
rotate90
,
SpecDisperser
...
@@ -145,9 +145,9 @@ class TestSpecDisperse(unittest.TestCase):
...
@@ -145,9 +145,9 @@ class TestSpecDisperse(unittest.TestCase):
def
__init__
(
self
,
methodName
=
'runTest'
):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
TestSpecDisperse
,
self
).
__init__
(
methodName
)
super
(
TestSpecDisperse
,
self
).
__init__
(
methodName
)
self
.
conff
=
os
.
path
.
join
(
os
.
getenv
(
'
TEST_HOME
'
),
'CSST_GI2.conf'
)
self
.
conff
=
os
.
path
.
join
(
os
.
getenv
(
'
UNIT_TEST_DATA_ROOT
'
),
'CSST_GI2.conf'
)
self
.
throughputf
=
os
.
path
.
join
(
os
.
getenv
(
'
TEST_HOME
'
),
'GI.Throughput.1st.fits'
)
self
.
throughputf
=
os
.
path
.
join
(
os
.
getenv
(
'
UNIT_TEST_DATA_ROOT
'
),
'GI.Throughput.1st.fits'
)
self
.
testDir
=
os
.
getenv
(
'
TEST_HOME
'
)
self
.
testDir
=
os
.
getenv
(
'
UNIT_TEST_DATA_ROOT
'
)
# self.conff = conff
# self.conff = conff
# self.throughputf = throughputf
# self.throughputf = throughputf
...
@@ -697,8 +697,8 @@ class TestSpecDisperse(unittest.TestCase):
...
@@ -697,8 +697,8 @@ class TestSpecDisperse(unittest.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
os
.
environ
[
'
TEST_HOME
'
]
=
"/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
os
.
environ
[
'
UNIT_TEST_DATA_ROOT
'
]
=
"/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
testDir
=
os
.
getenv
(
'
TEST_HOME
'
)
testDir
=
os
.
getenv
(
'
UNIT_TEST_DATA_ROOT
'
)
# conff= os.path.join(testDir, 'CSST_GI2.conf')
# conff= os.path.join(testDir, 'CSST_GI2.conf')
# throughputf= os.path.join(testDir, 'GI.Throughput.1st.fits')
# throughputf= os.path.join(testDir, 'GI.Throughput.1st.fits')
suit
=
unittest
.
TestSuite
()
suit
=
unittest
.
TestSuite
()
...
...
tests/test_Straylight.py
View file @
b2aeca28
#
#
#need add environment parameter
TEST_HOME
, link to "testData/"
#need add environment parameter
UNIT_TEST_DATA_ROOT
, link to "testData/"
#linx and mac can run as follow, need modify the name of file directory
#linx and mac can run as follow, need modify the name of file directory
#export
TEST_HOME
=/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData
#export
UNIT_TEST_DATA_ROOT
=/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData
#
#
import
unittest
import
unittest
from
ObservationSim.Straylight
import
Straylight
from
ObservationSim.Straylight
import
Straylight
...
@@ -71,7 +71,7 @@ class TestStraylight(unittest.TestCase):
...
@@ -71,7 +71,7 @@ class TestStraylight(unittest.TestCase):
def
__init__
(
self
,
methodName
=
'runTest'
,
filter
=
'i'
,
grating
=
"GI"
):
def
__init__
(
self
,
methodName
=
'runTest'
,
filter
=
'i'
,
grating
=
"GI"
):
super
(
TestStraylight
,
self
).
__init__
(
methodName
)
super
(
TestStraylight
,
self
).
__init__
(
methodName
)
self
.
pointingData
=
np
.
loadtxt
(
os
.
path
.
join
(
os
.
getenv
(
'
TEST_HOME
'
),
'Straylight_test.dat'
),
dtype
=
np
.
double
)
self
.
pointingData
=
np
.
loadtxt
(
os
.
path
.
join
(
os
.
getenv
(
'
UNIT_TEST_DATA_ROOT
'
),
'Straylight_test.dat'
),
dtype
=
np
.
double
)
self
.
filter
=
filter
self
.
filter
=
filter
self
.
grating
=
grating
self
.
grating
=
grating
...
@@ -184,7 +184,7 @@ class TestStraylight(unittest.TestCase):
...
@@ -184,7 +184,7 @@ class TestStraylight(unittest.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
os
.
environ
[
'
TEST_HOME
'
]
=
"/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
os
.
environ
[
'
UNIT_TEST_DATA_ROOT
'
]
=
"/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
suit
=
unittest
.
TestSuite
()
suit
=
unittest
.
TestSuite
()
case1
=
TestStraylight
(
'test_EarthShineFilter'
,
filter
=
'i'
)
case1
=
TestStraylight
(
'test_EarthShineFilter'
,
filter
=
'i'
)
...
...
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