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
csst-sims
csst_msc_sim
Commits
9129df8f
Commit
9129df8f
authored
2 years ago
by
xin
Browse files
Options
Download
Email Patches
Plain Diff
upload code to server
parent
2468ff7c
release_v3.0
11-csst
29-darktime-exptime-shtopen-shtstat-t
current_stable_for_tests
develop
master
milky_way_extinction
new_sim
release_v1.0
release_v2.0
revert-914004c1
sim_scheduler
sls_psf_pca_convolve
wcs_test_gridGalaxy
v3.1.0
v3.0.0
v2.1.0
v2.0.0
v1.0.5
4 merge requests
!11
release_v1.0.5
,
!10
version 1.0.5
,
!8
Sls rot wcs
,
!7
Sls rot wcs
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ObservationSim/MockObject/MockObject.py
+32
-32
ObservationSim/MockObject/MockObject.py
with
32 additions
and
32 deletions
+32
-32
ObservationSim/MockObject/MockObject.py
+
32
-
32
View file @
9129df8f
...
...
@@ -197,46 +197,29 @@ class MockObject(object):
star
=
star
.
withFlux
(
nphotons
)
star
=
galsim
.
Convolve
(
psf
,
star
)
# stamp = star.drawImage(wcs=self.localWCS, method='phot', offset=self.offset, save_photons=True)
# xmax = max(xmax, stamp.xmax)
# ymax = max(ymax, stamp.ymax)
# photons = stamp.photons
# photons.x += self.x_nominal
# photons.y += self.y_nominal
# photons_list.append(photons)
stamp
=
star
.
drawImage
(
wcs
=
real_wcs_local
,
method
=
'phot'
,
offset
=
offset
,
save_photons
=
True
)
stamp
=
star
.
drawImage
(
wcs
=
self
.
localWCS
,
method
=
'phot'
,
offset
=
self
.
offset
,
save_photons
=
True
)
xmax
=
max
(
xmax
,
stamp
.
xmax
)
ymax
=
max
(
ymax
,
stamp
.
ymax
)
photons
=
stamp
.
photons
photons
.
x
+=
x_nominal
photons
.
y
+=
y_nominal
photons
.
x
+=
self
.
x_nominal
photons
.
y
+=
self
.
y_nominal
photons_list
.
append
(
photons
)
stamp
=
galsim
.
ImageF
(
int
(
xmax
*
1.1
),
int
(
ymax
*
1.1
))
stamp
.
wcs
=
self
.
real_wcs_local
stamp
.
setCenter
(
x_nominal
,
y_nominal
)
bounds
=
stamp
.
bounds
&
galsim
.
BoundsD
(
0
,
chip
.
npix_x
-
1
,
0
,
chip
.
npix_y
-
1
)
chip
.
img
.
setOrigin
(
0
,
0
)
stamp
[
bounds
]
=
chip
.
img
[
bounds
]
for
i
in
range
(
len
(
photons_list
)):
if
i
==
0
:
chip
.
sensor
.
accumulate
(
photons_list
[
i
],
stamp
)
else
:
chip
.
sensor
.
accumulate
(
photons_list
[
i
],
stamp
,
resume
=
True
)
chip
.
img
[
bounds
]
=
stamp
[
bounds
]
chip
.
img
.
setOrigin
(
chip
.
bound
.
xmin
,
chip
.
bound
.
ymin
)
# Test stamp size
# print(xmax, ymax)
# stamp = star.drawImage(wcs=real_wcs_local, method='phot', offset=offset, save_photons=True)
# xmax = max(xmax, stamp.xmax)
# ymax = max(ymax, stamp.ymax)
# photons = stamp.photons
# photons.x += x_nominal
# photons.y += y_nominal
# photons_list.append(photons)
# stamp = galsim.ImageF(int(xmax*1.1), int(ymax*1.1))
# stamp.wcs = self.localWCS
# stamp.setCenter(self.x_nominal, self.y_nominal)
# bounds = stamp.bounds & chip.img.bounds
# stamp = galsim.ImageF(int(xmax * 1.1), int(ymax * 1.1))
# stamp.wcs = real_wcs_local
# stamp.setCenter(x_nominal, y_nominal)
# bounds = stamp.bounds & galsim.BoundsI(0, chip.npix_x-1, 0, chip.npix_y-1)
# chip.img.setOrigin(0, 0)
# stamp[bounds] = chip.img[bounds]
# for i in range(len(photons_list)):
# if i == 0:
...
...
@@ -245,6 +228,23 @@ class MockObject(object):
# chip.sensor.accumulate(photons_list[i], stamp, resume=True)
#
# chip.img[bounds] = stamp[bounds]
#
# chip.img.setOrigin(chip.bound.xmin, chip.bound.ymin)
# Test stamp size
# print(xmax, ymax)
stamp
=
galsim
.
ImageF
(
int
(
xmax
*
1.1
),
int
(
ymax
*
1.1
))
stamp
.
wcs
=
self
.
localWCS
stamp
.
setCenter
(
self
.
x_nominal
,
self
.
y_nominal
)
bounds
=
stamp
.
bounds
&
chip
.
img
.
bounds
stamp
[
bounds
]
=
chip
.
img
[
bounds
]
for
i
in
range
(
len
(
photons_list
)):
if
i
==
0
:
chip
.
sensor
.
accumulate
(
photons_list
[
i
],
stamp
)
else
:
chip
.
sensor
.
accumulate
(
photons_list
[
i
],
stamp
,
resume
=
True
)
chip
.
img
[
bounds
]
=
stamp
[
bounds
]
# print(chip.img.array.sum())
# print("nphotons_sum = ", nphotons_sum)
del
photons_list
...
...
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