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

SCM Repository

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

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

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

revision 4482, Thu Sep 1 20:43:01 2016 UTC revision 4483, Fri Sep 2 05:07:01 2016 UTC
# Line 21  Line 21 
21  # results from testing  # results from testing
22  def analyze(names, x, extraname, cnt, rtn, observed_data, correct_data, branch):  def analyze(names, x, extraname, cnt, rtn, observed_data, correct_data, branch):
23      (rtn_1, rst_good_1, rst_eh_1, rst_check_1, rst_terrible_1, rst_compile_1, rst_NA_1) =  rtn      (rtn_1, rst_good_1, rst_eh_1, rst_check_1, rst_terrible_1, rst_compile_1, rst_NA_1) =  rtn
24      print "X", x      #print "X", x
25      x = ("\n\t\t-"+x+" "+rtn_1)      x = ("\n\t\t-"+x+" "+rtn_1)
26      writeall(x)      writeall(x)
27      print (x)      #print (x)
28      # collect results      # collect results
29      counter.inc_locals(cnt, rtn)      counter.inc_locals(cnt, rtn)
30      counter.inc_cumulative(cnt)      counter.inc_cumulative(cnt)
# Line 59  Line 59 
59      t_nrrdbranch = frame.transform_nrrdpath(testing_frame)      t_nrrdbranch = frame.transform_nrrdpath(testing_frame)
60      t_runtimepath = frame.transform_runtimepath(testing_frame)      t_runtimepath = frame.transform_runtimepath(testing_frame)
61    
62      print "*******************************************"      #print "*******************************************"
63      x = "_"+(apply.get_all_FieldTys(app)+" |"+names)      x = "_"+(apply.get_all_FieldTys(app)+" |"+names)
64      print x      #print x
65      extraname = "\n\t-"+app.name      extraname = "\n\t-"+app.name
66    
67      # testing positions      # testing positions
# Line 73  Line 73 
73      #print "about to write program"      #print "about to write program"
74      writeDiderot(g_p_Observ, app, positions, g_output, t_runtimepath, t_isNrrd)      writeDiderot(g_p_Observ, app, positions, g_output, t_runtimepath, t_isNrrd)
75      #read observed data      #read observed data
76      print "about to observe"      #print "about to observe"
77      observed_data = observed(app, g_output)      observed_data = observed(app, g_output)
78      print observed_data      #print observed_data
79    
80      if (len(observed_data)<1):      if (len(observed_data)<1):
81          rtn1 = "diderot could not handle program"          rtn1 = "diderot could not handle program"
82          print "thinks could not handle program"          #print "thinks could not handle program"
83          return rst_compile(names, x, extraname, cnt)          return rst_compile(names, x, extraname, cnt)
84      else:      else:
85          if(check(app, observed_data)):          if(check(app, observed_data)):
86              correct_data = eval(app , positions)              correct_data = eval(app , positions)
87              print "correct data", correct_data              #print "correct data", correct_data
88              rtn = compare(app, observed_data, correct_data)              rtn = compare(app, observed_data, correct_data)
89              return analyze(names, x, extraname, cnt, rtn, observed_data, correct_data, g_branch)              return analyze(names, x, extraname, cnt, rtn, observed_data, correct_data, g_branch)
90          else:          else:
# Line 104  Line 104 
104      g_coeff_style = frame.get_coeff_style(testing_frame) # global variable from set      g_coeff_style = frame.get_coeff_style(testing_frame) # global variable from set
105      g_rst_ty = frame.get_rst_ty(testing_frame)      g_rst_ty = frame.get_rst_ty(testing_frame)
106      g_krn = frame.get_krn(testing_frame)      g_krn = frame.get_krn(testing_frame)
107      print "single specific ex"      #print "single specific ex"
108      (name,opr,ishape)= get_single_example(opr_inner, t_num, g_rst_ty)      (name,opr,ishape)= get_single_example(opr_inner, t_num, g_rst_ty)
109      # get k value of tshape from kernels      # get k value of tshape from kernels
110      set_ks(g_krn, ishape)      set_ks(g_krn, ishape)
111      print "calling tshape"      #print "calling tshape"
112      (tf1, tshape1) = get_tshape(opr_inner,ishape)      (tf1, tshape1) = get_tshape(opr_inner,ishape)
113      if(not tf1):      if(not tf1):
114          write_terrible("\n apply blocked from attempting: "+"b__"+name+str(opr_inner.id)+"_"+str(t_num))          write_terrible("\n apply blocked from attempting: "+"b__"+name+str(opr_inner.id)+"_"+str(t_num))
115          return None          return None
116      print "after calling tshape"      #print "after calling tshape"
117      #create app object      #create app object
118    
119      (app, coeffs, _) = mkApply_fld(name, opr, ishape, g_inputfile, tshape1, g_coeff_style, g_ucoeff, g_krn)      (app, coeffs, _) = mkApply_fld(name, opr, ishape, g_inputfile, tshape1, g_coeff_style, g_ucoeff, g_krn)
120    
121      dimF = tshape1.dim      dimF = tshape1.dim
122      print  "creating app"      # print  "creating app"
123      print "app oty", app.oty      #print "app oty", app.oty
124      # main      # main
125      names= "s_"+str(opr_inner.id)+"__"+"n_"+str(t_num)+"_"      names= "s_"+str(opr_inner.id)+"__"+"n_"+str(t_num)+"_"
126      return (app, coeffs, dimF, names)      return (app, coeffs, dimF, names)
# Line 128  Line 128 
128  # checks to see if specific ex works  # checks to see if specific ex works
129  def create_embed_app_passed(ishape, tshape1, tshape2, opr_inner, opr_outer, title, testing_frame, cnt):  def create_embed_app_passed(ishape, tshape1, tshape2, opr_inner, opr_outer, title, testing_frame, cnt):
130      # break      # break
131      #x = "\n("+ishape[0].name+" "+opr_inner.name+" "+ishape[1].name+") "+opr_outer.name+" "+ishape[2].name      #y = Title_outer(opr_inner, opr_outer)
132        #x = "\n -- shapes:"
133        #for i in ishape:
134        #    x+=i.name+","
135      #writeall(x)      #writeall(x)
136      #print(x)      #print(x)
137      counter.inc_cumulative(cnt)      #counter.inc_cumulative(cnt)
138      counter.inc_cnt(cnt)      #counter.inc_cnt(cnt)
139      writeResults_outer(opr_inner, opr_outer, testing_frame, cnt)      #write_results(y, testing_frame, cnt)
140      return      #return
141    
142      # global variables needed from testing framework      # global variables needed from testing framework
143      g_inputfile = frame.get_inputfile(testing_frame)      g_inputfile = frame.get_inputfile(testing_frame)
# Line 144  Line 147 
147    
148      # if it works continue      # if it works continue
149      #create app object      #create app object
150      print "opr_outer", opr_outer.name      #print "opr_outer", opr_outer.name
151      print "tshape2", tshape2.name      #print "tshape2", tshape2.name
152      appname  = opr_outer.name+"("+opr_inner.name+")"      appname  = opr_outer.name+"("+opr_inner.name+")"
153    
154      (app, coeffs) = mkApply_twice(appname, opr_inner,opr_outer, ishape, g_inputfile, tshape1, tshape2, g_coeff_style, g_ucoeff, g_krn)      (app, coeffs) = mkApply_twice(appname, opr_inner,opr_outer, ishape, g_inputfile, tshape1, tshape2, g_coeff_style, g_ucoeff, g_krn)
155      dimF = tshape2.dim      dimF = tshape2.dim
156      # main part      # main part
157      print title      #print title
158      #return (app, coeffs, dimF, title)      #return (app, coeffs, dimF, title)
159      return core(app, coeffs, dimF, title, testing_frame, cnt)      return core(app, coeffs, dimF, title, testing_frame, cnt)
160    
# Line 161  Line 164 
164    
165  # checks to see if specific ex works  # checks to see if specific ex works
166  def create_embed_app(name, ishape0, opr_inner, opr_outer, fty, title, testing_frame, cnt):  def create_embed_app(name, ishape0, opr_inner, opr_outer, fty, title, testing_frame, cnt):
167      print "current embed inner: "+opr_inner.name+"("+str(opr_inner.id)+") outer: " +opr_outer.name+"("+str(opr_outer.id)+")#"      #print "current embed inner: "+opr_inner.name+"("+str(opr_inner.id)+") outer: " +opr_outer.name+"("+str(opr_outer.id)+")#"
168      # get value of k from kernels      # get value of k from kernels
169      ishape = ishape0+fty      ishape = ishape0+fty
170      # get value of k from kernels      # get value of k from kernels
# Line 169  Line 172 
172      # first layer      # first layer
173      # get result after applying operators      # get result after applying operators
174      (tf1, tshape1) = get_tshape(opr_inner,ishape)      (tf1, tshape1) = get_tshape(opr_inner,ishape)
175      print "tf1",tf1, tshape1      #print "tf1",tf1, tshape1
176      if(tf1==false):      if(tf1==false):
177          print "found false at tf1"          #print "found false at tf1"
178          #return None          #return None
179          print "found none after create embed app"          #print "found none after create embed app"
180          return          return
181      else:      else:
182          print "tshape1", tshape1.name          #print "tshape1", tshape1.name
183          #second layer, adds second field type          #second layer, adds second field type
184          (tf2, tshape2) = get_tshape(opr_outer,[tshape1]+fty)          (tf2, tshape2) = get_tshape(opr_outer,[tshape1]+fty)
185          print "tf2", tf2, tshape2          #print "tf2", tf2, tshape2
186    
187          if(tf2==true):# if it works continue          if(tf2==true):# if it works continue
188              #create app object              #create app object
# Line 197  Line 200 
200              return              return
201          else:          else:
202              # "\n\t\tskipped did not apply "+opr_outer.name+" to ("+str(tshape2)+","              # "\n\t\tskipped did not apply "+opr_outer.name+" to ("+str(tshape2)+","
203              print "tf2 found false at this point"              #print "tf2 found false at this point"
204              return              return
205    
206    

Legend:
Removed from v.4482  
changed lines
  Added in v.4483

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