Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/ein16/synth/d2/write.py
ViewVC logotype

View of /branches/ein16/synth/d2/write.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4456 - (download) (as text) (annotate)
Thu Aug 25 04:03:27 2016 UTC (2 years, 8 months ago) by cchiw
File size: 2663 byte(s)
added missing cubic
import sys
import re
import os


fld="stash"  #directory to save programs

##################################################################################################
def Title_inner(opr_inner):
    return "\n\n"+" "+opr_inner.name+"_ * |"+str(opr_inner.id)+"_ *"

def Title_outer(opr_inner, opr_outer):
    return "\n "+opr_outer.name+ "_"+ opr_inner.name+" |"+str(opr_inner.id)+"_"+str(opr_outer.id)

def Title_outer2(opr_outer):
    return "\n"+ "* _"+ opr_outer.name+" |* _"+str(opr_outer.id)+"\n"

def Title_num(opr_inner, opr_outer):
    return "\n"+opr_outer.name+ "_"+ opr_inner.name+" |"+str(opr_inner.id)+"_"+str(opr_outer.id)

def write(e):
    print (e)
def writeall(e):
    #print (e)
    # if it works continue
    f = open(fld+"/results_final.txt", 'a+')
    f.write(e)
    f.close()
def writesummary(e):
    #print (e)
    # if it works continue
    f = open(fld+"/results_summary.txt", 'a+')
    f.write(e)
    f.close()

def writetys(e):
    #print (e)
    # if it works continue
    f = open(fld+"/results_ty.txt", 'a+')
    f.write(e)
    f.close()

def writeex(e):
    print (e)
    # if it works continue
    f = open(fld+"/results_ex.txt", 'a+')
    f.write(e)
    f.close()

def write_outer(e):
    print (e)
    # if it works continue
    f = open(fld+"/results_outer.txt", 'a+')
    f.write(e)
    f.close()

def write_terrible(e):
    print (e)
    # if it works continue
    f = open(fld+"/results_terrible.txt", 'a+')
    f.write(e)
    f.close()


def writeTitle_inner(opr_inner):
    y = Title_inner(opr_inner)
    writetys(y)
    writeall(y)

def writeTitle_outer2(opr_outer):
    y = Title_outer2(opr_outer)
    writetys(y)
    writeall(y)


def writeTitle_outer(opr_inner, opr_outer):
    y = Title_outer(opr_inner, opr_outer)
    writetys("\n"+y)
    writeall(y)




# copy programs and corresponding file to new directory
def writeToRst(names, observed_data, correct_data, branch, rst):

    path = fld+"/"+names
    os.system("mkdir "+path)
    os.system("cp data/output5_p_observ.diderot "+path+"/"+names+".diderot")
    os.system("cp output5_p_observ.diderot "+path+"/"+names+".diderot")
    os.system("cp data/inputfile_0.nrrd "+path+"/inputfile_0.nrrd")
    os.system("cp data/inputfile_1.nrrd "+path+"/inputfile_1.nrrd")
    #os.system("cp data/inputfilecat_2.nrrd "+path+"/inputfilecat_2.nrrd")
    os.system("cp data/inputfile_2.nrrd "+path+"/inputfile_2.nrrd")
    a= names
    b= "\n\nobserved data from "+branch+" "+str(observed_data)
    # correct values from python
    c= "\n\ncorrect data from python"+str(correct_data)
   
    f = open(path+"/rst.txt", 'w+')
    f.write(a+b+c+rst+"\n\n")
    f.close()


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0