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
5634e275
Commit
5634e275
authored
Aug 01, 2024
by
Fang Yuedong
Browse files
Merge branch 'milky_way_extinction' into 'develop'
bug fix for guidance abberation correction See merge request
!30
parents
e603f8fd
615e951f
Pipeline
#6489
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
observation_sim/ObservationSim.py
View file @
5634e275
...
@@ -23,7 +23,7 @@ class Observation(object):
...
@@ -23,7 +23,7 @@ class Observation(object):
self
.
filter_param
=
FilterParam
()
self
.
filter_param
=
FilterParam
()
self
.
Catalog
=
Catalog
self
.
Catalog
=
Catalog
def
prepare_chip_for_exposure
(
self
,
chip
,
ra_cen
,
dec_cen
,
pointing
,
wcs_fp
=
None
,
slsPSFOptim
=
False
):
def
prepare_chip_for_exposure
(
self
,
chip
,
ra_cen
,
dec_cen
,
pointing
,
wcs_fp
=
None
,
slsPSFOptim
=
False
):
# Get WCS for the focal plane
# Get WCS for the focal plane
if
wcs_fp
==
None
:
if
wcs_fp
==
None
:
wcs_fp
=
self
.
focal_plane
.
getTanWCS
(
wcs_fp
=
self
.
focal_plane
.
getTanWCS
(
...
@@ -35,21 +35,22 @@ class Observation(object):
...
@@ -35,21 +35,22 @@ class Observation(object):
chip
.
img
.
wcs
=
wcs_fp
chip
.
img
.
wcs
=
wcs_fp
chip
.
slsPSFOptim
=
slsPSFOptim
chip
.
slsPSFOptim
=
slsPSFOptim
if
chip
.
chipID
in
[
1
,
2
,
3
,
4
,
5
,
10
,
21
,
26
,
27
,
28
,
29
,
30
]
and
slsPSFOptim
:
if
chip
.
chipID
in
[
1
,
2
,
3
,
4
,
5
,
10
,
21
,
26
,
27
,
28
,
29
,
30
]
and
slsPSFOptim
:
chip
.
img_stack
=
{}
chip
.
img_stack
=
{}
for
id1
in
np
.
arange
(
2
):
for
id1
in
np
.
arange
(
2
):
gn
=
chip_utils
.
getChipSLSGratingID
(
chip
.
chipID
)[
id1
]
gn
=
chip_utils
.
getChipSLSGratingID
(
chip
.
chipID
)[
id1
]
orders
=
{}
orders
=
{}
# for id2 in ['-2','-1','0','1','2']:
# for id2 in ['-2','-1','0','1','2']:
for
id2
in
[
'0'
,
'1'
]:
for
id2
in
[
'0'
,
'1'
]:
o_n
=
"order"
+
id2
o_n
=
"order"
+
id2
allbands
=
{}
allbands
=
{}
for
id3
in
[
'1'
,
'2'
,
'3'
,
'4'
]:
for
id3
in
[
'1'
,
'2'
,
'3'
,
'4'
]:
w_n
=
"w"
+
id3
w_n
=
"w"
+
id3
allbands
[
w_n
]
=
galsim
.
ImageF
(
chip
.
npix_x
,
chip
.
npix_y
)
allbands
[
w_n
]
=
galsim
.
ImageF
(
chip
.
npix_x
,
chip
.
npix_y
)
allbands
[
w_n
].
setOrigin
(
chip
.
bound
.
xmin
,
chip
.
bound
.
ymin
)
allbands
[
w_n
].
setOrigin
(
chip
.
bound
.
xmin
,
chip
.
bound
.
ymin
)
allbands
[
w_n
].
wcs
=
wcs_fp
allbands
[
w_n
].
wcs
=
wcs_fp
orders
[
o_n
]
=
allbands
orders
[
o_n
]
=
allbands
chip
.
img_stack
[
gn
]
=
orders
chip
.
img_stack
[
gn
]
=
orders
else
:
else
:
chip
.
img_stack
=
{}
chip
.
img_stack
=
{}
...
@@ -111,16 +112,17 @@ class Observation(object):
...
@@ -111,16 +112,17 @@ class Observation(object):
input_date_str
=
date_str
,
input_date_str
=
date_str
,
input_time_str
=
time_str
input_time_str
=
time_str
)
)
ra_
cen
,
dec_cen
=
ra_cen
[
0
],
dec_cen
[
0
]
ra_
offset
,
dec_offset
=
pointing
.
ra
-
\
ra_offset
,
dec_offset
=
pointing
.
ra
-
ra_cen
,
pointing
.
dec
-
dec_cen
ra_cen
[
0
]
,
pointing
.
dec
-
dec_cen
[
0
]
else
:
else
:
ra_cen
=
pointing
.
ra
dec_cen
=
pointing
.
dec
ra_offset
,
dec_offset
=
0.
,
0.
ra_offset
,
dec_offset
=
0.
,
0.
ra_cen
=
pointing
.
ra
dec_cen
=
pointing
.
dec
slsPSFOpt
=
False
slsPSFOpt
=
False
# Prepare necessary chip properties for simulation
# Prepare necessary chip properties for simulation
chip
=
self
.
prepare_chip_for_exposure
(
chip
,
ra_cen
,
dec_cen
,
pointing
,
slsPSFOptim
=
slsPSFOpt
)
chip
=
self
.
prepare_chip_for_exposure
(
chip
,
ra_cen
,
dec_cen
,
pointing
,
slsPSFOptim
=
slsPSFOpt
)
# Initialize SimSteps
# Initialize SimSteps
sim_steps
=
SimSteps
(
overall_config
=
self
.
config
,
sim_steps
=
SimSteps
(
overall_config
=
self
.
config
,
...
...
observation_sim/config/ChipOutput.py
View file @
5634e275
...
@@ -78,12 +78,12 @@ class ChipOutput(object):
...
@@ -78,12 +78,12 @@ class ChipOutput(object):
self
.
hdr
+=
"
\n
"
self
.
hdr
+=
"
\n
"
self
.
cat
.
write
(
self
.
hdr
)
self
.
cat
.
write
(
self
.
hdr
)
def
cat_add_obj
(
self
,
obj
,
pos_img
,
pos_shear
):
def
cat_add_obj
(
self
,
obj
,
pos_img
,
pos_shear
,
ra_offset
=
0.
,
dec_offset
=
0.
):
ximg
=
obj
.
real_pos
.
x
+
1.0
ximg
=
obj
.
real_pos
.
x
+
1.0
yimg
=
obj
.
real_pos
.
y
+
1.0
yimg
=
obj
.
real_pos
.
y
+
1.0
line
=
self
.
fmt
%
(
line
=
self
.
fmt
%
(
obj
.
id
,
int
(
self
.
chip_label
),
self
.
filt
.
filter_type
,
ximg
,
yimg
,
obj
.
ra
,
obj
.
dec
,
obj
.
ra_orig
,
obj
.
dec_orig
,
obj
.
z
,
obj
.
getMagFilter
(
obj
.
id
,
int
(
self
.
chip_label
),
self
.
filt
.
filter_type
,
ximg
,
yimg
,
obj
.
ra
+
ra_offset
,
obj
.
dec
+
dec_offset
,
obj
.
ra_orig
,
obj
.
dec_orig
,
obj
.
z
,
obj
.
getMagFilter
(
self
.
filt
),
obj
.
type
,
self
.
filt
),
obj
.
type
,
obj
.
pmra
,
obj
.
pmdec
,
obj
.
rv
,
obj
.
parallax
)
obj
.
pmra
,
obj
.
pmdec
,
obj
.
rv
,
obj
.
parallax
)
line
+=
obj
.
additional_output_str
line
+=
obj
.
additional_output_str
...
...
observation_sim/sim_steps/add_objects.py
View file @
5634e275
...
@@ -194,7 +194,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
...
@@ -194,7 +194,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
if
isUpdated
==
1
:
if
isUpdated
==
1
:
# TODO: add up stats
# TODO: add up stats
self
.
chip_output
.
cat_add_obj
(
obj
,
pos_img
,
pos_shear
)
self
.
chip_output
.
cat_add_obj
(
obj
,
pos_img
,
pos_shear
,
ra_offset
=
self
.
ra_offset
,
dec_offset
=
self
.
dec_offset
)
pass
pass
elif
isUpdated
==
0
:
elif
isUpdated
==
0
:
missed_obj
+=
1
missed_obj
+=
1
...
@@ -236,7 +237,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
...
@@ -236,7 +237,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
# fits.writeto('order0.fits',img1[0],overwrite=True)
# fits.writeto('order0.fits',img1[0],overwrite=True)
# fits.writeto('order1.fits',img1[1],overwrite=True)
# fits.writeto('order1.fits',img1[1],overwrite=True)
psf_model
.
convolveFullImgWithPCAPSF
(
chip
)
psf_model
.
convolveFullImgWithPCAPSF
(
chip
)
del
psf_model
del
psf_model
gc
.
collect
()
gc
.
collect
()
...
...
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