Skip to content

Commit

Permalink
RF: additional style tweaks, some demo BFs too
Browse files Browse the repository at this point in the history
win.flip -> win.flip()
add return to last line in file
  • Loading branch information
jeremygray committed Nov 24, 2015
1 parent e0ba349 commit 6aacb6e
Show file tree
Hide file tree
Showing 69 changed files with 103 additions and 111 deletions.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/basic/hello_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from psychopy import data, gui, core
from psychopy.tools.filetools import fromFile
import pylab, scipy
import pylab
import os

# set to 0.5 for Yes/No (or PSE). Set to 0.8 for a 2AFC threshold
Expand Down Expand Up @@ -84,4 +84,4 @@

core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/experiment control/TrialHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
trials.saveAsPickle(fileName = 'testData') # this saves a copy of the whole object
df = trials.saveAsWideText("testDataWide.txt") # wide is useful for analysis with R or SPSS. Also returns dataframe df

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
4 changes: 2 additions & 2 deletions psychopy/demos/coder/experiment control/autoDraw_autoLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from __future__ import division

from psychopy import visual, core, event
from psychopy import visual, core

win = visual.Window([800, 800])

Expand Down Expand Up @@ -49,4 +49,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
print("Done. 'exp' experimentHandler will now (end of script) save data to testExp.csv")
print(" and also to testExp.psydat, which is a pickled version of `exp`")

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/experiment control/fMRI_launchScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
pylab.show()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
16 changes: 7 additions & 9 deletions psychopy/demos/coder/experiment control/gammaMotionNull.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def getResponse(direction):
"""if subject said up when direction was up ( + 1) then increase gamma
Otherwise, decrease gamma"""
event.clearEvents() # clear the event buffer to start with
resp = None # initially

while 1: # forever until we return
for key in event.getKeys():
Expand All @@ -104,11 +103,10 @@ def getResponse(direction):
win.close()
# win.bits.reset()
core.quit()
return None
# valid response - check to see if correct
elif key in ['down', 'up']:
if ((key in ['down'] and direction == -1) or
(key in ['up'] and direction == + 1)):
(key in ['up'] and direction == +1)):
return 0
else:
return 1
Expand All @@ -120,7 +118,7 @@ def presentStimulus(direction):
where:
direction = + 1(up) or -1(down)
"""
junk = win.fps()
win.fps()

startPhase = num.random.random()
if direction == 1:
Expand All @@ -136,10 +134,10 @@ def presentStimulus(direction):
for n in range(nFrames):
# present for several constant frames (TF)
thisStim.draw()
win.flip
win.flip()

# then blank the screen
win.flip
win.flip()

# run the staircase
for trialN in range(info['nTrials']):
Expand All @@ -154,7 +152,7 @@ def presentStimulus(direction):
ans = getResponse(direction)
stairCase.addData(ans)

win.flip
win.flip()
core.wait(0.5)

win.close()
Expand All @@ -166,8 +164,8 @@ def presentStimulus(direction):
stairCases[0].saveAsPickle(fileName + 'lo')
stairCases[0].saveAsText(fileName + 'lo')

print('That took %.1fmins' % (globalClock.getTime()/60.0))
print('That took %.1fmins' % (globalClock.getTime() / 60.0))

core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/experiment control/logFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
8 changes: 3 additions & 5 deletions psychopy/demos/coder/experiment control/runtimeInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@

print("\nYou can extract single items from info, using keys, e.g.:")
print(" psychopyVersion = %s" % runInfo['psychopyVersion'])
try:
runInfo["windowRefreshTimeAvg_ms"] # just to raise exception here if no keys
if "windowRefreshTimeAvg_ms" in runInfo.keys():
print("or from the test of the screen refresh rate:")
print(" %.2f ms = average refresh time" % runInfo["windowRefreshTimeAvg_ms"])
print(" %.3f ms = standard deviation" % runInfo["windowRefreshTimeSD_ms"])
Expand All @@ -72,12 +71,11 @@
print("""Try defining the window as full-screen (it's not currently), i.e. at the top of the demo change to:
win = visual.Window((800, 600), fullscr=True, ...
and re-run the demo.""")
except Exception:
pass

print("""
(NB: The visual is not the demo! Scroll up to see the text output.)""")

win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/CRS_BitsBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/CRS_BitsPlusPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/cedrusRB730.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
print('baseTime:', rb730.getBaseTimer())
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/egi_netstation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
# ns.finalize()


# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/ioLab_bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/labjack_u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/monitorDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
thisMon = monitors.Monitor(thisName)
print(thisMon.getDistance())

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/parallelPortOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/hardware/testSoundLatency.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/input/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
else:
print('user cancelled')

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/input/customMouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@

win.close()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
4 changes: 2 additions & 2 deletions psychopy/demos/coder/input/joystick_universal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import print_function

"""
There are two ways to retrieve info from the first 3 joystick axes. You can use:
Expand All @@ -16,6 +15,7 @@
"""

from __future__ import division
from __future__ import print_function

from psychopy import visual, core, event
from psychopy.hardware import joystick
Expand Down Expand Up @@ -84,4 +84,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/input/latencyFromTone.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ def plotYX(yaxis, xaxis, description=''):
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/input/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/input/what_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/iohub/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/iohub/keyboardreactiontime.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/iohub/launchHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ def testEnabledDataStoreAutoSessionCode():
print('Test Result: ', result)
break

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/iohub/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/iohub/xinputgamepad.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ def normalizedValue2Coord(normed_position, normed_magnitude, display_coord_area)

# End of run.py Script #

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/misc/captureFrames.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/misc/encrypt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
for file in [sf.file, pubkey, privkey, passphrase]:
os.unlink(file)

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
4 changes: 2 additions & 2 deletions psychopy/demos/coder/stimuli/MoviePause.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
mov.play()
while globalClock.getTime() < (mov.duration + 1.0):
mov.draw()
win.flip
win.flip()

win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/stimuli/MovieStim.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
2 changes: 1 addition & 1 deletion psychopy/demos/coder/stimuli/MovieStim2.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@
win.close()
core.quit()

# The contents of this file are in the public domain.
# The contents of this file are in the public domain.
Loading

0 comments on commit 6aacb6e

Please sign in to comment.