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
433867f5
Commit
433867f5
authored
Jun 19, 2025
by
Zhang Xin
Browse files
add a tools: get sls psf
parent
1a0c123c
Pipeline
#8787
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
tools/get_PSF_SLS.py
0 → 100644
View file @
433867f5
import
numpy
as
np
import
observation_sim.psf.PSFInterpSLS
as
PSFInterpSLS
from
observation_sim.instruments
import
Chip
,
Filter
,
FilterParam
import
astropy.io.fits
as
fitsio
from
observation_sim.instruments
import
Chip
,
FilterParam
,
Filter
## 计算 0级或1级光谱在某个波长位置的PSF, 返回值是过采样的PSF,像元大小有CSST图像像元大小的1/2
## chipId 必须为[1,2,3,4,5,10,21,26,27,28,29,30]
## order 只有 0 或 1
## pos_img 为直接成像在图像上的位置,[x, y]
## wave: 波长,单位A
def
get_SLS_PSF
(
chipID
=
1
,
pos_img
=
[
6000
,
4000
],
order
=
1
,
wave
=
8000
,
sls_psf_dir
=
'/nfsdata/share/CSSOSDataProductsSims/data/SLS_PSF_PCA_fp_cd/'
):
orders
=
{
0
:
'B'
,
1
:
'A'
}
chip
=
Chip
(
chipID
)
filter_id
,
filter_type
=
chip
.
getChipFilter
()
filt
=
Filter
(
filter_id
=
filter_id
,
filter_type
=
filter_type
,
filter_param
=
FilterParam
())
psf_model
=
PSFInterpSLS
(
chip
,
filt
,
PSF_data_prefix
=
sls_psf_dir
)
bandNo
=
1
for
i
,
brange
in
enumerate
(
psf_model
.
bandranges
):
if
wave
>=
brange
[
0
]
and
wave
<
brange
[
1
]:
bandNo
=
i
+
1
break
psf1
,
_
=
psf_model
.
get_PSF
(
chip
,
pos_img_local
=
pos_img
,
bandNo
=
bandNo
,
galsimGSObject
=
False
,
g_order
=
orders
[
order
])
fn
=
"psf.chip_{:}.order_{:}.wave_{:}.fits"
.
format
(
chipID
,
order
,
wave
)
hdu
=
fitsio
.
PrimaryHDU
()
hdu
.
data
=
psf1
hdu
.
header
.
set
(
'pixScale'
,
5
)
hdu
.
writeto
(
fn
,
overwrite
=
True
)
if
__name__
==
"__main__"
:
chipid
=
2
pos_img
=
[
6000
,
4500
]
order
=
1
w
=
5000
get_SLS_PSF
(
chipID
=
chipid
,
pos_img
=
pos_img
,
order
=
order
,
wave
=
w
)
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