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
e1d1ebda
Commit
e1d1ebda
authored
Apr 08, 2022
by
Fang Yuedong
Browse files
fix bug with cat_out_only option
parent
b0fc6421
Changes
1
Hide whitespace changes
Inline
Side-by-side
ObservationSim/ObservationSim.py
View file @
e1d1ebda
...
...
@@ -239,6 +239,7 @@ class Observation(object):
try
:
if
self
.
config
[
"run_option"
][
"out_cat_only"
]:
isUpdated
=
True
pos_shear
=
0.
elif
chip
.
survey_type
==
"photometric"
and
not
self
.
config
[
"run_option"
][
"out_cat_only"
]:
isUpdated
,
pos_shear
=
obj
.
drawObj_multiband
(
tel
=
self
.
tel
,
...
...
@@ -289,65 +290,67 @@ class Observation(object):
# Detector Effects
# ===========================================================
# whether to output zero, dark, flat calibration images.
chip
.
img
=
chip
.
addEffects
(
config
=
self
.
config
,
img
=
chip
.
img
,
chip_output
=
chip_output
,
filt
=
filt
,
ra_cen
=
pointing
.
ra
,
dec_cen
=
pointing
.
dec
,
img_rot
=
pointing
.
img_pa
,
pointing_ID
=
pointing
.
id
,
timestamp_obs
=
pointing
.
timestamp
,
pointing_type
=
pointing
.
pointing_type
,
sky_map
=
sky_map
,
tel
=
self
.
tel
,
logger
=
chip_output
.
logger
)
if
pointing
.
pointing_type
==
'MS'
:
datetime_obs
=
datetime
.
fromtimestamp
(
pointing
.
timestamp
)
date_obs
=
datetime_obs
.
strftime
(
"%y%m%d"
)
time_obs
=
datetime_obs
.
strftime
(
"%H%M%S"
)
h_prim
=
generatePrimaryHeader
(
xlen
=
chip
.
npix_x
,
ylen
=
chip
.
npix_y
,
pointNum
=
str
(
pointing
.
id
),
ra
=
pointing
.
ra
,
dec
=
pointing
.
dec
,
psize
=
chip
.
pix_scale
,
row_num
=
chip
.
rowID
,
col_num
=
chip
.
colID
,
date
=
date_obs
,
time_obs
=
time_obs
,
exptime
=
pointing
.
exp_time
,
im_type
=
'SCI'
,
sat_pos
=
[
pointing
.
sat_x
,
pointing
.
sat_y
,
pointing
.
sat_z
],
sat_vel
=
[
pointing
.
sat_vx
,
pointing
.
sat_vy
,
pointing
.
sat_vz
])
h_ext
=
generateExtensionHeader
(
xlen
=
chip
.
npix_x
,
ylen
=
chip
.
npix_y
,
ra
=
pointing
.
ra
,
dec
=
pointing
.
dec
,
pa
=
pointing
.
img_pa
.
deg
,
gain
=
chip
.
gain
,
readout
=
chip
.
read_noise
,
dark
=
chip
.
dark_noise
,
saturation
=
90000
,
psize
=
chip
.
pix_scale
,
row_num
=
chip
.
rowID
,
col_num
=
chip
.
colID
,
extName
=
'raw'
)
chip
.
img
=
galsim
.
Image
(
chip
.
img
.
array
,
dtype
=
np
.
uint16
)
hdu1
=
fits
.
PrimaryHDU
(
header
=
h_prim
)
hdu2
=
fits
.
ImageHDU
(
chip
.
img
.
array
,
header
=
h_ext
)
hdu1
=
fits
.
HDUList
([
hdu1
,
hdu2
])
fname
=
os
.
path
.
join
(
chip_output
.
subdir
,
h_prim
[
'FILENAME'
]
+
'.fits'
)
hdu1
.
writeto
(
fname
,
output_verify
=
'ignore'
,
overwrite
=
True
)
# print("# objects that are too bright %d out of %d"%(bright_obj, self.nobj))
# print("# objects that are too dim %d out of %d"%(dim_obj, self.nobj))
# print("# objects that are missed %d out of %d"%(missed_obj, self.nobj))
chip_output
.
logger
.
info
(
"# objects that are too bright %d out of %d"
%
(
bright_obj
,
self
.
nobj
))
chip_output
.
logger
.
info
(
"# objects that are too dim %d out of %d"
%
(
dim_obj
,
self
.
nobj
))
chip_output
.
logger
.
info
(
"# objects that are missed %d out of %d"
%
(
missed_obj
,
self
.
nobj
))
if
not
self
.
config
[
"run_option"
][
"out_cat_only"
]:
chip
.
img
=
chip
.
addEffects
(
config
=
self
.
config
,
img
=
chip
.
img
,
chip_output
=
chip_output
,
filt
=
filt
,
ra_cen
=
pointing
.
ra
,
dec_cen
=
pointing
.
dec
,
img_rot
=
pointing
.
img_pa
,
pointing_ID
=
pointing
.
id
,
timestamp_obs
=
pointing
.
timestamp
,
pointing_type
=
pointing
.
pointing_type
,
sky_map
=
sky_map
,
tel
=
self
.
tel
,
logger
=
chip_output
.
logger
)
if
pointing
.
pointing_type
==
'MS'
:
datetime_obs
=
datetime
.
fromtimestamp
(
pointing
.
timestamp
)
date_obs
=
datetime_obs
.
strftime
(
"%y%m%d"
)
time_obs
=
datetime_obs
.
strftime
(
"%H%M%S"
)
h_prim
=
generatePrimaryHeader
(
xlen
=
chip
.
npix_x
,
ylen
=
chip
.
npix_y
,
pointNum
=
str
(
pointing
.
id
),
ra
=
pointing
.
ra
,
dec
=
pointing
.
dec
,
psize
=
chip
.
pix_scale
,
row_num
=
chip
.
rowID
,
col_num
=
chip
.
colID
,
date
=
date_obs
,
time_obs
=
time_obs
,
exptime
=
pointing
.
exp_time
,
im_type
=
'SCI'
,
sat_pos
=
[
pointing
.
sat_x
,
pointing
.
sat_y
,
pointing
.
sat_z
],
sat_vel
=
[
pointing
.
sat_vx
,
pointing
.
sat_vy
,
pointing
.
sat_vz
])
h_ext
=
generateExtensionHeader
(
xlen
=
chip
.
npix_x
,
ylen
=
chip
.
npix_y
,
ra
=
pointing
.
ra
,
dec
=
pointing
.
dec
,
pa
=
pointing
.
img_pa
.
deg
,
gain
=
chip
.
gain
,
readout
=
chip
.
read_noise
,
dark
=
chip
.
dark_noise
,
saturation
=
90000
,
psize
=
chip
.
pix_scale
,
row_num
=
chip
.
rowID
,
col_num
=
chip
.
colID
,
extName
=
'raw'
)
chip
.
img
=
galsim
.
Image
(
chip
.
img
.
array
,
dtype
=
np
.
uint16
)
hdu1
=
fits
.
PrimaryHDU
(
header
=
h_prim
)
hdu2
=
fits
.
ImageHDU
(
chip
.
img
.
array
,
header
=
h_ext
)
hdu1
=
fits
.
HDUList
([
hdu1
,
hdu2
])
fname
=
os
.
path
.
join
(
chip_output
.
subdir
,
h_prim
[
'FILENAME'
]
+
'.fits'
)
hdu1
.
writeto
(
fname
,
output_verify
=
'ignore'
,
overwrite
=
True
)
# print("# objects that are too bright %d out of %d"%(bright_obj, self.nobj))
# print("# objects that are too dim %d out of %d"%(dim_obj, self.nobj))
# print("# objects that are missed %d out of %d"%(missed_obj, self.nobj))
chip_output
.
logger
.
info
(
"# objects that are too bright %d out of %d"
%
(
bright_obj
,
self
.
nobj
))
chip_output
.
logger
.
info
(
"# objects that are too dim %d out of %d"
%
(
dim_obj
,
self
.
nobj
))
chip_output
.
logger
.
info
(
"# objects that are missed %d out of %d"
%
(
missed_obj
,
self
.
nobj
))
del
chip
.
img
# print("check running:2: pointing-{:} chip-{:} pid-{:} memory-{:6.2}GB".format(pointing.id, chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024) ), flush=True)
...
...
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