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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4456, Thu Aug 25 04:03:27 2016 UTC revision 4457, Fri Aug 26 19:57:49 2016 UTC
# Line 2  Line 2 
2  import re  import re
3  import os  import os
4    
5    from obj_counter import *
6    from obj_frame import  *
7    
8  fld="stash"  #directory to save programs  fld="stash"  #directory to save programs
9    
# Line 17  Line 19 
19    
20  def Title_num(opr_inner, opr_outer):  def Title_num(opr_inner, opr_outer):
21      return "\n"+opr_outer.name+ "_"+ opr_inner.name+" |"+str(opr_inner.id)+"_"+str(opr_outer.id)      return "\n"+opr_outer.name+ "_"+ opr_inner.name+" |"+str(opr_inner.id)+"_"+str(opr_outer.id)
   
22  def write(e):  def write(e):
23      print (e)      print (e)
24  def writeall(e):  def writeall(e):
# Line 80  Line 81 
81    
82    
83    
84    def writeCumulative(cnt):
85        # get cumulative breakdown
86        x = counter.writeCumulativeS(cnt)
87        print (x)
88        writeall(x)
89        writesummary(x)
90    
91    
92    def write_results(pre, testing_frame, cnt):
93        # global variables needed from testing framework
94        g_branch = frame.get_branch(testing_frame)
95        x= "\n"
96        x+= pre+"- "+g_branch
97        x+=  counter.writeLocal(cnt)
98        x+="\n***************************************************\n"
99        writeall(x)
100        writesummary(x)
101    
102    
103    def writeResults_inner(opr_inner, testing_frame, cnt):
104        y = Title_inner(opr_inner)
105        write_results(y, testing_frame, cnt)
106        writeCumulative(cnt)
107    
108    def writeResults_outer(opr_inner, opr_outer, testing_frame, cnt):
109        y = Title_outer(opr_inner, opr_outer)
110        write_results(y, testing_frame, cnt)
111        writeCumulative(cnt)
112    ## starts with writing heading in each txt file
113    def write_heading(testing_frame):
114        name = "\n-name: "+frame.get_name(testing_frame)
115        runtimepath = "\n-runtimepath: "+ frame.transform_runtimepath(testing_frame)
116        coeff_style = "\n-coeff: "+frame.get_coeff_style(testing_frame)
117        samples = "\n-samples: "+str(frame.get_samples(testing_frame))
118        branch = "\n-branch: "+frame.get_branch(testing_frame)
119        revision = "\n-revision: "+frame.get_revision(testing_frame)
120        precision = "\n-precision:"+frame.get_precision(testing_frame)
121        num_pos = "\n-number of positions:"+str(frame.get_num_pos(testing_frame))
122        r = "\n\n----- Testing framework -----"+name+coeff_style+(samples)+ num_pos+branch+ precision+revision+runtimepath+"\n"
123        writeall(r)
124        writesummary(r)
125        write_terrible(r)
126    
127    
128    
129  # copy programs and corresponding file to new directory  # copy programs and corresponding file to new directory
130  def writeToRst(names, observed_data, correct_data, branch, rst):  def writeToRst(names, observed_data, correct_data, branch, rst):
   
131      path = fld+"/"+names      path = fld+"/"+names
132      os.system("mkdir "+path)      os.system("mkdir "+path)
133      os.system("cp data/output5_p_observ.diderot "+path+"/"+names+".diderot")      os.system("cp data/output5_p_observ.diderot "+path+"/"+names+".diderot")
# Line 101  Line 145 
145      f.write(a+b+c+rst+"\n\n")      f.write(a+b+c+rst+"\n\n")
146      f.close()      f.close()
147    
148    
149    
150    def write_rst(names, x, extraname, phrase):
151        x = "\n\t-"+x+"\n\t"+phrase
152        m = "\n\n***"+ phrase+"__"+name +"\n\t -: " + extraname+x
153        writeall(x)
154        writesummary(x)
155        write_terrible(m)
156        print (x)
157        return
158    
159    
160    
161    # does not compile
162    def rst_compile(names, x, extraname,  branch):
163        dir = "c"
164        write_rst(names, x, extraname, "did not compile", dir)
165        labl = dir+"__"+name
166    #writeToRst(labl, None, None, branch, x)
167    
168    # not available
169    def rst_NA(names, x, extraname, branch):
170        dir = "na"
171        labl = dir+"__"+name
172        write_rst(names, x, extraname, "NA", dir)
173    #writeToRst(labl, None, None, branch, x)
174    
175    # check results
176    def rst_check(names, x, extraname, branch, observed_data, correct_data):
177        dir = "k"
178        labl = dir+"__"+name
179        write_rst(names, x, extraname, "check", dir)
180        #writeToRst(labl, observed_data, correct_data, branch, x)
181    def rst_terrible(names, x, extraname,  branch, observed_data, correct_data) :
182        dir = "t"
183        labl = dir+"__"+name
184        write_rst(names, x, extraname, "terrible", dir)
185        #writeToRst(labl, observed_data, correct_data, branch, x
186    

Legend:
Removed from v.4456  
changed lines
  Added in v.4457

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