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
baad5514
Commit
baad5514
authored
Apr 13, 2024
by
Yan Zhaojun
Browse files
test
parent
132ee572
Pipeline
#3994
passed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/csst_mci_sim.py
View file @
baad5514
...
@@ -213,7 +213,7 @@ def flux2ill(wave, flux):
...
@@ -213,7 +213,7 @@ def flux2ill(wave, flux):
def
ill2flux
(
E
):
def
ill2flux
(
E
):
# use template from sky_bkg (background_spec_hst.dat)
# use template from sky_bkg (background_spec_hst.dat)
filename
=
'../
MCI_inputData/refs/background_spec_hst.dat'
filename
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/refs/background_spec_hst.dat'
cat_spec
=
pd
.
read_csv
(
filename
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
cat_spec
=
pd
.
read_csv
(
filename
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
wave0
=
cat_spec
[
0
].
values
# A
wave0
=
cat_spec
[
0
].
values
# A
spec0
=
cat_spec
[
2
].
values
# erg/s/cm^2/A/arcsec^2
spec0
=
cat_spec
[
2
].
values
# erg/s/cm^2/A/arcsec^2
...
@@ -276,7 +276,7 @@ def zodiacal(ra, dec, time):
...
@@ -276,7 +276,7 @@ def zodiacal(ra, dec, time):
lamda
=
abs
(
lb_obj
.
lon
.
degree
-
lb_sun
.
lon
.
degree
)
lamda
=
abs
(
lb_obj
.
lon
.
degree
-
lb_sun
.
lon
.
degree
)
# interpolated zodical surface brightness at 0.5 um
# interpolated zodical surface brightness at 0.5 um
zodi
=
pd
.
read_csv
(
'../
MCI_inputData/refs/zodi_map.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
zodi
=
pd
.
read_csv
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/refs/zodi_map.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
beta_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
45
,
60
,
75
])
beta_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
45
,
60
,
75
])
lamda_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
35
,
40
,
45
,
lamda_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
35
,
40
,
45
,
60
,
75
,
90
,
105
,
120
,
135
,
150
,
165
,
180
])
60
,
75
,
90
,
105
,
120
,
135
,
150
,
165
,
180
])
...
@@ -289,7 +289,7 @@ def zodiacal(ra, dec, time):
...
@@ -289,7 +289,7 @@ def zodiacal(ra, dec, time):
zodi_obj
=
f
(
beta
,
lamda
)
#
zodi_obj
=
f
(
beta
,
lamda
)
#
# read the zodical spectrum in the ecliptic
# read the zodical spectrum in the ecliptic
cat_spec
=
pd
.
read_csv
(
'../
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
cat_spec
=
pd
.
read_csv
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
wave
=
cat_spec
[
0
].
values
# A
wave
=
cat_spec
[
0
].
values
# A
spec0
=
cat_spec
[
1
].
values
#
spec0
=
cat_spec
[
1
].
values
#
zodi_norm
=
252
#
zodi_norm
=
252
#
...
@@ -398,7 +398,7 @@ class StrayLight(object):
...
@@ -398,7 +398,7 @@ class StrayLight(object):
self
.
equator
=
coord
.
SkyCoord
(
radec
[
0
]
*
u
.
degree
,
radec
[
1
]
*
u
.
degree
,
frame
=
'icrs'
)
self
.
equator
=
coord
.
SkyCoord
(
radec
[
0
]
*
u
.
degree
,
radec
[
1
]
*
u
.
degree
,
frame
=
'icrs'
)
self
.
ecliptic
=
self
.
equator
.
transform_to
(
'barycentrictrueecliptic'
)
self
.
ecliptic
=
self
.
equator
.
transform_to
(
'barycentrictrueecliptic'
)
self
.
pointing
=
transRaDec2D
(
radec
[
0
],
radec
[
1
])
self
.
pointing
=
transRaDec2D
(
radec
[
0
],
radec
[
1
])
self
.
slcdll
=
ctypes
.
CDLL
(
'../
MCI_inputData/refs/libstraylight.so'
)
#dylib
self
.
slcdll
=
ctypes
.
CDLL
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/refs/libstraylight.so'
)
#dylib
self
.
slcdll
.
Calculate
.
argtypes
=
[
ctypes
.
c_double
,
ctypes
.
POINTER
(
ctypes
.
c_double
),
self
.
slcdll
.
Calculate
.
argtypes
=
[
ctypes
.
c_double
,
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
ctypes
.
POINTER
(
ctypes
.
c_double
),
...
@@ -1003,7 +1003,7 @@ def cal_PSF_new(channel,wfetimes,oversampling):
...
@@ -1003,7 +1003,7 @@ def cal_PSF_new(channel,wfetimes,oversampling):
#waven
#waven
# waven=4
# waven=4
# fieldn=10
# fieldn=10
file
=
'../
MCI_inputData/MCI_wavefront/wave_'
+
str
(
waven
+
1
)
+
'/wavefront/opd_'
+
str
(
i
+
1
)
+
'.mat'
file
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/MCI_wavefront/wave_'
+
str
(
waven
+
1
)
+
'/wavefront/opd_'
+
str
(
i
+
1
)
+
'.mat'
data
=
sio
.
loadmat
(
file
)
data
=
sio
.
loadmat
(
file
)
opd
=
data
[
'opd'
]
## opd data;
opd
=
data
[
'opd'
]
## opd data;
psf
[
channel
][
i
,:,:]
=
opd2psf
(
wfetimes
*
opd
,
cwave
[
channel
],
oversampling
)
psf
[
channel
][
i
,:,:]
=
opd2psf
(
wfetimes
*
opd
,
cwave
[
channel
],
oversampling
)
...
@@ -1031,7 +1031,7 @@ def cal_PSF_new(channel,wfetimes,oversampling):
...
@@ -1031,7 +1031,7 @@ def cal_PSF_new(channel,wfetimes,oversampling):
newd
=
fits
.
HDUList
([
hdu1
,
hdu2
,
hdu3
])
newd
=
fits
.
HDUList
([
hdu1
,
hdu2
,
hdu3
])
PSFfilename
=
'../
MCI_inputData/PSF/PSF_'
+
channel
+
'.fits'
PSFfilename
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/PSF/PSF_'
+
channel
+
'.fits'
newd
.
writeto
(
PSFfilename
,
overwrite
=
True
)
newd
.
writeto
(
PSFfilename
,
overwrite
=
True
)
...
@@ -1055,7 +1055,7 @@ def cal_Filter_PSF(wfetimes):
...
@@ -1055,7 +1055,7 @@ def cal_Filter_PSF(wfetimes):
wavelist
=
np
.
array
([
255
,
337
,
419
,
501
,
583
,
665
,
747
,
829
,
911
,
1000
])
wavelist
=
np
.
array
([
255
,
337
,
419
,
501
,
583
,
665
,
747
,
829
,
911
,
1000
])
filterP
=
np
.
load
(
'../
MCI_inputData/MCI_filters/mci_filterPWTC.npy'
,
allow_pickle
=
True
).
item
()
filterP
=
np
.
load
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/MCI_filters/mci_filterPWTC.npy'
,
allow_pickle
=
True
).
item
()
fn
=
np
.
arange
(
1
,
101
,
1
)
### PSF field point
fn
=
np
.
arange
(
1
,
101
,
1
)
### PSF field point
ffx
=
0.1
+
0.02222222
*
((
fn
-
1
)
%
10
)
ffx
=
0.1
+
0.02222222
*
((
fn
-
1
)
%
10
)
...
@@ -1097,7 +1097,7 @@ def cal_Filter_PSF(wfetimes):
...
@@ -1097,7 +1097,7 @@ def cal_Filter_PSF(wfetimes):
#waven
#waven
# waven=4
# waven=4
# fieldn=10
# fieldn=10
file
=
'../
MCI_input/MCI_wavefront/wave_'
+
str
(
waven
+
1
)
+
'/wavefront/opd_'
+
str
(
ii
+
1
)
+
'.mat'
file
=
self
.
information
[
'dir_path'
]
+
'
MCI_input/MCI_wavefront/wave_'
+
str
(
waven
+
1
)
+
'/wavefront/opd_'
+
str
(
ii
+
1
)
+
'.mat'
data
=
sio
.
loadmat
(
file
)
data
=
sio
.
loadmat
(
file
)
opd
=
data
[
'opd'
]
## opd data;
opd
=
data
[
'opd'
]
## opd data;
for
kk
in
range
(
7
):
for
kk
in
range
(
7
):
...
@@ -1111,7 +1111,7 @@ def cal_Filter_PSF(wfetimes):
...
@@ -1111,7 +1111,7 @@ def cal_Filter_PSF(wfetimes):
if
ii
==
0
:
if
ii
==
0
:
psf
[
filtername
][
'psf_iwave'
][
kk
]
=
wavek
psf
[
filtername
][
'psf_iwave'
][
kk
]
=
wavek
np
.
save
(
'../MCI_inputData/PSF
/'
+
filtername
+
'_PSF.npy'
,
psf
[
filtername
])
np
.
save
(
self
.
information
[
'dir_path'
]
+
'mci_sim_result
/'
+
filtername
+
'_PSF.npy'
,
psf
[
filtername
])
return
return
...
@@ -1258,10 +1258,10 @@ class MCIsimulator():
...
@@ -1258,10 +1258,10 @@ class MCIsimulator():
self
.
information
[
'I_filters'
]
=
[
"z"
,
"y"
,
"F815N"
,
"CBI"
,
"F925N"
,
"F960M"
,
"F968N"
,
"F845M"
,
"F850LP"
,
"F814W"
]
self
.
information
[
'I_filters'
]
=
[
"z"
,
"y"
,
"F815N"
,
"CBI"
,
"F925N"
,
"F960M"
,
"F968N"
,
"F845M"
,
"F850LP"
,
"F814W"
]
#### load telescope efficiency data
#### load telescope efficiency data
self
.
tel_eff
=
np
.
load
(
'../
MCI_inputData/tel_eff/tel_eff.npy'
,
allow_pickle
=
True
).
item
()
self
.
tel_eff
=
np
.
load
(
self
.
information
[
'dir_path'
]
+
(
'
MCI_inputData/tel_eff/tel_eff.npy'
,
allow_pickle
=
True
).
item
()
#### load MCI filter data
#### load MCI filter data
self
.
filterP
=
np
.
load
(
'../
MCI_inputData/MCI_filters/mci_filterPWTC.npy'
,
allow_pickle
=
True
).
item
()
self
.
filterP
=
np
.
load
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/MCI_filters/mci_filterPWTC.npy'
,
allow_pickle
=
True
).
item
()
###########################################################################
###########################################################################
...
@@ -1270,10 +1270,25 @@ class MCIsimulator():
...
@@ -1270,10 +1270,25 @@ class MCIsimulator():
result_day
=
now
.
strftime
(
"%Y-%m-%d"
)
result_day
=
now
.
strftime
(
"%Y-%m-%d"
)
#self.result_path='../MCI_simData_'+result_day
#self.result_path='../MCI_simData_'+result_day
if
os
.
getcwd
()
==
'/home/zjyan/work/MCI/simulator'
:
# if os.getcwd() =='/home/zjyan/work/MCI/simulator':
self
.
result_path
=
'/data/mci_simData/'
+
result_day
### CSST1
# self.result_path='/data/mci_simData/'+result_day ### CSST1
# else:
# self.result_path='/home/yan/MCI/simData/'+result_day ### my PC
if
self
.
information
[
'dir_path'
]
==
'/nfsdata/share/simulation-unittest/mci_sim/'
:
self
.
result_path
=
self
.
information
[
'dir_path'
]
+
\
'mci_sim_result/'
+
result_day
else
:
else
:
self
.
result_path
=
'/home/yan/MCI/simData/'
+
result_day
### my PC
home_path
=
os
.
environ
[
'HOME'
]
if
home_path
==
'/home/yan'
:
self
.
result_path
=
'../MCI_simData/'
+
self
.
source
+
ss
+
result_day
else
:
self
.
result_path
=
'/data/mcisimdata/'
+
result_day
if
os
.
path
.
isdir
(
self
.
result_path
)
==
False
:
if
os
.
path
.
isdir
(
self
.
result_path
)
==
False
:
os
.
mkdir
(
self
.
result_path
)
os
.
mkdir
(
self
.
result_path
)
...
@@ -1547,13 +1562,13 @@ class MCIsimulator():
...
@@ -1547,13 +1562,13 @@ class MCIsimulator():
self
.
filter_psf
=
dict
()
self
.
filter_psf
=
dict
()
filtername
=
self
.
filter_g
filtername
=
self
.
filter_g
self
.
filter_psf
[
'g'
]
=
np
.
load
(
'../
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
self
.
filter_psf
[
'g'
]
=
np
.
load
(
information
[
'dir_path'
]
+
'
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
filtername
=
self
.
filter_r
filtername
=
self
.
filter_r
self
.
filter_psf
[
'r'
]
=
np
.
load
(
'../
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
self
.
filter_psf
[
'r'
]
=
np
.
load
(
information
[
'dir_path'
]
+
'
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
filtername
=
self
.
filter_i
filtername
=
self
.
filter_i
self
.
filter_psf
[
'i'
]
=
np
.
load
(
'../
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
self
.
filter_psf
[
'i'
]
=
np
.
load
(
information
[
'dir_path'
]
+
'
MCI_inputData/PSF/'
+
filtername
+
'_PSF.npy'
,
allow_pickle
=
True
).
item
()
return
return
...
@@ -2388,19 +2403,19 @@ class MCIsimulator():
...
@@ -2388,19 +2403,19 @@ class MCIsimulator():
"""
"""
# read solar template
# read solar template
solar_template
=
pd
.
read_csv
(
'../
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
solar_template
=
pd
.
read_csv
(
information
[
'dir_path'
]
+
'
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
header
=
None
,
comment
=
'#'
)
template_wave
=
solar_template
[
0
].
values
template_wave
=
solar_template
[
0
].
values
template_flux
=
solar_template
[
1
].
values
template_flux
=
solar_template
[
1
].
values
# read earth shine surface brightness
# read earth shine surface brightness
earthshine_curve
=
pd
.
read_csv
(
'../
MCI_inputData/refs/earthshine.dat'
,
earthshine_curve
=
pd
.
read_csv
(
information
[
'dir_path'
]
+
'
MCI_inputData/refs/earthshine.dat'
,
header
=
None
,
comment
=
'#'
)
header
=
None
,
comment
=
'#'
)
angle
=
earthshine_curve
[
0
].
values
angle
=
earthshine_curve
[
0
].
values
surface_brightness
=
earthshine_curve
[
1
].
values
surface_brightness
=
earthshine_curve
[
1
].
values
# read V-band throughtput
# read V-band throughtput
cat_filter_V
=
pd
.
read_csv
(
'../
MCI_inputData/refs/filter_Bessell_V.dat'
,
sep
=
'\s+'
,
cat_filter_V
=
pd
.
read_csv
(
information
[
'dir_path'
]
+
'
MCI_inputData/refs/filter_Bessell_V.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
header
=
None
,
comment
=
'#'
)
filter_wave
=
cat_filter_V
[
0
].
values
filter_wave
=
cat_filter_V
[
0
].
values
filter_response
=
cat_filter_V
[
1
].
values
filter_response
=
cat_filter_V
[
1
].
values
...
@@ -2467,7 +2482,7 @@ class MCIsimulator():
...
@@ -2467,7 +2482,7 @@ class MCIsimulator():
lamda
=
abs
(
lb_obj
.
lon
.
degree
-
lb_sun
.
lon
.
degree
)
lamda
=
abs
(
lb_obj
.
lon
.
degree
-
lb_sun
.
lon
.
degree
)
# interpolated zodical surface brightness at 0.5 um
# interpolated zodical surface brightness at 0.5 um
zodi
=
pd
.
read_csv
(
'../
MCI_inputData/refs/zodi_map.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
zodi
=
pd
.
read_csv
(
information
[
'dir_path'
]
+
'
MCI_inputData/refs/zodi_map.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
beta_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
45
,
60
,
75
])
beta_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
45
,
60
,
75
])
lamda_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
35
,
40
,
45
,
lamda_angle
=
np
.
array
([
0
,
5
,
10
,
15
,
20
,
25
,
30
,
35
,
40
,
45
,
60
,
75
,
90
,
105
,
120
,
135
,
150
,
165
,
180
])
60
,
75
,
90
,
105
,
120
,
135
,
150
,
165
,
180
])
...
@@ -2476,7 +2491,7 @@ class MCIsimulator():
...
@@ -2476,7 +2491,7 @@ class MCIsimulator():
zodi_obj
=
f
(
beta
,
lamda
)
# 10^�? W m�? sr�? um�?
zodi_obj
=
f
(
beta
,
lamda
)
# 10^�? W m�? sr�? um�?
# read the zodical spectrum in the ecliptic
# read the zodical spectrum in the ecliptic
cat_spec
=
pd
.
read_csv
(
'../
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
cat_spec
=
pd
.
read_csv
(
information
[
'dir_path'
]
+
'
MCI_inputData/refs/solar_spec.dat'
,
sep
=
'\s+'
,
header
=
None
,
comment
=
'#'
)
wave
=
cat_spec
[
0
].
values
# A
wave
=
cat_spec
[
0
].
values
# A
spec0
=
cat_spec
[
1
].
values
# 10^-8 W m^�? sr^�? μm^�?
spec0
=
cat_spec
[
1
].
values
# 10^-8 W m^�? sr^�? μm^�?
zodi_norm
=
252
# 10^-8 W m^�? sr^�? μm^�?
zodi_norm
=
252
# 10^-8 W m^�? sr^�? μm^�?
...
@@ -2671,7 +2686,7 @@ class MCIsimulator():
...
@@ -2671,7 +2686,7 @@ class MCIsimulator():
print
(
'k2='
,
k2
)
print
(
'k2='
,
k2
)
#
#
filename
=
'../
MCI_inputData/galaxy_Input/
no
Lens_SED_IMG_0.025_230626/Lens_img_cut_IMG_'
+
str
(
k2
+
1
)
+
'.fits'
filename
=
information
[
'dir_path'
]
+
'
MCI_inputData/galaxy_Input/Lens_SED_IMG_0.025_230626/Lens_img_cut_IMG_'
+
str
(
k2
+
1
)
+
'.fits'
self
.
log
.
info
(
'galaxy_Input image path is: %s'
%
(
filename
))
self
.
log
.
info
(
'galaxy_Input image path is: %s'
%
(
filename
))
...
@@ -2682,7 +2697,7 @@ class MCIsimulator():
...
@@ -2682,7 +2697,7 @@ class MCIsimulator():
srcs_cat
=
fits
.
open
(
filename
)
srcs_cat
=
fits
.
open
(
filename
)
#### load galaxy SED fitsfile ###
#### load galaxy SED fitsfile ###
filename
=
'../
MCI_inputData/galaxy_Input/
no
Lens_SED_IMG_0.025_230626/Lens_img_cut_SED_'
+
str
(
k2
+
1
)
+
'.fits'
filename
=
information
[
'dir_path'
]
+
'
MCI_inputData/galaxy_Input/Lens_SED_IMG_0.025_230626/Lens_img_cut_SED_'
+
str
(
k2
+
1
)
+
'.fits'
srcs_sed
=
fits
.
open
(
filename
)
srcs_sed
=
fits
.
open
(
filename
)
self
.
log
.
info
(
'galaxy_Input SED path is: %s'
%
(
filename
))
self
.
log
.
info
(
'galaxy_Input SED path is: %s'
%
(
filename
))
...
@@ -3322,7 +3337,7 @@ class MCIsimulator():
...
@@ -3322,7 +3337,7 @@ class MCIsimulator():
.. Warning:: This method does not work if the input file has exactly one line.
.. Warning:: This method does not work if the input file has exactly one line.
"""
"""
#######################################################################
#######################################################################
cosmetics
=
np
.
loadtxt
(
'../
MCI_inputData/data/Cosmetics_g.txt'
)
cosmetics
=
np
.
loadtxt
(
information
[
'dir_path'
]
+
'
MCI_inputData/data/Cosmetics_g.txt'
)
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
...
@@ -3339,7 +3354,7 @@ class MCIsimulator():
...
@@ -3339,7 +3354,7 @@ class MCIsimulator():
self
.
log
.
info
(
'x=%i, y=%i, value=%f'
%
(
xc
,
yc
,
val
))
self
.
log
.
info
(
'x=%i, y=%i, value=%f'
%
(
xc
,
yc
,
val
))
######################################################################
######################################################################
#######################################################################
#######################################################################
cosmetics
=
np
.
loadtxt
(
'../
MCI_inputData/data/Cosmetics_r.txt'
)
cosmetics
=
np
.
loadtxt
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/data/Cosmetics_r.txt'
)
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
...
@@ -3356,7 +3371,7 @@ class MCIsimulator():
...
@@ -3356,7 +3371,7 @@ class MCIsimulator():
self
.
log
.
info
(
'x=%i, y=%i, value=%f'
%
(
xc
,
yc
,
val
))
self
.
log
.
info
(
'x=%i, y=%i, value=%f'
%
(
xc
,
yc
,
val
))
##############################################################################
##############################################################################
#######################################################################
#######################################################################
cosmetics
=
np
.
loadtxt
(
'../
MCI_inputData/data/Cosmetics_i.txt'
)
cosmetics
=
np
.
loadtxt
(
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/data/Cosmetics_i.txt'
)
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
x
=
np
.
round
(
cosmetics
[:,
0
]).
astype
(
int
)
## row number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
y
=
np
.
round
(
cosmetics
[:,
1
]).
astype
(
int
)
## col number
...
@@ -4000,7 +4015,7 @@ class MCIsimulator():
...
@@ -4000,7 +4015,7 @@ class MCIsimulator():
if
self
.
orbit_pars
[
-
1
,
0
]
<
t2jd
:
## orbit parameters are not in currenct txt file
if
self
.
orbit_pars
[
-
1
,
0
]
<
t2jd
:
## orbit parameters are not in currenct txt file
self
.
orbit_file_num
=
self
.
orbit_file_num
+
1
self
.
orbit_file_num
=
self
.
orbit_file_num
+
1
fn
=
'../
MCI_inputData/TianCe/orbit20160925/'
+
str
(
self
.
orbit_file_num
)
+
'.txt'
;
fn
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/TianCe/orbit20160925/'
+
str
(
self
.
orbit_file_num
)
+
'.txt'
;
self
.
orbit_pars
=
np
.
loadtxt
(
fn
);
self
.
orbit_pars
=
np
.
loadtxt
(
fn
);
self
.
orbit_exp_num
=
0
self
.
orbit_exp_num
=
0
...
@@ -5129,7 +5144,7 @@ class MCIsimulator():
...
@@ -5129,7 +5144,7 @@ class MCIsimulator():
for
k
in
range
(
1
,
50
,
1
):
for
k
in
range
(
1
,
50
,
1
):
fn
=
'../
MCI_inputData/TianCe/orbit20160925/'
+
str
(
k
)
+
'.txt'
;
fn
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/TianCe/orbit20160925/'
+
str
(
k
)
+
'.txt'
;
d
=
np
.
loadtxt
(
fn
);
d
=
np
.
loadtxt
(
fn
);
for
kk
in
range
(
len
(
d
[:,
0
])):
for
kk
in
range
(
len
(
d
[:,
0
])):
...
@@ -5159,7 +5174,7 @@ class MCIsimulator():
...
@@ -5159,7 +5174,7 @@ class MCIsimulator():
else
:
else
:
fn
=
'../
MCI_inputData/TianCe/orbit20160925/'
+
str
(
k
+
1
)
+
'.txt'
;
fn
=
self
.
information
[
'dir_path'
]
+
'
MCI_inputData/TianCe/orbit20160925/'
+
str
(
k
+
1
)
+
'.txt'
;
d
=
np
.
loadtxt
(
fn
);
d
=
np
.
loadtxt
(
fn
);
self
.
orbit_pars
=
d
self
.
orbit_pars
=
d
...
...
csst_mci_sim/mci_data/mci_
sim_example
.config
→
csst_mci_sim/mci_data/mci_
all_9K
.config
100644 → 100755
View file @
baad5514
[
TEST
]
[
TEST
]
### user should define file path below
dir_path
=
mci_sim
/
MCI_inputData
/
inData_path
=/
home
/
yan
/
MCI_sim_Fabu
/
MCI_inputData
result_path
=/
home
/
yan
/
MCI_sim_Fabu
/
mci_sim_result
result_path
=
mci_sim
/
mci_sim_result
/
#size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232
#size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232
xsize
=
1000
xsize
=
9216
ysize
=
1000
ysize
=
9232
##
prescan and overscan , do not change!!!
##
overscanx = column, overscany =row
prescan
=
27
prescan
=
27
overscan
=
320
overscan
=
320
###sourcein = XDF, DARK, FLAT, BIAS
sourcein
=
XDF
##################################################
##################################################
#### ####
#### ####
####Control flags (can be yes/no) ####
####Control flags (can be yes/no
, true/false
) ####
##################################################
##################################################
cosmicRays
=
yes
cosmicRays
=
yes
darknoise
=
yes
darknoise
=
yes
cosmetics
=
yes
cosmetics
=
yes
radiationDamage
=
no
radiationDamage
=
yes
bleeding
=
yes
bleeding
=
yes
...
@@ -45,7 +39,7 @@ TianceEffect = yes
...
@@ -45,7 +39,7 @@ TianceEffect = yes
intscale
=
yes
intscale
=
yes
ghosts
=
yes
ghosts
=
no
shutterEffect
=
yes
shutterEffect
=
yes
...
@@ -57,12 +51,15 @@ appFatt = no
...
@@ -57,12 +51,15 @@ appFatt = no
sky_shift_rot
=
yes
sky_shift_rot
=
yes
distortion
=
no
distortion
=
yes
sim_star
=
yes
sim_star
=
yes
sim_galaxy
=
yes
sim_galaxy
=
yes
save_starpsf
=
no
save_cosmicrays
=
no
##############################################
##############################################
##############################################
##############################################
...
@@ -76,15 +73,15 @@ dark = 0.001
...
@@ -76,15 +73,15 @@ dark = 0.001
exptime
=
300
.
0
exptime
=
300
.
0
###PNRU matrix sigma
###PNRU matrix sigma
prnu_
sigma
=
0
.
001
flat
sigma
=
0
.
001
### cosmicray coveringFraction
### cosmicray coveringFraction
coveringFraction
=
1
.
0
coveringFraction
=
0
.
1
#offset from the object, note that at the moment this is fixed, but in reality a focal plane position dependent.
#offset from the object, note that at the moment this is fixed, but in reality a focal plane position dependent.
ghostOffsetX
=
5
0
ghostOffsetX
=
10
0
ghostOffsetY
=
5
0
ghostOffsetY
=
10
0
ghostRatio
=
1
e
-
04
ghostRatio
=
1
e
-
04
...
@@ -95,7 +92,8 @@ treering=0.1
...
@@ -95,7 +92,8 @@ treering=0.1
fatter
=
1
.
0
fatter
=
1
.
0
difusion
=
0
.
1
difusion
=
0
.
1
### the choosen Filters in three CCDs
### the choosen Filters in three CCDs
filter_g
=
u
filter_g
=
u
filter_r
=
F555W
filter_r
=
F555W
...
...
csst_mci_sim/tests/test_mci_sim.py
View file @
baad5514
...
@@ -11,12 +11,12 @@ Modified-History:
...
@@ -11,12 +11,12 @@ Modified-History:
import
unittest
import
unittest
import
os
import
os
from
csst_
ifs
_sim
import
csst_ifs
_sim
from
csst_
mci
_sim
import
mci
_sim
import
subprocess
import
sys
import
sys
class
TestDemoFunction
(
unittest
.
TestCase
):
class
TestDemoFunction
(
unittest
.
TestCase
):
def
test_
ifs
_sim_1
(
self
):
def
test_
mci
_sim_1
(
self
):
"""
"""
Aim
Aim
---
---
...
@@ -32,17 +32,17 @@ class TestDemoFunction(unittest.TestCase):
...
@@ -32,17 +32,17 @@ 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'
],
'
mci
_sim/'
)
print
(
dir_path
)
print
(
dir_path
)
print
(
sys
.
version
)
print
(
sys
.
version
)
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
###configfile = dir_path+'IFS_inputdata/configData/IFS_sim_C90.config'
configfile
=
'./
ifs
_data/
IFS_sim_C90
.config'
configfile
=
'./
mci
_data/
mci_all_9K
.config'
sourcein
=
'SCI'
sourcein
=
'SCI'
print
(
configfile
)
print
(
configfile
)
csst_ifs
_sim
.
run
IFS
sim
(
sourcein
,
configfile
,
dir_path
,
1
,
'no'
)
mci
_sim
.
run
MCI
sim
(
sourcein
,
configfile
,
dir_path
,
1
)
self
.
assertEqual
(
self
.
assertEqual
(
1
,
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