/[gzz]/gzz/gfx/util/papersampler.py
ViewVC logotype

Diff of /gzz/gfx/util/papersampler.py

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

revision 1.22 by tjl, Tue Mar 4 15:44:38 2003 UTC revision 1.23 by jvk, Wed Mar 5 07:52:47 2003 UTC
# Line 43  import traceback Line 43  import traceback
43  xs = 1280  xs = 1280
44  ys = 960  ys = 960
45    
46  zoomLevels = [1.3, 2.4, 4]  zoomLevels = [1.6, 2.4, 4]
47    
48  class OptMill(gzz.gfx.gl.PaperMill):  class OptMill(gzz.gfx.gl.PaperMill):
49      def __init__(self, mill, opts):      def __init__(self, mill, opts):
# Line 57  class OptMill(gzz.gfx.gl.PaperMill): Line 57  class OptMill(gzz.gfx.gl.PaperMill):
57    
58  pureConds = [  pureConds = [
59      { "numcolors" : 8, "minlum" : 80 },      { "numcolors" : 8, "minlum" : 80 },
60      { "numcolors" : 8, "minlum" : 80, "blend" : 0.5 },  #    { "numcolors" : 8, "minlum" : 80, "blend" : 0.5 },
61      { "numcolors" : 1, "minlum" : 80 },      { "numcolors" : 1, "minlum" : 80 },
62      ]      ]
63    
# Line 125  def doFrame(scene, filename): Line 125  def doFrame(scene, filename):
125  def createPurePapers():  def createPurePapers():
126      # Create 90 textures for each condition      # Create 90 textures for each condition
127      # Each 30 are assigned to different conditions for different subjects      # Each 30 are assigned to different conditions for different subjects
128        old = 15
129        new = 15
130        
131        test = 1
132      for cond in range(0, len(pureConds)):      for cond in range(0, len(pureConds)):
133          opts = pureConds[cond]          opts = pureConds[cond]
134          for i in range(0,90):          for i in range(0,old + new):
135              seed = 12345 + i              seed = 12345 + i
136              doFrame(lambda vs: paperscene(vs, seed, opts),              doFrame(lambda vs: paperscene(vs, seed, opts),
137                          "tmp/tmp%s_%s.png" % (cond, i))                      "tmp/tmp_%s_%s" % (test, i))
138    
139            for subj in range(0, 10):
140                f = open("tmp/trials_%s_%s.txt" % (test, subj), "w")
141    
142                oldset = range(0, old)
143                rng.shuffle(oldset)
144    
145                newset = range(0, old + new)
146                rng.shuffle(newset)
147    
148                f.write("tmp/space.mipzip 0 0 Space\n"
149                        "Wait for space\n")
150                for i in range(0, len(oldset)):
151                    t = oldset[i]
152                    file = "tmp/tmp_%s_%02d.mipzip" % (test, t)
153                    f.write("%s 0 5000\nTexture %s\n" % (file, t))
154    
155                f.write("tmp/space.mipzip 0 0 Space\n"
156                        "Wait for space\n")
157    
158                for i in range(0, len(newset)):
159                    t = newset[i]
160                    file = "tmp/tmp_%s_%02d.mipzip" % (test, t)
161                    f.write("%s 100 0 0 Control_L Control_R\n"
162                            "Texture %s %s\n" % (file, t, t < old))
163    
164                f.close()
165    
166            test += 1
167    
168  def textPaperScene(vs, layout, scale):  def textPaperScene(vs, layout, scale):
169      scale *= .5      scale *= .5
# Line 167  def createTextPapers(): Line 200  def createTextPapers():
200          pageSpanCellView = gzz.view.PageSpanCellView()          pageSpanCellView = gzz.view.PageSpanCellView()
201          pageSpanCellView.pageSpanPaperMaker = PSPMaker()          pageSpanCellView.pageSpanPaperMaker = PSPMaker()
202    
203          f = open("tmp/trials%s_0.txt" % subj, "w")          test = 0
204            f = open("tmp/trials_%s_%s.txt" % (test, subj), "w")
205            f.write("tmp/space.mipzip 0 0 Space\n"
206                    "Wait for space\n")
207    
208          for trial in range(0, trials):          for trial in range(0, trials):
209              page = pages[pagenums[trial]]              page = pages[pagenums[trial]]
210              opts = conditions[trial]              opts = conditions[trial]
             l = 0  
211    
212              file = "tmp/tmp_%s_%s_%s"%(subj, trial, l)              file = "tmp/tmp_%s_%s_%02d" % (test, subj, trial)
213    
214    
215              sc = fontfilter2.Scene()              sc = fontfilter2.Scene()
# Line 200  def createTextPapers(): Line 235  def createTextPapers():
235                  doFrame(lambda vs: textPaperScene(vs, layout, zoom), file )                  doFrame(lambda vs: textPaperScene(vs, layout, zoom), file )
236    
237              f.write("tmp/star.mipzip 0 1000\n\n")              f.write("tmp/star.mipzip 0 1000\n\n")
238              f.write(file + ".mipzip 1000 60000 Control_R Control_L\n")              f.write(file + ".mipzip 1000 60000 Space\n")
239              f.write("page=%s conds=%s\n" % (pagenums[trial], str(opts)))              f.write("page=%s conds=%s\n" % (pagenums[trial], str(opts)))
240              f.flush()              f.flush()
             l += 1  
241    
242          f.close()          f.close()
243    
# Line 219  class Main(Runnable): Line 253  class Main(Runnable):
253          w = gfxapi.createWindow()          w = gfxapi.createWindow()
254          w.setLocation(0,0,xs,ys)          w.setLocation(0,0,xs,ys)
255    
256          def nop(vs): pass          def star(vs):
257          doFrame(nop, "tmp/star")              putText(vs, 0, "*", x=xs*.5-10, y=ys*.6, h = 100)
258    
259            def space(vs):
260                putText(vs, 0, "Press space to start", x=xs*.5-350, y=ys*.6, h = 100)
261            
262            doFrame(star, "tmp/star")
263            doFrame(space, "tmp/space")
264    
265          # createPurePapers()          createPurePapers()
266          createTextPapers()          createTextPapers()
267    
268    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26