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

SCM Repository

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

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

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

revision 3945, Thu Jun 9 20:00:15 2016 UTC revision 3946, Sat Jun 11 00:39:19 2016 UTC
# Line 46  Line 46 
46  # outSize-samples  # outSize-samples
47  # orig- name of synthetic field created with coefficients  # orig- name of synthetic field created with coefficients
48  def createSingleField(itype,outSize,orig,  coeff):  def createSingleField(itype,outSize,orig,  coeff):
49        #print "inside create singlefield: "+orig+" ty: "+itype.name,"coeff:",coeff
50      outputnrrd=orig+".nrrd"      outputnrrd=orig+".nrrd"
51      sout=str(outSize)      sout=str(outSize)
52      def get_Params():      def get_Params():
# Line 61  Line 62 
62              COEFF+=coeffToBase(cz0, "3_z0")+coeffToBase(cz1, "3_z1")+coeffToBase(cz2, "3_z2")              COEFF+=coeffToBase(cz0, "3_z0")+coeffToBase(cz1, "3_z1")+coeffToBase(cz2, "3_z2")
63              SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size              SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size
64              return COEFF + SIZE              return COEFF + SIZE
   
65          if(fty.get_dim(itype)==2):          if(fty.get_dim(itype)==2):
66              COEFF = coeffToBase(coeff, "")#convert coeff to strings              COEFF = coeffToBase(coeff, "")#convert coeff to strings
67              SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size              SIZE=" -sz0 "+ sout +" -sz1 "+ sout +" -width 1"    # giving sample size
68              return COEFF + SIZE              return COEFF + SIZE
69          elif(fty.get_dim(itype)==3):          elif(fty.get_dim(itype)==3):
70    
71              [z0,z1,z2]=coeff              [z0,z1,z2]=coeff
72              COEFF=coeffToBase(z0, "_z0")+coeffToBase(z1, "_z1")+coeffToBase(z2, "_z2")              COEFF=coeffToBase(z0, "_z0")+coeffToBase(z1, "_z1")+coeffToBase(z2, "_z2")
73              SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size              SIZE=" -sz0 "+ sout +" -sz1 "+ sout+" -sz2 "+ sout +" -width 1"    # giving sample size
# Line 89  Line 90 
90      os.system("rm "+e_Orig)      os.system("rm "+e_Orig)
91    
92  def createField(appC,outSize, coeffs):  def createField(appC,outSize, coeffs):
93      app = apply.get_root_app(appC)      #app = apply.get_all_Fields(appC)
94      itypes=apply.get_types(app)      #itypes = apply.get_types(app)
95      exps =  apply.get_exps(app)      #exps =  apply.get_exps(app)
96        flds = apply.get_all_Fields(appC)
97        itypes = []
98        exps = []
99        # print "fields-length", len(flds)
100        for j in range(len(flds)):
101            i = flds[j]
102            itypes.append(i.fldty)
103            #print "j:",j,"coeffs",coeffs[j],"itypes",itypes[j].name
104    
105        exps = flds
106      for (i,c,s)in zip(exps, coeffs,itypes):      for (i,c,s)in zip(exps, coeffs,itypes):
107            # print field.toStr(i)
108          if(field.get_isField(i)): # not a tensor type          if(field.get_isField(i)): # not a tensor type
109    
110              createSingleField(s,outSize,i.inputfile, c)              createSingleField(s,outSize,i.inputfile, c)

Legend:
Removed from v.3945  
changed lines
  Added in v.3946

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