[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./TODO gfx/demo/psyko2.py gfx/libpaper/text...
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz ./TODO gfx/demo/psyko2.py gfx/libpaper/text... |
Date: |
Tue, 03 Sep 2002 09:06:32 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/09/03 09:06:32
Modified files:
. : TODO
gfx/demo : psyko2.py
gfx/libpaper : textures.py
Log message:
Textures and learning experiment changes
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/psyko2.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.67 gzz/TODO:1.68
*** gzz/TODO:1.67 Tue Sep 3 06:12:44 2002
--- gzz/TODO Tue Sep 3 09:06:32 2002
***************
*** 203,208 ****
--- 203,211 ----
-------------------------------------------
UNSCHEDULED AS YET
+ tjl: implement gfx timeouts better
+ tjl: make creating text vobs from jython faster
+
-------------------------------------------
RESEARCH:
Index: gzz/gfx/demo/psyko2.py
diff -c gzz/gfx/demo/psyko2.py:1.4 gzz/gfx/demo/psyko2.py:1.5
*** gzz/gfx/demo/psyko2.py:1.4 Tue Sep 3 04:11:45 2002
--- gzz/gfx/demo/psyko2.py Tue Sep 3 09:06:32 2002
***************
*** 7,22 ****
# A jython test program for papers
# Load using gldemo.py
! seed = 33555 # shuffling
! seed0 = 123456 # "old" textures
! seed1 = 33456789 # "new" textures
! numtex0 = 50 # Number of different "old" textures
! numtex1 = 250 # Number of different "new" textures
! feedbackduration = 1500
! colorfeedback = 0 # Show green/red color for correct/incorrect
outfile = open("psyko.dat", "a")
--- 7,24 ----
# A jython test program for papers
# Load using gldemo.py
! seed = 5225 # shuffling
! seed0 = 1435 # "old" textures
! seed1 = 54134 # "new" textures
! numtex0 = 30 # Number of different "old" textures
! numtex1 = 100 # Number of different "new" textures
! showtex0 = 100
! feedbackduration = 3000
!
! colorfeedback = 1 # Show green/red color for correct/incorrect
outfile = open("psyko.dat", "a")
***************
*** 46,60 ****
if dupes(tex0 + tex1): continue
break
- words = {}
- for i in range(0, len(tex0)):
- words[tex0[i]] = "(" + str(i) + ")"
-
- for seed in tex1: words[seed] = "----"
-
- seen = {}
- for seed in tex0 + tex1: seen[seed] = None
-
log("textures0 seed: " + str(seed0))
log("textures0: " + js(tex0))
--- 48,53 ----
***************
*** 64,75 ****
log("shuffling seed: " + str(seed))
! zoom = [100, 500, 650, 800, 2000]
paperzoom = [0.05, 0.2, 1, 3]
def globalkey(k):
global currentScene
if k == "F1":
OnlineTestScene().start()
if k == "r":
loadscenes()
--- 57,101 ----
log("shuffling seed: " + str(seed))
!
! execfile("gfx/demo/zipf.py")
!
!
! probs = getZipfDistribution(numtex0)
!
! learninglist = (
! reduce(lambda x,y: x+y,
! [ [ tex0[i] for foo in range(0, int(round(probs[i] * numtex1))) ]
! for i in range(0,numtex0)] )
! )
! learninglist = learninglist[0:showtex0]
!
! onlinelist = (
! reduce(lambda x,y: x+y,
! [ [ tex0[i] for foo in range(0, int(round(probs[i] * numtex1))) ]
! for i in range(0,numtex0)] )
! + tex1
! )
!
! words = {}
! for i in range(0, len(tex0)):
! words[tex0[i]] = str(i)
!
! for seed in tex1: words[seed] = "-"
!
! seen = {}
! for seed in tex0 + tex1: seen[seed] = None
! for seed in learninglist: seen[seed] = "learning phase"
!
!
! zoom = [60, 500, 650, 800, 2000]
paperzoom = [0.05, 0.2, 1, 3]
def globalkey(k):
global currentScene
if k == "F1":
+ LearningScene().start()
+ if k == "F2":
OnlineTestScene().start()
if k == "r":
loadscenes()
***************
*** 110,117 ****
execfile("gfx/libpaper/papermill.py")
- execfile("gfx/demo/zipf.py")
-
next_toid = 1
--- 136,141 ----
***************
*** 128,133 ****
--- 152,224 ----
print str(System.currentTimeMillis()) + " Cancelled TIMEOUT ", scene.toid
scene.toid = None
+ class LearningScene:
+ def __init__(self):
+ self.bgcolor = (0.7, 0.8, 0.6)
+
+ log("Learning phase")
+
+ self.seed = None
+ self.trial = 0
+ self.toid = None
+
+ self.list = learninglist
+ shuffle(self.list, rng.nextFloat)
+
+ def prepareNextTrial(self):
+ if self.trial < len(self.list):
+ self.seed = self.list[self.trial]
+ self.pq = getpaper(self.seed)
+ else:
+ self.seed = None
+
+
+ def nextTrial(self):
+ global currentScene
+ if self.seed != None:
+ if self.seed != self.list[self.trial]:
+ self.prepareNextTrial()
+
+ setTimeout(self, 1000)
+ self.trial = self.trial + 1
+ self.word = words[self.seed]
+ log("Trial %(trial)s: %(seed)s %(word)s" % vars(self))
+ else:
+ currentScene = MenuScene()
+ AbstractUpdateManager.setNoAnimation()
+ AbstractUpdateManager.chg()
+
+ def key(self, k):
+ pass
+
+ def timeout(self, o):
+ global currentScene
+ if o != self.toid: return
+ self.nextTrial()
+
+ def start(self):
+ global currentScene
+ currentScene = FeedBackScene(self, 2)
+ AbstractUpdateManager.setNoAnimation()
+ AbstractUpdateManager.chg()
+
+ def scene(self, vs):
+ putnoc(vs, background(self.bgcolor))
+
+ cs1 = vs.coords.affineCoordsys("1", 10, 800, 600, 800, 0, 0, 600)
+ scale = zoom[0] / paperzoom[0]
+ cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
+
+ pscale = zoom[0]
+
+ print "Seed: ",self.seed," pq ",self.pq
+ vs.map.put(self.pq, cs1, cs2)
+
+ if 0:
+ cs1 = vs.coords.affineCoordsys("msg", 10, 570, 450, 1, 0, 0, 1)
+ putText(vs, cs1, words[self.seed], color=(0,0,0),w=4,h=4)
+
+ return vs
class OnlineTestScene:
***************
*** 145,165 ****
"Control_R" : "old"
}
! self.probs = getZipfDistribution(numtex0)
!
! self.list = (
! reduce(lambda x,y: x+y,
! [ [ tex0[i] for foo in range(0, int(round(self.probs[i] *
len(tex1)))) ]
! for i in range(0,numtex0)] )
! + tex1)
!
shuffle(self.list, rng.nextFloat)
def prepareNextTrial(self):
if self.trial < len(self.list):
self.seed = self.list[self.trial]
! #if self.seed in tex0:
! if seen[self.seed] != None:
self.correct = "old"
else:
self.correct = "new"
--- 236,249 ----
"Control_R" : "old"
}
! self.list = onlinelist
shuffle(self.list, rng.nextFloat)
def prepareNextTrial(self):
if self.trial < len(self.list):
self.seed = self.list[self.trial]
! if self.seed in tex0:
! #if seen[self.seed] != None:
self.correct = "old"
else:
self.correct = "new"
***************
*** 173,185 ****
self.prepareNextTrial()
#setTimeout(self, 5000)
- if seen[self.seed] != None:
- self.seen = seen[self.seed] + 1
- else:
- self.seen = None
self.trial = self.trial + 1
self.word = words[self.seed]
! log("Trial %(trial)s: %(seed)s %(word)s (seen at trial %(seen)s)"
% vars(self))
self.reactstart = System.currentTimeMillis()
else:
--- 257,266 ----
self.prepareNextTrial()
#setTimeout(self, 5000)
self.trial = self.trial + 1
self.word = words[self.seed]
! self.seen = seen[self.seed]
! log("Trial %(trial)s: %(seed)s %(word)s (seen in %(seen)s)"
% vars(self))
self.reactstart = System.currentTimeMillis()
else:
***************
*** 189,202 ****
AbstractUpdateManager.chg()
def endTrial(self, answer):
if answer != None:
self.answer = answer
correct = (self.answer == self.correct)
log("Trial %(trial)s: RT %(reacttime)s %(answer)s" % vars(self) +
" (" + ["Incorrect", "Correct"][correct] + ")")
else:
log("Trial %(trial)s: Timeout" % vars(self))
! currentScene = FeedBackScene(self, 2)
self.state = 1
setTimeout(self, feedbackduration)
--- 270,285 ----
AbstractUpdateManager.chg()
def endTrial(self, answer):
+ global currentScene
if answer != None:
self.answer = answer
correct = (self.answer == self.correct)
log("Trial %(trial)s: RT %(reacttime)s %(answer)s" % vars(self) +
" (" + ["Incorrect", "Correct"][correct] + ")")
+ #currentScene = FeedBackScene(self, correct)
else:
log("Trial %(trial)s: Timeout" % vars(self))
! #currentScene = FeedBackScene(self, 2)
self.state = 1
setTimeout(self, feedbackduration)
***************
*** 233,239 ****
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
! cs1 = vs.coords.affineCoordsys("1", 10, 600, 450, 290, 0, 0, 290)
scale = zoom[0] / paperzoom[0]
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
--- 316,322 ----
def scene(self, vs):
putnoc(vs, background(self.bgcolor))
! cs1 = vs.coords.affineCoordsys("1", 10, 800, 600, 800, 0, 0, 600)
scale = zoom[0] / paperzoom[0]
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0, scale)
***************
*** 242,252 ****
print "Seed: ",self.seed," pq ",self.pq
vs.map.put(self.pq, cs1, cs2)
! seen[self.seed] = self.trial
if self.state == 1:
! cs1 = vs.coords.affineCoordsys("msg", 10, 570, 450, 1, 0, 0, 1)
! putText(vs, cs1, words[self.seed], color=(0,0,0))
#self.prepareNextTrial()
return vs
--- 325,345 ----
print "Seed: ",self.seed," pq ",self.pq
vs.map.put(self.pq, cs1, cs2)
! seen[self.seed] = "trial" + str(self.trial)
if self.state == 1:
! if self.answer == self.correct:
! msg = "Oikein"
! else:
! msg = "Väärin"
! if self.seed in tex0:
! msg2 = "Oli nähty"
! else:
! msg2 = "Ei ollut nähty"
!
! cs1 = vs.coords.affineCoordsys("msg", 10, 350, 350, 1, 0, 0, 1)
! putText(vs, cs1, msg, color=(0,0,0),w=1,h=1,x=100)
! putText(vs, cs1, msg2, color=(0,0,0),w=1,h=1, y=400)
#self.prepareNextTrial()
return vs
***************
*** 306,312 ****
putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 100)
if self.pq != None:
! cs1 = vs.coords.affineCoordsys("1", 10, 800, 450, 290, 0, 0, 290)
scale = zoom[0] / paperzoom[0]
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0,
scale)
vs.map.put(self.pq, cs1, cs2)
--- 399,405 ----
putText(vs, cs1, "seed = " + str(self.seed), color=(0,1,0), y = 100)
if self.pq != None:
! cs1 = vs.coords.affineCoordsys("1", 10, 800, 450, 390, 0, 0, 390)
scale = zoom[0] / paperzoom[0]
cs2 = vs.coords.affineCoordsys("tex", 1, 400, 400, scale, 0, 0,
scale)
vs.map.put(self.pq, cs1, cs2)
***************
*** 339,345 ****
# GZZGL.startContext()
global font
if font == None:
! font = GZZGL.createFont("gfx/fonts/a010013l.pfb", 40)
return GZZGL.createHorizText(font, text, x, y, z, w,h)
# GZZGL.endContext()
--- 432,438 ----
# GZZGL.startContext()
global font
if font == None:
! font = GZZGL.createFont("gfx/fonts/a010013l.pfb", 100)
return GZZGL.createHorizText(font, text, x, y, z, w,h)
# GZZGL.endContext()
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.2 gzz/gfx/libpaper/textures.py:1.3
*** gzz/gfx/libpaper/textures.py:1.2 Tue Sep 3 07:15:13 2002
--- gzz/gfx/libpaper/textures.py Tue Sep 3 09:06:32 2002
***************
*** 31,39 ****
# ("rgbn", [512, 512, 0, 3, "RGB", "RGB",
# "noise", ["type", "turbulence", "freq", "40", "scale", "-3", "bias",
"2"]]),
("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["scale", 2]]),
("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["freq", 2, "df", 2, bias=0.2]]),
]]
def getPaperTexture(type, gen):
--- 31,39 ----
# ("rgbn", [512, 512, 0, 3, "RGB", "RGB",
# "noise", ["type", "turbulence", "freq", "40", "scale", "-3", "bias",
"2"]]),
("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["scale", "2"]]),
("rgbw", [512, 512, 0, 3, "RGB", "RGB",
! "fnoise", ["freq", "2", "df", "2", "bias", "0.2"]]),
]]
def getPaperTexture(type, gen):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./TODO gfx/demo/psyko2.py gfx/libpaper/text...,
Janne V. Kujala <=