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
Bo Zhang
csst
Commits
7eaa4054
Commit
7eaa4054
authored
Jun 21, 2022
by
niejuzi
Browse files
updated calib_pos
parent
c0455ffe
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst/msc/calib_pos.py
View file @
7eaa4054
...
...
@@ -66,7 +66,7 @@ class CsstProcMscPositionCalibration(CsstProcessor):
hdul_flg
.
append
(
h1
)
hdul_flg
.
writeto
(
output_flgnm
,
overwrite
=
True
)
def
run_sextractor
(
self
,
ccd_ids
):
def
run_sextractor
(
self
,
ccd_ids
):
"""
Run sextractor
...
...
@@ -81,19 +81,19 @@ class CsstProcMscPositionCalibration(CsstProcessor):
cat_list
=
[]
fn_list
=
[]
for
this_ccd_id
in
ccd_ids
:
print
(
"good"
)
sex_cat
=
self
.
dm
.
l1_sci
(
ccd_id
=
this_ccd_id
,
suffix
=
"img"
,
ext
=
"cat"
)
fn
=
self
.
dm
.
l1_sci
(
ccd_id
=
this_ccd_id
,
suffix
=
"img"
,
ext
=
"fits"
)
cat_list
.
append
(
sex_cat
)
fn_list
.
append
(
fn
)
config_sextractor
=
CONFIG_PATH
+
"new_csst_realtime.no.weight.sex"
sex_comd1
=
'sex -c '
+
config_sextractor
+
' '
sex_comd2
=
fn_list
+
' -CATALOG_NAME '
+
cat_list
sex_comd3
=
' -PARAMETERS_NAME '
+
CONFIG_PATH
+
'csst_realtime.param'
+
' -FILTER_NAME '
+
CONFIG_PATH
+
'csst_realtime.conv'
+
' -STARNNW_NAME '
+
CONFIG_PATH
+
'csst_realtime.nnw'
sex_comd
=
sex_comd1
+
sex_comd2
+
sex_comd3
print
(
sex_comd
)
p
=
Popen
(
sex_comd
,
shell
=
True
)
p
.
wait
()
#
config_sextractor = CONFIG_PATH + "new_csst_realtime.no.weight.sex"
#
sex_comd1 = 'sex -c ' + config_sextractor + ' '
#
sex_comd2 = fn_list + ' -CATALOG_NAME ' + cat_list
#
sex_comd3 = ' -PARAMETERS_NAME ' + CONFIG_PATH + 'csst_realtime.param' + ' -FILTER_NAME ' + CONFIG_PATH + 'csst_realtime.conv' + ' -STARNNW_NAME ' + CONFIG_PATH + 'csst_realtime.nnw'
#
sex_comd = sex_comd1 + sex_comd2 + sex_comd3
#
print(sex_comd)
#
p = Popen(sex_comd, shell=True)
#
p.wait()
def
combine_catalog
(
self
,
ccd_ids
):
"""
...
...
@@ -332,14 +332,14 @@ class CsstProcMscPositionCalibration(CsstProcessor):
scat
=
fits
.
open
(
fn_scat
)
hdul
=
fits
.
HDUList
()
for
i
in
range
(
0
,
len
(
img_list
)):
wcshdr
=
fits
.
getheader
(
wcshead
,
i
,
ignore_missing_simple
=
True
)
# read headers and change to RA---TPV,DEC--TPV for wcs_transfer package
wcshdr
=
fits
.
getheader
(
wcshead
,
i
,
ignore_missing_simple
=
True
)
wcshdr
[
'CTYPE1'
]
=
'RA---TPV'
wcshdr
[
'CTYPE2'
]
=
'DEC--TPV'
w
=
WCS
(
wcshdr
)
sexcat
=
data_scat
[
i
*
3
+
2
].
data
x
=
sexcat
[
'XWIN_IMAGE'
]
y
=
sexcat
[
'YWIN_IMAGE'
]
r
,
d
=
w
.
all_pix2world
(
x
,
y
,
0
)
# convert xwin,ywin to ra,de
r
,
d
=
w
.
all_pix2world
(
x
,
y
,
0
)
sexcat
[
'ALPHA_J2000'
]
=
r
sexcat
[
'DELTA_J2000'
]
=
d
r1
=
np
.
hstack
((
r1
,
r
))
...
...
@@ -436,13 +436,14 @@ class CsstProcMscPositionCalibration(CsstProcessor):
def
run
(
self
,
img_list
,
wht_list
,
flg_list
,
ccd_ids
,
path_gaia
,
search_radius
,
pm_correct
=
True
,
wcs_refine
=
False
,
plot
=
False
):
print
(
'preparing files for position calibration....'
)
self
.
join_data
(
img_list
,
wht_list
,
flg_list
)
#
self.join_data(img_list, wht_list, flg_list)
print
(
'################## run sextractor ###################'
)
p
=
Pool
()
prod_x
=
partial
(
self
.
run_sextractor
)
result
=
p
.
map
(
prod_x
,
ccd_ids
)
p
.
close
()
p
.
join
()
#p = Pool()
#prod_x = partial(self.run_sextractor)
#result = p.map(prod_x, fn_list)
#p.close()
#p.join()
self
.
run_sextractor
(
ccd_ids
)
print
(
'################## sextractor done ###################'
)
print
(
'############### combine sextractor catalog ###############'
)
self
.
combine_catalog
(
ccd_ids
)
...
...
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