Commit 7eaa4054 authored by niejuzi's avatar niejuzi
Browse files

updated calib_pos

parent c0455ffe
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment