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
aff9c074
Commit
aff9c074
authored
Dec 26, 2024
by
Yan Zhaojun
Browse files
update
parent
6c6b430c
Pipeline
#7613
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 @
aff9c074
...
@@ -1398,29 +1398,29 @@ class MCIsimulator():
...
@@ -1398,29 +1398,29 @@ class MCIsimulator():
df2
=
pandas
.
read_csv
(
df2
=
pandas
.
read_csv
(
self
.
information
[
'dir_path'
]
+
'MCI_inputData/star_input/'
+
starcat
)
self
.
information
[
'dir_path'
]
+
'MCI_inputData/star_input/'
+
starcat
)
###
###
#
try
:
try
:
df2
[
'ra_gaia'
][
10
]
df2
[
'ra_gaia'
][
10
]
except
NameError
:
except
NameError
:
self
.
log
.
error
(
self
.
log
.
error
(
'Error,no ra data in the star_cat catlog file '
)
'Error,no ra data in the star_cat catlog file '
)
raise
ValueError
(
raise
ValueError
(
'Error,no ra data in the star_cat catlog file '
)
'Error,no ra data in the star_cat catlog file '
)
#
try
:
try
:
df2
[
'dec_gaia'
][
10
]
df2
[
'dec_gaia'
][
10
]
except
NameError
:
except
NameError
:
self
.
log
.
error
(
self
.
log
.
error
(
'Error,no dec data in the star_cat catlog file '
)
'Error,no dec data in the star_cat catlog file '
)
raise
ValueError
(
raise
ValueError
(
'Error,no dec data in the star_cat catlog file '
)
'Error,no dec data in the star_cat catlog file '
)
#
if
df2
[
'ra_gaia'
].
max
()
>
360
or
df2
[
'ra_gaia'
].
min
()
<
0
or
df2
[
'dec_gaia'
].
max
()
>
90
or
df2
[
'dec_gaia'
].
min
()
<
-
90
:
if
df2
[
'ra_gaia'
].
max
()
>
360
or
df2
[
'ra_gaia'
].
min
()
<
0
or
df2
[
'dec_gaia'
].
max
()
>
90
or
df2
[
'dec_gaia'
].
min
()
<
-
90
:
self
.
log
.
error
(
self
.
log
.
error
(
'ra or dec data beyond definition,please check!'
)
'ra or dec data beyond definition,please check!'
)
raise
ValueError
(
raise
ValueError
(
'ra or dec data beyond definition,please check!'
)
'ra or dec data beyond definition,please check!'
)
#
df3
=
df2
[(
abs
(
df2
[
'ra_gaia'
]
-
df2
[
'ra_gaia'
].
mean
())
<
400
/
3600.0
)
df3
=
df2
[(
abs
(
df2
[
'ra_gaia'
]
-
df2
[
'ra_gaia'
].
mean
())
<
400
/
3600.0
)
&
(
abs
(
df2
[
'dec_gaia'
]
-
df2
[
'dec_gaia'
].
mean
())
<
400
/
3600.0
)]
&
(
abs
(
df2
[
'dec_gaia'
]
-
df2
[
'dec_gaia'
].
mean
())
<
400
/
3600.0
)]
...
@@ -1453,17 +1453,17 @@ class MCIsimulator():
...
@@ -1453,17 +1453,17 @@ class MCIsimulator():
self
.
log
.
error
(
self
.
log
.
error
(
'Error,no ra data in the star_cat catlog file '
)
'Error,no ra data in the star_cat catlog file '
)
raise
ValueError
(
raise
ValueError
(
'Error,no ra data in the star_cat catlog file '
)
'Error,no ra data in the star_cat catlog file '
)
#
try
:
try
:
self
.
star
[
'dec'
][
10
]
self
.
star
[
'dec'
][
10
]
except
NameError
:
except
NameError
:
self
.
log
.
error
(
self
.
log
.
error
(
'Error,no dec data in the star_cat catlog file '
)
'Error,no dec data in the star_cat catlog file '
)
raise
ValueError
(
raise
ValueError
(
'Error,no dec data in the star_cat catlog file '
)
'Error,no dec data in the star_cat catlog file '
)
if
self
.
star
[
'ra'
].
max
()
>
360
or
self
.
star
[
'ra'
].
min
()
<
0
or
self
.
star
[
'dec'
].
max
()
>
90
or
self
.
star
[
'dec'
].
min
()
<
-
90
:
if
self
.
star
[
'ra'
].
max
()
>
360
or
self
.
star
[
'ra'
].
min
()
<
0
or
self
.
star
[
'dec'
].
max
()
>
90
or
self
.
star
[
'dec'
].
min
()
<
-
90
:
self
.
log
.
error
(
self
.
log
.
error
(
'ra or dec data beyond definition,please check!'
)
'ra or dec data beyond definition,please check!'
)
raise
ValueError
(
raise
ValueError
(
...
@@ -2351,16 +2351,16 @@ class MCIsimulator():
...
@@ -2351,16 +2351,16 @@ class MCIsimulator():
if
not
os
.
path
.
exists
(
filename
):
if
not
os
.
path
.
exists
(
filename
):
print
(
'finish load all the input galaxy image fits files'
)
print
(
'finish load all the input galaxy image fits files'
)
#
self
.
log
.
error
(
self
.
log
.
error
(
'Error, when load input galaxy image fits files'
)
'Error, when load input galaxy image fits files'
)
raise
ValueError
(
raise
ValueError
(
'Error, when load input galaxy image fits files'
)
'Error, when load input galaxy image fits files'
)
#
break
break
srcs_cat
=
fits
.
open
(
filename
)
srcs_cat
=
fits
.
open
(
filename
)
#
# ### load galaxy SED fitsfile ###
# ### load galaxy SED fitsfile ###
if
self
.
lensing
:
if
self
.
lensing
:
...
@@ -2383,7 +2383,7 @@ class MCIsimulator():
...
@@ -2383,7 +2383,7 @@ class MCIsimulator():
dec_list
=
[]
dec_list
=
[]
for
kkk
in
range
(
1
,
len
(
srcs_cat
)):
for
kkk
in
range
(
1
,
len
(
srcs_cat
)):
#
# test input data
# test input data
try
:
try
:
srcs_cat
[
kkk
].
header
[
'new_ra'
]
srcs_cat
[
kkk
].
header
[
'new_ra'
]
...
@@ -2392,7 +2392,7 @@ class MCIsimulator():
...
@@ -2392,7 +2392,7 @@ class MCIsimulator():
'Error,no ra data in the input galaxy data file '
)
'Error,no ra data in the input galaxy data file '
)
raise
ValueError
(
raise
ValueError
(
'Error,no ra data in the input galaxy data file '
)
'Error,no ra data in the input galaxy data file '
)
#
try
:
try
:
srcs_cat
[
kkk
].
header
[
'new_dec'
]
srcs_cat
[
kkk
].
header
[
'new_dec'
]
except
NameError
:
except
NameError
:
...
@@ -2401,12 +2401,12 @@ class MCIsimulator():
...
@@ -2401,12 +2401,12 @@ class MCIsimulator():
raise
ValueError
(
raise
ValueError
(
'Error,no dec data in the input galaxy data file '
)
'Error,no dec data in the input galaxy data file '
)
if
srcs_cat
[
kkk
].
header
[
'new_ra'
]
>
360
or
srcs_cat
[
kkk
].
header
[
'new_ra'
]
<
0
or
srcs_cat
[
kkk
].
header
[
'new_dec'
]
>
90
or
srcs_cat
[
kkk
].
header
[
'new_dec'
]
<
-
90
:
if
srcs_cat
[
kkk
].
header
[
'new_ra'
]
>
360
or
srcs_cat
[
kkk
].
header
[
'new_ra'
]
<
0
or
srcs_cat
[
kkk
].
header
[
'new_dec'
]
>
90
or
srcs_cat
[
kkk
].
header
[
'new_dec'
]
<
-
90
:
self
.
log
.
error
(
self
.
log
.
error
(
'Gal ra or dec data beyond definition, please check!'
)
'Gal ra or dec data beyond definition, please check!'
)
raise
ValueError
(
raise
ValueError
(
'Gal ra or dec data beyond definition, please check!'
)
'Gal ra or dec data beyond definition, please check!'
)
#
#
t1
=
srcs_cat
[
kkk
].
header
[
'new_ra'
]
-
\
t1
=
srcs_cat
[
kkk
].
header
[
'new_ra'
]
-
\
self
.
information
[
'gal_ra'
]
+
self
.
information
[
'star_ra'
]
self
.
information
[
'gal_ra'
]
+
self
.
information
[
'star_ra'
]
ra_list
.
append
(
float
(
t1
))
ra_list
.
append
(
float
(
t1
))
...
@@ -2456,19 +2456,19 @@ class MCIsimulator():
...
@@ -2456,19 +2456,19 @@ class MCIsimulator():
# # SED of j-th galaxy ,# unit of 10-17 erg/s/A/cm2
# # SED of j-th galaxy ,# unit of 10-17 erg/s/A/cm2
# here is k1+1, not k1, k1 begins with 0
# here is k1+1, not k1, k1 begins with 0
gal_flux
=
srcs_sed
[
k1
+
1
].
data
gal_flux
=
srcs_sed
[
k1
+
1
].
data
#
if
gal_flux
.
min
()
<
0
or
len
(
gal_flux
)
<
100
:
if
gal_flux
.
min
()
<
0
or
len
(
gal_flux
)
<
100
:
self
.
log
.
error
(
self
.
log
.
error
(
'Galaxy SED data error, please check!'
)
'Galaxy SED data error, please check!'
)
raise
ValueError
(
raise
ValueError
(
'Galaxy SED data error, please check!'
)
'Galaxy SED data error, please check!'
)
#
if
srcs_cat
[
k1
+
1
].
data
.
min
()
<
0
or
srcs_cat
[
k1
+
1
].
data
.
max
==
0
or
srcs_cat
[
k1
+
1
].
data
.
ndim
!=
2
:
if
srcs_cat
[
k1
+
1
].
data
.
min
()
<
0
or
srcs_cat
[
k1
+
1
].
data
.
max
==
0
or
srcs_cat
[
k1
+
1
].
data
.
ndim
!=
2
:
self
.
log
.
error
(
self
.
log
.
error
(
'Galaxy image data error, please check!'
)
'Galaxy image data error, please check!'
)
raise
ValueError
(
raise
ValueError
(
'Galaxy image data error, please check!'
)
'Galaxy image data error, please check!'
)
#
################################
################################
# ## rotate the lensed_images_g ###
# ## rotate the lensed_images_g ###
if
abs
(
theta
.
deg
)
>
0
:
if
abs
(
theta
.
deg
)
>
0
:
...
@@ -5814,7 +5814,7 @@ class MCIsimulator():
...
@@ -5814,7 +5814,7 @@ class MCIsimulator():
self
.
applyRadiationDamage
()
self
.
applyRadiationDamage
()
print
(
'applyRadiationDamage()'
)
print
(
'applyRadiationDamage()'
)
#####################################################################
#####################################################################
##### apply readoutNoise ######
#
#### apply readoutNoise ######
if
self
.
readoutNoise
:
if
self
.
readoutNoise
:
self
.
applyReadoutNoise
()
self
.
applyReadoutNoise
()
...
...
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