Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
def transform_wavelength_solutions(obsset):

    # load affine transform

    # As register.db has not been written yet, we cannot use
    # obsset.get("orders")
    orders = obsset.load_item("ORDERS_JSON")["orders"]

    d = obsset.load_item("ALIGNING_MATRIX_JSON")

    affine_tr_matrix = d["affine_tr_matrix"]

    # load echellogram
    from master_calib import load_ref_data
    echellogram_data = obsset.load_ref_data(kind="ECHELLOGRAM_JSON")

    from echellogram import Echellogram
    echellogram = Echellogram.from_dict(echellogram_data)

    wvl_sol = get_wavelength_solutions(affine_tr_matrix, echellogram.zdata,
                                       orders)

    obsset.store_dict(item_type="WVLSOL_V0_JSON",
                      data=dict(orders=orders, wvl_sol=wvl_sol))

    return wvl_sol
Ejemplo n.º 3
0
    r = pickle.load(open("flat_info_%s_%s.pickle" % (igrins_log.date, band)))
    r2 = pickle.load(open("thar_%s_%s.pickle" % (igrins_log.date, band)))

    bpix_mask = r["flat_bpix_mask"]
    trace_sol = r["bottomup_solutions"]

    from apertures import Apertures
    apertures = Apertures(igrins_orders[band],
                          trace_sol)


    # load echellogram data
    from echellogram import Echellogram
    echel_name = "fitted_echellogram_sky_%s_%s.json" % (band, thar_init["ref_date"])
    echel = Echellogram.from_json_fitted_echellogram_sky(echel_name)


    th = np.genfromtxt("ThArlines.dat")
    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 = {}
    for o, s in zip(igrins_orders[band], thar_init["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
Ejemplo n.º 4
0
    igrins_orders["K"] = range(72, 94)

    r = pickle.load(open("flat_info_%s_%s.pickle" % (igrins_log.date, band)))
    r2 = pickle.load(open("thar_%s_%s.pickle" % (igrins_log.date, band)))

    bpix_mask = r["flat_bpix_mask"]
    trace_sol = r["bottomup_solutions"]

    from apertures import Apertures
    apertures = Apertures(igrins_orders[band], trace_sol)

    # load echellogram data
    from echellogram import Echellogram
    echel_name = "fitted_echellogram_sky_%s_%s.json" % (band,
                                                        thar_init["ref_date"])
    echel = Echellogram.from_json_fitted_echellogram_sky(echel_name)

    th = np.genfromtxt("ThArlines.dat")
    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 = {}
    for o, s in zip(igrins_orders[band], thar_init["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