Example #1
0
def make_html(utdate, dirname, config_file="recipe.config"):

    from libs.igrins_config import IGRINSConfig
    config = IGRINSConfig(config_file)

    fn = config.get_value('RECIPE_LOG_PATH', utdate)
    from libs.recipes import load_recipe_list
    recipe_list = load_recipe_list(fn)
    #recipe_dict = make_recipe_dict(recipe_list)

    #spec_template = env.get_template('spec.html')

    sources = []
    for r, obsids, frametypes, desc in recipe_list:
        if r in [
                "A0V_AB",
                "STELLAR_AB",
                "EXTENDED_AB",
                "EXTENDED_ONOFF",
        ]:
            s = dict(
                zip([
                    "name", "obj", "grp1", "grp2", "exptime", "recipe",
                    "obsids", "frametypes"
                ], desc))
            #s["obsids"] = s["obsids"].strip()
            s["nexp"] = len(obsids)

            for band in "HK":
                p = "igrins_spec_%04d_%s.html" % (obsids[0], band)
                if os.path.exists(os.path.join(dirname, p)):
                    s["url_%s" % band] = p

            for band in "HK":
                p = "igrins_spec_%04dA0V_%s.html" % (obsids[0], band)
                if os.path.exists(os.path.join(dirname, p)):
                    s["url_%s_A0V" % band] = p

            sources.append(s)

            # jsname = "igrins_spec_%04d_H.js" % obsids[0]
            # ss = spec_template.render(utdate=utdate, jsname=jsname)
            # open(os.path.join(dirname, s["url_H"]), "w").write(ss)

            # jsname = "igrins_spec_%04d_K.js" % obsids[0]
            # ss = spec_template.render(utdate=utdate, jsname=jsname)
            # open(os.path.join(dirname, s["url_K"]), "w").write(ss)

    return sources
Example #2
0
def make_html(utdate, dirname, config_file="recipe.config"):

    from libs.igrins_config import IGRINSConfig
    config = IGRINSConfig(config_file)

    fn = config.get_value('RECIPE_LOG_PATH', utdate)
    from libs.recipes import load_recipe_list
    recipe_list = load_recipe_list(fn)
    #recipe_dict = make_recipe_dict(recipe_list)

    #spec_template = env.get_template('spec.html')

    sources = []
    for r, obsids, frametypes, desc in recipe_list:
        if r in ["A0V_AB", "STELLAR_AB",
                 "EXTENDED_AB",
                 "EXTENDED_ONOFF",
                 ]:
            s = dict(zip(["name", "obj", "grp1", "grp2", "exptime", "recipe", "obsids", "frametypes"],
                         desc))
            #s["obsids"] = s["obsids"].strip()
            s["nexp"] = len(obsids)

            for band in "HK":
                p = "igrins_spec_%04d_%s.html" % (obsids[0], band)
                if os.path.exists(os.path.join(dirname, p)):
                    s["url_%s" % band] = p

            for band in "HK":
                p = "igrins_spec_%04dA0V_%s.html" % (obsids[0], band)
                if os.path.exists(os.path.join(dirname, p)):
                    s["url_%s_A0V" % band] = p

            sources.append(s)

            # jsname = "igrins_spec_%04d_H.js" % obsids[0]
            # ss = spec_template.render(utdate=utdate, jsname=jsname)
            # open(os.path.join(dirname, s["url_H"]), "w").write(ss)

            # jsname = "igrins_spec_%04d_K.js" % obsids[0]
            # ss = spec_template.render(utdate=utdate, jsname=jsname)
            # open(os.path.join(dirname, s["url_K"]), "w").write(ss)

    return sources
Example #3
0
if 1:
    band = "K"

    utdate, obsid = "20140524", 45 # Serpens 15
    utdate, obsid = "20140526", 158 # Serpens 2
    utdate, obsid = "20140526", 104 # GSS 30
    utdate, obsid = "20140707", 149 # S140 N3
    utdate, obsid = "20140707", 161 # S140 N13

    igr_path = IGRINSPath(utdate)

    igrins_files = IGRINSFiles(igr_path)

    fn = "%s.recipes" % utdate
    recipe_list = load_recipe_list(fn)
    recipe_dict = make_recipe_dict(recipe_list)

    abba = [rd[-1] for rd in recipe_dict["STELLAR_AB"] if obsid in rd[0]]

    objname = abba[-1][0]
    #obsids = abba[0]
    #frametypes = abba[1]


    obj_filenames = igrins_files.get_filenames(band, [obsid])
    obj_path = ProductPath(igr_path, obj_filenames[0])
    obj_master_obsid = obsid

    fn = obj_path.get_secondary_path("spec.fits")
    s_list = list(pyfits.open(fn)[0].data)
Example #4
0
if 1:
    band = "K"

    utdate, obsid = "20140524", 45  # Serpens 15
    utdate, obsid = "20140526", 158  # Serpens 2
    utdate, obsid = "20140526", 104  # GSS 30
    utdate, obsid = "20140707", 149  # S140 N3
    utdate, obsid = "20140707", 161  # S140 N13

    igr_path = IGRINSPath(utdate)

    igrins_files = IGRINSFiles(igr_path)

    fn = "%s.recipes" % utdate
    recipe_list = load_recipe_list(fn)
    recipe_dict = make_recipe_dict(recipe_list)

    abba = [rd[-1] for rd in recipe_dict["STELLAR_AB"] if obsid in rd[0]]

    objname = abba[-1][0]
    #obsids = abba[0]
    #frametypes = abba[1]

    obj_filenames = igrins_files.get_filenames(band, [obsid])
    obj_path = ProductPath(igr_path, obj_filenames[0])
    obj_master_obsid = obsid

    fn = obj_path.get_secondary_path("spec.fits")
    s_list = list(pyfits.open(fn)[0].data)