def save(self, fn): d = dict(orders=self.orders, wvl_list=[], x_list=[], y_list=[]) for o in self.orders: zd = self.zdata[o] d["wvl_list"].append(zd.wvl) d["x_list"].append(zd.x) d["y_list"].append(zd.y) from libs.json_helper import json_dump json_dump(d, open(fn, "w"))
def publish_html(utdate, config_file="recipe.config"): # utdate = "20140713" from libs.igrins_config import IGRINSConfig config = IGRINSConfig(config_file) dirname = config.get_value("HTML_PATH", utdate) from jinja2 import Environment, FileSystemLoader env = Environment(loader=FileSystemLoader("jinja_templates")) template = env.get_template("index.html") sources = make_html(utdate, dirname) from libs.json_helper import json_dump json_dump(dict(utdate=utdate, sources=sources), open(os.path.join(dirname, "summary.json"), "w")) s = template.render(utdate=utdate, sources=sources) open(os.path.join(dirname, "index.html"), "w").write(s)
_ = ddd(wvl, s, wvl_reference) ddd_list.append(_) d = dict(wvl_list=[], ref_indices_list=[], pixpos_list=[], orders=orders, ref_name=ref_name) for wvl, s, _ in zip(wvl_sol, s_list, ddd_list): wvl_reference_filtered, matched_indices, centroids = _ d["wvl_list"].append(wvl_reference_filtered) d["ref_indices_list"].append(matched_indices) d["pixpos_list"].append(centroids) from libs.json_helper import json_dump json_dump(d, open("%s_IGRINS_identified_%s_%s.json" % (REF_TYPE, band, utdate),"w")) for wvl, s, _ in zip(wvl_sol, s_list, ddd_list): wvl_reference_filtered, matched_indices, centroids = _ fig = figure() ax = fig.add_subplot(111) draw_one(wvl, s, wvl_reference_filtered, centroids, ax=ax) if 0: json.dump([[(s[0], list(s[1])) for s in ss] for ss, d in matched_list2], open("thar_identified_%s_%s.json" % (band, date),"w"))
def save(self, fn): from libs.json_helper import json_dump json_dump(self.data, open(fn,"w"))