def load_echelogram(ref_date, band): from echellogram import Echellogram echel_name = get_master_calib_abspath("fitted_echellogram_sky_%s_%s.json" % (band, ref_date)) echel = Echellogram.from_json_fitted_echellogram_sky(echel_name) return echel
def align_echellogram_thar(thar_reidentified_products, echel, band, ap): from storage_descriptions import (THAR_REID_JSON_DESC, THAR_ALIGNED_JSON_DESC) orders = thar_reidentified_products[THAR_REID_JSON_DESC]["orders"] fn0 = "ThArlines.dat" fn = get_master_calib_abspath(fn0) th = np.genfromtxt(fn) wvl_thar = th[:, 0] / 1.e4 #s_thar = np.clip(th[:,1], a_min=20, a_max=np.inf) # line_list : dict of (order, (pixel coord list, wavelengths)) wvl_list = {} pixel_list = {} match_list = thar_reidentified_products[THAR_REID_JSON_DESC]["match_list"] for o, s in zip(orders, match_list): lineid_list = s[0] # [s1[0] for s1 in s] wvl = wvl_thar[lineid_list] wvl_list[o] = wvl x = [s1[0] for s1 in s[1]] pixel_list[o] = x xy1f, nan_mask = echel.get_xy_list_filtered(wvl_list) xy2f = ap.get_xy_list(pixel_list, nan_mask) from align_echellogram_thar import fit_affine_clip affine_tr, mm = fit_affine_clip(xy1f, xy2f) r = PipelineProducts("ThAr aligned echellogram products") r.add( THAR_ALIGNED_JSON_DESC, PipelineDict(xy1f=xy1f, xy2f=xy2f, affine_tr=affine_tr, affine_tr_mask=mm)) return r
def align_echellogram_thar(thar_reidentified_products, echel, band, ap): from storage_descriptions import (THAR_REID_JSON_DESC, THAR_ALIGNED_JSON_DESC) orders = thar_reidentified_products[THAR_REID_JSON_DESC]["orders"] fn0 = "ThArlines.dat" fn = get_master_calib_abspath(fn0) th = np.genfromtxt(fn) wvl_thar = th[:,0]/1.e4 #s_thar = np.clip(th[:,1], a_min=20, a_max=np.inf) # line_list : dict of (order, (pixel coord list, wavelengths)) wvl_list = {} pixel_list = {} match_list = thar_reidentified_products[THAR_REID_JSON_DESC]["match_list"] for o, s in zip(orders, match_list): lineid_list = s[0] # [s1[0] for s1 in s] wvl = wvl_thar[lineid_list] wvl_list[o] = wvl x = [s1[0] for s1 in s[1]] pixel_list[o] = x xy1f, nan_mask = echel.get_xy_list_filtered(wvl_list) xy2f = ap.get_xy_list(pixel_list, nan_mask) from libs.align_echellogram_thar import fit_affine_clip affine_tr, mm = fit_affine_clip(xy1f, xy2f) r = PipelineProducts("ThAr aligned echellogram products") r.add(THAR_ALIGNED_JSON_DESC, PipelineDict(xy1f=xy1f, xy2f=xy2f, affine_tr=affine_tr, affine_tr_mask=mm)) return r
def __init__(self): fn = get_master_calib_abspath("telluric/LBL_A15_s0_w050_R0060000_T.fits") self.telluric = pyfits.open(fn)[1].data self.trans = self.telluric["trans"] self.wvl = self.telluric["lam"]