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
Zheng Gaoshan
co-devTest
Commits
2acefc7d
Commit
2acefc7d
authored
May 19, 2025
by
Zheng Gaoshan
Browse files
Merge branch 'main' of
https://csst-tb.bao.ac.cn/code/zhenggaoshan/co-devtest
parents
3f7b3d67
f3068b83
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.py
View file @
2acefc7d
from
astroquery.mast
import
Observations
from
astropy.io
import
fits
from
astropy.visualization
import
simple_norm
import
matplotlib.pyplot
as
plt
from
ccdproc
import
CCDData
# 查询并下载观测数据
obs_table
=
Observations
.
query_criteria
(
dataproduct_type
=
[
"image"
],
obs_collection
=
"HST"
,
instrument_name
=
"ACS/WFC"
)
data_products_by_obs
=
Observations
.
get_product_list
(
obs_table
[
0
])
download_info
=
Observations
.
download_products
(
data_products_by_obs
[:
1
],
productType
=
"SCIENCE"
)
# 加载FITS文件
fits_file_path
=
download_info
[
'obs_id'
,
'local_path'
][
0
][
'local_path'
]
hdu_list
=
fits
.
open
(
fits_file_path
)
hdu
=
hdu_list
[
0
]
# 将HDU对象转换为CCDData对象,便于后续处理
ccd_image
=
CCDData
(
hdu
.
data
,
unit
=
"adu"
)
# 使用ccdproc进行基本处理,比如减去平均值
processed_image
=
ccd_image
.
subtract
(
ccd_image
.
mean
())
# 显示处理前后的图像
fig
,
(
ax1
,
ax2
)
=
plt
.
subplots
(
1
,
2
,
figsize
=
(
15
,
7
))
norm
=
simple_norm
(
hdu
.
data
,
'sqrt'
,
percent
=
99
)
ax1
.
imshow
(
hdu
.
data
,
norm
=
norm
,
origin
=
'lower'
)
ax1
.
set_title
(
'原始图像'
)
norm_processed
=
simple_norm
(
processed_image
.
data
,
'sqrt'
,
percent
=
99
)
ax2
.
imshow
(
processed_image
.
data
,
norm
=
norm_processed
,
origin
=
'lower'
)
ax2
.
set_title
(
'处理后图像'
)
plt
.
show
()
# 关闭fits文件以释放资源
hdu_list
.
close
()
\ No newline at end of file
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