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_mci_sim
Commits
a82efcd8
Commit
a82efcd8
authored
Apr 14, 2024
by
Yan Zhaojun
Browse files
test
parent
0f353503
Pipeline
#4034
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/csst_mci_sim.py
View file @
a82efcd8
...
...
@@ -319,13 +319,14 @@ def CCDnonLinearityModel(data, beta=6e-7):
class
StrayLight
(
object
):
def
__init__
(
self
,
jtime
=
2460843.
,
sat
=
np
.
array
([
0
,
0
,
0
]),
radec
=
np
.
array
([
0
,
0
])):
def
__init__
(
self
,
path
,
jtime
=
2460843.
,
sat
=
np
.
array
([
0
,
0
,
0
]),
radec
=
np
.
array
([
0
,
0
])):
self
.
path
=
path
self
.
jtime
=
jtime
self
.
sat
=
sat
self
.
equator
=
coord
.
SkyCoord
(
radec
[
0
]
*
u
.
degree
,
radec
[
1
]
*
u
.
degree
,
frame
=
'icrs'
)
self
.
ecliptic
=
self
.
equator
.
transform_to
(
'barycentrictrueecliptic'
)
self
.
pointing
=
transRaDec2D
(
radec
[
0
],
radec
[
1
])
self
.
slcdll
=
ctypes
.
CDLL
(
self
.
information
[
'dir_
path
'
]
+
'MCI_inputData/refs/libstraylight.so'
)
#dylib
self
.
slcdll
=
ctypes
.
CDLL
(
self
.
path
+
'MCI_inputData/refs/libstraylight.so'
)
#dylib
self
.
slcdll
.
Calculate
.
argtypes
=
[
ctypes
.
c_double
,
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
...
...
@@ -518,7 +519,9 @@ def deg2HMS(ra0, dec0):
'''convert deg to ra's HMS and dec's DMS'''
c
=
SkyCoord
(
ra
=
ra0
*
u
.
degree
,
dec
=
dec0
*
u
.
degree
)
ss
=
c
.
to_string
(
'hmsdms'
)
print
(
ss
)
## print(ss)
for
k
in
range
(
5
,
len
(
ss
)
-
1
):
if
ss
[
k
]
==
's'
:
...
...
@@ -998,7 +1001,8 @@ def cal_Filter_PSF(wfetimes):
for
filterk
in
filterP
.
keys
():
filtername
=
filterk
print
(
filtername
)
## print(filtername)
filterwaveC
=
filterP
[
filterk
][
'Clambda'
]
filterFwhm
=
filterP
[
filterk
][
'FWHM'
]
...
...
@@ -1423,7 +1427,7 @@ class MCIsimulator():
self
.
source
=
sourcein
print
(
'print information:'
,
self
.
information
)
##
print('print information:', self.information)
###########################################################################
...
...
@@ -1433,8 +1437,7 @@ class MCIsimulator():
result_day
=
now
.
strftime
(
"%Y-%m-%d"
)
#self.result_path='../MCI_simData_'+result_day
print
(
"information.dir_path:"
,
self
.
information
[
'dir_path'
])
if
self
.
information
[
'dir_path'
]
==
'/nfsdata/share/simulation-unittest/mci_sim/'
:
self
.
result_path
=
self
.
information
[
'dir_path'
]
+
'mci_sim_result/'
+
result_day
...
...
@@ -1468,7 +1471,7 @@ class MCIsimulator():
self
.
log
=
lg
.
setUpLogger
(
self
.
result_path
+
'/log_Data/MCIsim_'
+
self
.
source
+
'_'
+
data_time
+
'_Num_'
+
str
(
simnumber
)
+
'.log'
)
#print('logger.handlers=', self.log.handlers)
self
.
log
.
info
(
'-------STARTING A NEW SIMULATION------------'
)
...
...
@@ -1485,7 +1488,7 @@ class MCIsimulator():
self
.
information
[
'I_filters'
]
=
[
"z"
,
"y"
,
"F815N"
,
"CBI"
,
"F925N"
,
"F960M"
,
"F968N"
,
"F845M"
,
"F850LP"
,
"F814W"
]
#### load telescope efficiency data
print
(
self
.
information
[
'dir_path'
])
self
.
tel_eff
=
np
.
load
(
self
.
information
[
'dir_path'
]
+
'MCI_inputData/tel_eff/tel_eff.npy'
,
allow_pickle
=
True
).
item
()
...
...
@@ -1919,7 +1922,7 @@ class MCIsimulator():
wave0
,
zodi0
=
self
.
zodiacal
(
ra
,
dec
,
self
.
TianCe_day
)
# erg/s/cm^2/A/arcsec^2
# EarthShine from straylight
sl
=
StrayLight
(
jtime
=
time_jd
,
sat
=
np
.
array
([
x_sat
,
y_sat
,
z_sat
]),
sl
=
StrayLight
(
self
.
information
[
'dir_path'
],
jtime
=
time_jd
,
sat
=
np
.
array
([
x_sat
,
y_sat
,
z_sat
]),
radec
=
np
.
array
([(
ra
*
u
.
degree
).
value
,
(
dec
*
u
.
degree
).
value
]))
earth_e
=
sl
.
caculateEarthShineFilter
(
filter
=
'r'
)
...
...
@@ -5068,7 +5071,7 @@ class MCIsimulator():
##############################################################################################
sourcelist
=
[
'EXDF'
,
'STAR'
,
'PIPR'
,
'TRNS'
,
'COMB'
,
'CALI'
,
'DARK'
,
'BIAS'
,
'FLAT'
]
if
self
.
source
not
in
sourcelist
:
print
(
'Sourcein is wron
t
'
)
print
(
'Sourcein is wron
g
'
)
sys
.
exit
(
1
)
...
...
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