Exemple #1
0
def process_band(utdate,
                 recipe_name,
                 band,
                 groupname,
                 obsids,
                 config,
                 interactive=True):

    # utdate, recipe_name, band, obsids, config = "20150525", "A0V", "H", [63, 64], "recipe.config"

    from igrins.libs.recipe_helper import RecipeHelper
    helper = RecipeHelper(config, utdate, recipe_name)
    caldb = helper.get_caldb()

    master_obsid = obsids[0]
    desc = "SPEC_FITS_FLATTENED"
    blaze_corrected = True
    src_filename = caldb.query_item_path((band, groupname), desc)

    if not os.path.exists(src_filename):
        desc = "SPEC_FITS"
        blaze_corrected = False
        src_filename = caldb.query_item_path((band, groupname), desc)

    out_filename = caldb.query_item_path((band, groupname),
                                         "SPEC_FITS_WAVELENGTH")

    from igrins.libs.master_calib import get_ref_data_path
    tell_file = get_ref_data_path(helper.config,
                                  band,
                                  kind="TELL_WVLSOL_MODEL")

    if not interactive:
        tgt_basename = helper.get_basename(band, groupname)
        figout_dir = helper._igr_path.get_section_filename_base(
            "QA_PATH", "", "tell_wvsol_" + tgt_basename)
        from igrins.libs.path_info import ensure_dir
        ensure_dir(figout_dir)
    else:
        figout_dir = None

    #print src_filename, out_filename, figout_dir, tell_file
    run(src_filename,
        out_filename,
        plot_dir=figout_dir,
        tell_file=tell_file,
        blaze_corrected=blaze_corrected)
Exemple #2
0
def process_band(utdate, recipe_name, band, 
                 groupname, obsids, config,
                 interactive=True):

    # utdate, recipe_name, band, obsids, config = "20150525", "A0V", "H", [63, 64], "recipe.config"

    from igrins.libs.recipe_helper import RecipeHelper
    helper = RecipeHelper(config, utdate, recipe_name)
    caldb = helper.get_caldb()

    master_obsid = obsids[0]
    desc = "SPEC_FITS_FLATTENED"
    blaze_corrected=True
    src_filename = caldb.query_item_path((band, groupname),
                                         desc)

    if not os.path.exists(src_filename):
        desc = "SPEC_FITS"
        blaze_corrected=False
        src_filename = caldb.query_item_path((band, groupname),
                                             desc)

    out_filename = caldb.query_item_path((band, groupname),
                                         "SPEC_FITS_WAVELENGTH")

    from igrins.libs.master_calib import get_ref_data_path
    tell_file = get_ref_data_path(helper.config, band,
                                  kind="TELL_WVLSOL_MODEL")

    if not interactive:
        tgt_basename = helper.get_basename(band, groupname)
        figout_dir = helper._igr_path.get_section_filename_base("QA_PATH",
                                                               "",
                                                               "tell_wvsol_"+tgt_basename)
        from igrins.libs.path_info import ensure_dir
        ensure_dir(figout_dir)
    else:
        figout_dir = None

    #print src_filename, out_filename, figout_dir, tell_file
    run(src_filename, out_filename,
        plot_dir=figout_dir, tell_file=tell_file,
        blaze_corrected=blaze_corrected)
Exemple #3
0
def process_band(utdate, recipe_name, band,
                 obsids, frametypes,
                 config, interactive=True):

    # utdate, recipe_name, band, obsids, config = "20150525", "A0V", "H", [63, 64], "recipe.config"

    from igrins.libs.recipe_helper import RecipeHelper
    helper = RecipeHelper(config, utdate, recipe_name)
    caldb = helper.get_caldb()

    from igrins.libs.load_fits import get_hdus, get_combined_image
    hdus = get_hdus(helper, band, obsids)

    a_and_b = dict()
    for frame, hdu in zip(frametypes, hdus):
        a_and_b.setdefault(frame.upper(), []).append(hdu)

    # print a_and_b.keys()

    a = get_combined_image(a_and_b["A"]) / len(a_and_b["A"])
    b = get_combined_image(a_and_b["B"]) / len(a_and_b["B"])

    sky_data_ = a+b - abs(a-b)

    
    from igrins.libs.get_destripe_mask import get_destripe_mask
    destripe_mask = get_destripe_mask(helper, band, obsids)

    from igrins.libs.image_combine import destripe_sky
    sky_data = destripe_sky(sky_data_, destripe_mask, subtract_bg=False)

    # from igrins.libs.destriper import destriper
    # sky_data = destriper.get_destriped(sky_data_)

    basename = helper.get_basename(band, obsids[0])
    store_output(caldb, basename, hdus[0], sky_data)