Beispiel #1
0
def generate_vis_index(vis_files,base_dir):
    template = get_template("index")
    # For each vis file, generate link to it
    visci_select = ""
    for vis_file in vis_files:
        relative_path = vis_file.replace(base_dir,"")
        if relative_path[0] == "/":
            relative_path = relative_path[1:]  
        visci_select = '\n%s<option value="%s">%s</option>' %(visci_select,relative_path,relative_path)
    substitutions = {"VISCI_SELECT":visci_select,
                     "VISUALIZATION_ONE":relative_path}
    template = sub_template(template,substitutions)
    save_render(template,"%s/index.html" %base_dir)
Beispiel #2
0
def generate_vis_index(vis_files, base_dir):
    template = get_template("index")
    # For each vis file, generate link to it
    visci_select = ""
    for vis_file in vis_files:
        relative_path = vis_file.replace(base_dir, "")
        if relative_path[0] == "/":
            relative_path = relative_path[1:]
        visci_select = '\n%s<option value="%s">%s</option>' % (
            visci_select, relative_path, relative_path)
    substitutions = {
        "VISCI_SELECT": visci_select,
        "VISUALIZATION_ONE": relative_path
    }
    template = sub_template(template, substitutions)
    save_render(template, "%s/index.html" % base_dir)
Beispiel #3
0
def generate_vis(template_file,data_files,output_folder):
    # We will save a list of the output files
    visualization_files = []
    template = read_template(template_file)  
    for data_file in data_files:
        try:
            relative_path = data_file.replace(output_folder,"") 
            if relative_path[0] == "/":
                relative_path = relative_path[1:]  
            filename = os.path.basename(data_file).split(".")[0]
            sub = sub_template(template,{"DATA":relative_path})
            vis_file = "%s/%s.html" %(output_folder,filename)
            save_render(sub,vis_file)
            visualization_files.append(vis_file)
        except:
            print "Error with file %s. Skipping." %(data_file)

    return visualization_files
Beispiel #4
0
def generate_vis(template_file, data_files, output_folder):
    # We will save a list of the output files
    visualization_files = []
    template = read_template(template_file)
    for data_file in data_files:
        try:
            relative_path = data_file.replace(output_folder, "")
            if relative_path[0] == "/":
                relative_path = relative_path[1:]
            filename = os.path.basename(data_file).split(".")[0]
            sub = sub_template(template, {"DATA": relative_path})
            vis_file = "%s/%s.html" % (output_folder, filename)
            save_render(sub, vis_file)
            visualization_files.append(vis_file)
        except:
            print "Error with file %s. Skipping." % (data_file)

    return visualization_files