Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Liu Dezi
csst_msc_sim
Commits
437f372d
Commit
437f372d
authored
1 year ago
by
Fang Yuedong
Browse files
Options
Download
Plain Diff
Merge branch 'develop' into sim_scheduler
parents
6d5e6f7a
9d3aaffd
sim_scheduler
current_stable_for_tests
develop
liudezi-develop-patch-58263
master
internal_test_20240425
No related merge requests found
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
ObservationSim/Instrument/Chip/Chip.py
+375
-283
ObservationSim/Instrument/Chip/Chip.py
ObservationSim/Instrument/data/flatCube/flat_cube.fits
+0
-0
ObservationSim/Instrument/data/flatCube/flat_cube.fits
setup.py
+1
-1
setup.py
tests/test_BF_CTE.py
+1
-1
tests/test_BF_CTE.py
tests/test_PSFmodule.py
+1
-1
tests/test_PSFmodule.py
tests/test_SpecDisperse.py
+8
-2
tests/test_SpecDisperse.py
tests/test_Straylight.py
+16
-16
tests/test_Straylight.py
tests/test_darknoise_func.py
+1
-1
tests/test_darknoise_func.py
tests/test_effect_unit.py
+1
-1
tests/test_effect_unit.py
tests/test_imaging.py
+4
-4
tests/test_imaging.py
tests/test_prescan_overscan_func.py
+1
-1
tests/test_prescan_overscan_func.py
with
409 additions
and
311 deletions
+409
-311
ObservationSim/Instrument/Chip/Chip.py
+
375
-
283
View file @
437f372d
This diff is collapsed.
Click to expand it.
ObservationSim/Instrument/data/flatCube/flat_cube.fits
deleted
100644 → 0
+
0
-
0
View file @
6d5e6f7a
File deleted
This diff is collapsed.
Click to expand it.
setup.py
+
1
-
1
View file @
437f372d
...
...
@@ -104,7 +104,7 @@ setup(name='csst_msc_sim',
'ObservationSim.Instrument.data.filters'
:
[
'*.txt'
,
'*.list'
,
'*.dat'
],
'ObservationSim.Instrument.data.throughputs'
:
[
'*.txt'
,
'*.dat'
],
'ObservationSim.Instrument.data.sls_conf'
:
[
'*.conf'
,
'*.fits'
],
'ObservationSim.Instrument.data.flatCube'
:
[
'*.fits'
],
#
'ObservationSim.Instrument.data.flatCube': ['*.fits'],
'Catalog.data'
:
[
'*.fits'
,
'*.so'
],
'ObservationSim.Config.Header'
:
[
'*.fits'
,
'*.lst'
],
'ObservationSim.Straylight.data'
:
[
'*.dat'
],
...
...
This diff is collapsed.
Click to expand it.
tests/test_BF_CTE.py
+
1
-
1
View file @
437f372d
...
...
@@ -80,7 +80,7 @@ class detModule_coverage(unittest.TestCase):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
detModule_coverage
,
self
).
__init__
(
methodName
)
##self.dataPath = "/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA" ##os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_fz_gc1')
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_fz_msc'
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_
msc_sim/csst_
fz_msc'
)
self
.
iccd
=
1
...
...
This diff is collapsed.
Click to expand it.
tests/test_PSFmodule.py
+
1
-
1
View file @
437f372d
...
...
@@ -39,7 +39,7 @@ def defineFilt(chip):
class
PSFInterpModule_coverage
(
unittest
.
TestCase
):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
PSFInterpModule_coverage
,
self
).
__init__
(
methodName
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_fz_msc'
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_
msc_sim/csst_
fz_msc'
)
self
.
iccd
=
8
def
test_loadPSFSet
(
self
):
...
...
This diff is collapsed.
Click to expand it.
tests/test_SpecDisperse.py
+
8
-
2
View file @
437f372d
...
...
@@ -145,16 +145,22 @@ class TestSpecDisperse(unittest.TestCase):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
TestSpecDisperse
,
self
).
__init__
(
methodName
)
self
.
filePath
(
'csst_
fz_gc0
'
)
self
.
filePath
(
'csst_
msc_sim/test_sls_and_straylight
'
)
# self.conff = conff
# self.throughputf = throughputf
def
filePath
(
self
,
file_name
):
fn
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
file_name
)
self
.
conff
=
os
.
path
.
join
(
fn
,
'CSST_GI2.conf'
)
self
.
throughputf
=
os
.
path
.
join
(
fn
,
'GI.Throughput.1st.fits'
)
self
.
testDir
=
fn
self
.
outDataFn
=
os
.
path
.
join
(
fn
,
'output'
)
if
os
.
path
.
isdir
(
self
.
outDataFn
):
pass
else
:
os
.
mkdir
(
self
.
outDataFn
)
def
test_rotate901
(
self
):
m
=
np
.
array
([[
1
,
2
,
3
,
4
,
5
],[
6
,
7
,
8
,
9
,
10
],[
11
,
12
,
13
,
14
,
15
],[
16
,
17
,
18
,
19
,
20
],[
21
,
22
,
23
,
24
,
25
]])
...
...
@@ -484,7 +490,7 @@ class TestSpecDisperse(unittest.TestCase):
print
(
'Spec double disperse test'
)
from
astropy.io
import
fits
fits
.
writeto
(
'test
.fits'
,
chip
.
img
.
array
,
overwrite
=
True
)
fits
.
writeto
(
os
.
path
.
join
(
self
.
outDataFn
,
'test_sls_doubleDisp
.fits'
)
,
chip
.
img
.
array
,
overwrite
=
True
)
# plt.figure()
# plt.imshow(chip.img.array)
...
...
This diff is collapsed.
Click to expand it.
tests/test_Straylight.py
+
16
-
16
View file @
437f372d
...
...
@@ -20,11 +20,11 @@ import os
hubbleAverZodiacal
=
{
'nuv'
:
0.0035
,
'u'
:
0.0163
,
'g'
:
0.1109
,
'r'
:
0.1471
,
'i'
:
0.1568
,
'z'
:
0.0953
,
'y'
:
0.0283
}
hubbleAverEarthShine
=
{
'nuv'
:
0.00024
,
'u'
:
0.0051
,
'g'
:
0.0506
,
'r'
:
0.0591
,
'i'
:
0.0568
,
'z'
:
0.0315
,
'y'
:
0.0090
}
def
transRaDec2D
(
ra
,
dec
):
x1
=
np
.
cos
(
dec
/
57.2957795
)
*
np
.
cos
(
ra
/
57.2957795
);
y1
=
np
.
cos
(
dec
/
57.2957795
)
*
np
.
sin
(
ra
/
57.2957795
);
z1
=
np
.
sin
(
dec
/
57.2957795
);
return
np
.
array
([
x1
,
y1
,
z1
])
#
def transRaDec2D(ra, dec):
#
x1 = np.cos(dec / 57.2957795) * np.cos(ra / 57.2957795);
#
y1 = np.cos(dec / 57.2957795) * np.sin(ra / 57.2957795);
#
z1 = np.sin(dec / 57.2957795);
#
return np.array([x1, y1, z1])
def
getAngle132
(
x1
=
0
,
y1
=
0
,
z1
=
0
,
x2
=
0
,
y2
=
0
,
z2
=
0
,
x3
=
0
,
y3
=
0
,
z3
=
0
):
...
...
@@ -74,7 +74,7 @@ class TestStraylight(unittest.TestCase):
# print(file_name)
# fn = os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), file_name)
# self.pointingData = np.loadtxt(os.path.join(fn, 'Straylight_test.dat'), dtype=np.double)
self
.
filePath
(
'csst_
fz_gc0
'
)
self
.
filePath
(
'csst_
msc_sim/test_sls_and_straylight
'
)
self
.
filter
=
filter
self
.
grating
=
grating
...
...
@@ -192,13 +192,13 @@ class TestStraylight(unittest.TestCase):
if
__name__
==
'__main__'
:
os
.
environ
[
'UNIT_TEST_DATA_ROOT'
]
=
"/Users/zhangxin/Work/SlitlessSim/CSST_SIM/CSST_develop/csst-simulation/tests/testData"
suit
=
unittest
.
TestSuite
()
case1
=
TestStraylight
(
'test_EarthShineFilter'
,
filter
=
'i'
)
suit
.
addTest
(
case1
)
case2
=
TestStraylight
(
'test_ZodiacalFilter'
,
filter
=
'i'
)
suit
.
addTest
(
case2
)
case3
=
TestStraylight
(
'test_StarFilter'
,
filter
=
'i'
)
suit
.
addTest
(
case3
)
case4
=
TestStraylight
(
'test_GratingStraylight'
,
grating
=
'GI'
)
suit
.
addTest
(
case4
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
suit
)
\ No newline at end of file
# suit = unittest.TestSuite()
# case1 = TestStraylight('test_EarthShineFilter', filter = 'i')
# suit.addTest(case1)
# case2 = TestStraylight('test_ZodiacalFilter',filter = 'i')
# suit.addTest(case2)
# case3 = TestStraylight('test_StarFilter', filter='i')
# suit.addTest(case3)
# case4 = TestStraylight('test_GratingStraylight', grating = 'GI')
# suit.addTest(case4)
# unittest.TextTestRunner(verbosity=2).run(suit)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/test_darknoise_func.py
+
1
-
1
View file @
437f372d
...
...
@@ -60,7 +60,7 @@ def defineFilt(chip):
class
detModule_coverage
(
unittest
.
TestCase
):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
detModule_coverage
,
self
).
__init__
(
methodName
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_fz_msc'
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_
msc_sim/csst_
fz_msc'
)
self
.
iccd
=
1
def
test_add_dark
(
self
):
...
...
This diff is collapsed.
Click to expand it.
tests/
de
t_effect_unit
_test
.py
→
tests/
tes
t_effect_unit.py
+
1
-
1
View file @
437f372d
...
...
@@ -17,7 +17,7 @@ class DetTest(unittest.TestCase):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
DetTest
,
self
).
__init__
(
methodName
)
self
.
filePath
(
'csst_
fz_gc0
'
)
self
.
filePath
(
'csst_
msc_sim/test_sls_and_straylight
'
)
def
filePath
(
self
,
file_name
):
self
.
datafn
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
file_name
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_imaging.py
+
4
-
4
View file @
437f372d
...
...
@@ -97,8 +97,8 @@ def _load_gals(file_path):
param
[
'av'
]
=
0.0
param
[
'redden'
]
=
0
pcs
=
h5
.
File
(
"/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg
/sedlibs/
"
+
"
pcs.h5
"
,
"r"
)
lamb
=
h5
.
File
(
"/public/share/yangxuliu/CSSOSDataProductsSims/data_50sqDeg
/sedlibs/
"
+
"
lamb.h5
"
,
"r"
)
pcs
=
h5
.
File
(
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_msc_sim/csst_fz_msc
/sedlibs/pcs.h5
'
)
,
"r"
)
lamb
=
h5
.
File
(
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_msc_sim/csst_fz_msc
/sedlibs/lamb.h5
'
)
,
"r"
)
lamb_gal
=
lamb
[
'lamb'
][()]
pcs
=
pcs
[
'pcs'
][()]
...
...
@@ -158,7 +158,7 @@ def defineFilt(chip):
class
imagingModule_coverage
(
unittest
.
TestCase
):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
imagingModule_coverage
,
self
).
__init__
(
methodName
)
self
.
dataPath
=
"/public/home/chengliang/CSSOSDataProductsSims/csst-simulation/tests/UNIT_TEST_DATA"
##
os.path.join(os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_
fz_gc1
')
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_
msc_sim/csst_fz_msc
'
)
self
.
iccd
=
8
def
test_imaging
(
self
):
...
...
@@ -170,7 +170,7 @@ class imagingModule_coverage(unittest.TestCase):
print
(
chip
.
cen_pix_x
,
chip
.
cen_pix_y
)
obj
=
_load_gals
(
"UNIT_TEST_DATA/galaxies_C6_bundle000287.h5"
)
obj
=
_load_gals
(
os
.
path
.
join
(
self
.
dataPath
,
'galaxies_C6_bundle000287.h5'
))
#(
"UNIT_TEST_DATA/galaxies_C6_bundle000287.h5")
sed_data
=
obj
[
'sed'
]
norm_filt
=
None
...
...
This diff is collapsed.
Click to expand it.
tests/test_prescan_overscan_func.py
+
1
-
1
View file @
437f372d
...
...
@@ -81,7 +81,7 @@ def defineFilt(chip):
class
detModule_coverage
(
unittest
.
TestCase
):
def
__init__
(
self
,
methodName
=
'runTest'
):
super
(
detModule_coverage
,
self
).
__init__
(
methodName
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_fz_msc'
)
self
.
dataPath
=
os
.
path
.
join
(
os
.
getenv
(
'UNIT_TEST_DATA_ROOT'
),
'csst_
msc_sim/csst_
fz_msc'
)
self
.
iccd
=
1
def
test_add_prescan_overscan
(
self
):
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets