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

SCM Repository

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

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

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

revision 4307, Fri Jul 29 19:29:48 2016 UTC revision 4308, Fri Jul 29 20:53:07 2016 UTC
# Line 64  Line 64 
64      global rst_cumulative      global rst_cumulative
65      x = ("\n\t-"+rtn_1+" "+x)      x = ("\n\t-"+rtn_1+" "+x)
66      writeall(x)      writeall(x)
67        print (x)
68      if (rst_compile_1==1):      if (rst_compile_1==1):
69          rst_compile += 1          rst_compile += 1
70          writeToRst(pre+"c__"+names, observed_data, correct_data, branch, x)          writeToRst(pre+"c__"+names, observed_data, correct_data, branch, x)
# Line 88  Line 88 
88  def central(app, coeffs, dimF, names):  def central(app, coeffs, dimF, names):
89      #print "############################################inside central############################################"      #print "############################################inside central############################################"
90      writetys("\n\t-"+apply.get_all_FieldTys(app)+"|"+  names)      writetys("\n\t-"+apply.get_all_FieldTys(app)+"|"+  names)
91        print "pre-core"
92      (rtn, x, observed_data, correct_data) = core(app, coeffs, dimF, names, runtimepath, isVis15)      (rtn, x, observed_data, correct_data) = core(app, coeffs, dimF, names, runtimepath, isVis15)
93      # add to global results      # add to global results
94      pre = ""      pre = ""
# Line 118  Line 119 
119  # functions create app objects  # functions create app objects
120  # get example from list of examples  # get example from list of examples
121  def create_single_app(opr_inner, t_num):  def create_single_app(opr_inner, t_num):
122      #print "single specific ex"      print "single specific ex"
123      (name,opr,ishape)= get_single_example(opr_inner, t_num)      (name,opr,ishape)= get_single_example(opr_inner, t_num)
124        print "callign tshape"
125      (tf1, tshape1) = get_tshape(opr_inner,ishape)      (tf1, tshape1) = get_tshape(opr_inner,ishape)
126        if(not tf1):
127            raise Exception (tshape1)
128        print "after calling tshape"
129      #create app object      #create app object
130      (app, coeffs, dimF,_) = mkApply_fld(name, opr, ishape, inputfile, tshape1)      (app, coeffs, dimF,_) = mkApply_fld(name, opr, ishape, inputfile, tshape1)
131        print  "creating app"
132        print "app oty", app.oty
133      # main      # main
134      names= "s_"+str(opr_inner.name)+"__"+"("+str(t_num)+")"      names= "s_"+str(opr_inner.id)+"__"+"n_"+str(t_num)+"_"
135      return (app, coeffs, dimF, names)      return (app, coeffs, dimF, names)
136    
137  # checks to see if specific ex works  # checks to see if specific ex works
# Line 164  Line 170 
170      rst_total+= 1      rst_total+= 1
171      # main      # main
172      (app, coeffs, dimF, names) = create_single_app(opr_inner, t_num)      (app, coeffs, dimF, names) = create_single_app(opr_inner, t_num)
173        print "names",names
174      return central(app, coeffs, dimF, names)      return central(app, coeffs, dimF, names)
175    
176    def get_all_types():
177        if(args_types==0):
178            return l_all_F
179        elif(args_types==1):
180            return l_all_T
181        else:
182            raise "error"
183    
184    def get_extra(ex_ty2):
185        l = get_all_types()
186        return (len(l), l[ex_ty2])
187    
188    
189  def embed_base_specific_ex(opr_inner, opr_outer, t_num, t_ty2):  def embed_base_specific_ex(opr_inner, opr_outer, t_num, t_ty2):
190      global rst_total      global rst_total
191      rst_total+= 1      rst_total+= 1
# Line 174  Line 194 
194      print "inner", opr_inner.id, "outer", opr_outer.id, "t-num", t_num      print "inner", opr_inner.id, "outer", opr_outer.id, "t-num", t_num
195      def get_fty(ex_ty2):      def get_fty(ex_ty2):
196          if(needextratype(opr_inner, opr_outer)):          if(needextratype(opr_inner, opr_outer)):
197              x = l_all_F[ex_ty2]              (_, x) = get_extra(ex_ty2)
198              print "gets extra type @", ex_ty2, x.name              print "gets extra type @", ex_ty2, x.name
199              return [l_all_F[ex_ty2]]              return [x]
200          else:          else:
201              return []              return []
202      rtn = create_embed_app(opr_inner, opr_outer, t_num, get_fty(t_ty2))      rtn = create_embed_app(opr_inner, opr_outer, t_num, get_fty(t_ty2))
# Line 249  Line 269 
269      n_num = len(ex_outer.tys)      n_num = len(ex_outer.tys)
270      print(" "+str(opr_inner.name)+"-"+str(opr_outer.name)+" tys length:" +str(n_num))      print(" "+str(opr_inner.name)+"-"+str(opr_outer.name)+" tys length:" +str(n_num))
271      if(needextratype(opr_inner, opr_outer)):      if(needextratype(opr_inner, opr_outer)):
272          n_ty2 = len(l_all_F) # use all field types as extra types          (n_ty2, _) = get_extra(0)  # use all field types as extra types
273    
274          for t_ty2 in range(n_ty2):  #extra type          for t_ty2 in range(n_ty2):  #extra type
275              print "as extra type using ", t_ty2              print "as extra type using ", t_ty2
276              iter_num(opr_inner, opr_outer, n_num, t_ty2)              iter_num(opr_inner, opr_outer, n_num, t_ty2)
# Line 281  Line 302 
302          opr_outer = id_toOpr(t_outer)          opr_outer = id_toOpr(t_outer)
303          writeTitle_outer(opr_inner, opr_outer)          writeTitle_outer(opr_inner, opr_outer)
304          if(needextratype(opr_inner, opr_outer)):          if(needextratype(opr_inner, opr_outer)):
305              n_ty2 = len(l_all_F) # use all field types as extra types              # use all field types as extra types
306                (n_ty2, _) = get_extra(ex_ty2)
307              for t_ty2 in range(n_ty2):  #extra type              for t_ty2 in range(n_ty2):  #extra type
308                  embed_base_specific_ex(opr_inner, opr_outer, t_num, t_ty2)                  embed_base_specific_ex(opr_inner, opr_outer, t_num, t_ty2)
309          else:          else:
# Line 293  Line 315 
315      ex_outer = oprToEx(opr_inner)      ex_outer = oprToEx(opr_inner)
316    
317      if(needextratype(opr_inner, opr_outer)):      if(needextratype(opr_inner, opr_outer)):
318            # use all field types as extra types
319          n_ty2 = len(l_all_F) # use all field types as extra types          (n_ty2, _) = get_extra(ex_ty2)
   
320          for t_ty2 in range(n_ty2):  #extra type          for t_ty2 in range(n_ty2):  #extra type
321    
322              print "as extra type using ", t_ty2              print "as extra type using ", t_ty2
# Line 404  Line 425 
425          writeTitle_inner(opr_inner)          writeTitle_inner(opr_inner)
426          single_all_ops(opr_inner)          single_all_ops(opr_inner)
427          writeResults_inner(opr_inner)          writeResults_inner(opr_inner)
428        elif (args==2):
429            t_inner= int(sys.argv[3])
430            opr_inner = id_toOpr(t_inner)
431            t_num= int(sys.argv[4])
432            single_specific_ex(opr_inner,t_num)
433            writeResults_inner(opr_inner)
434  elif (layer==2):  elif (layer==2):
435      if(args==0):      if(args==0):
436          #run all the programs          #run all the programs

Legend:
Removed from v.4307  
changed lines
  Added in v.4308

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