Skip to content

Commit

Permalink
Documentation updates, 2020.1.0-1 problems
Browse files Browse the repository at this point in the history
Updated manual for the PsychoPy3 2020 "runner" window. Fixed issues introduced in 2020.1.0 and 1.1 (with better comments). Added documentation to Readme, readthedocs, and manual related to this fix. Updated demo code. Ready for deployment.
  • Loading branch information
jfkominsky committed Mar 3, 2020
1 parent a0f152c commit 186653f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion NewPyHabProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#(You can also press CTRL-R or Command-R)
from PyHab import PyHabBuilder as PB
import os
os.chdir(os.path.dirname(os.path.realpath(__file__))) # require for PsychoPy3 2020.1.0 and later (for now)
#Required for PsychoPy 2020.1.0 and 2020.1.1
os.chdir(os.path.dirname(os.path.realpath(__file__)))

builder = PB.PyHabBuilder()
builder.run()
Binary file modified PyHab User Manual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion PyHab/PyHab Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from PyHab import PyHabClassHPP as PHPP
from PyHab import PyHabBuilder as PB
import csv, os
os.chdir(os.path.dirname(os.path.realpath(__file__))) # require for PsychoPy3 2020.1.0 and later (for now)
os.chdir(os.path.dirname(os.path.realpath(__file__))) # required for PsychoPy3 2020.1.0 and later (for now)

setName = 'DUMMY FILENAME'

Expand Down
8 changes: 4 additions & 4 deletions PyHabDemo/PyHab/PyHabBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def __init__(self, loadedSaved=False, settingsDict={}):
evalList = ['dataColumns','blockSum','trialSum','maxDur','condList','baseCondList','movieEnd','playThrough','trialOrder',
'stimNames', 'stimList', 'ISI', 'maxOff','minOn','autoAdvance','playAttnGetter','attnGetterList',
'trialTypes','habTrialList', 'calcHabOver', 'nextFlash', 'blockList', 'dynamicPause','midAG',
'screenWidth','screenHeight','movieWidth','movieHeight'] # in 0.9, this becomes necessary.
'screenWidth','screenHeight','screenIndex','movieWidth','movieHeight'] # in 0.9, this becomes necessary.
for i in evalList:
self.settings[i] = eval(self.settings[i])
if i in ['stimList','attnGetterList']:
Expand Down Expand Up @@ -449,7 +449,7 @@ def mainLoop(self):
if os.name is not 'posix':
while self.mouse.getPressed()[0] == 1:
pass
if self.buttonList['function'][i] not in [self.toST, self.toPL, self.toHPP]:
if self.buttonList['functions'][i] not in [self.toST, self.toPL, self.toHPP]:
# If we're opening a dialog box, basically.
self.win.winHandle.set_visible(visible=False)

Expand Down Expand Up @@ -1976,7 +1976,7 @@ def dataSettingsDlg(self):
if self.settings['prefLook'] in [1,'1',True,'True']:
tempDataCols = self.allDataColumnsPL
elif self.settings['prefLook'] in [2,'2']:
tempDataCols = self.allDataColumpsHPP
tempDataCols = self.allDataColumnsHPP
else:
tempDataCols = self.allDataColumns
for i in range(0, len(tempDataCols)):
Expand Down Expand Up @@ -2765,7 +2765,7 @@ def condSettingsDlg(self): #Settings relating to conditions and randomization
pass
elif self.settings['trialTypes'][i] not in self.settings['stimNames'].keys():
allReady = False
elif len(self.settings['stimNames'][self.trialTypesArray['labels'][i]]) == 0: # Another way that it can have no movies associated with it.
elif len(self.settings['stimNames'][self.settings['trialTypes'][i]]) == 0: # Another way that it can have no movies associated with it.
allReady = False
if allReady:
if len(condInfo[1]) > 0:
Expand Down
2 changes: 1 addition & 1 deletion PyHabDemo/PyHab/PyHabClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def attnGetter(self, trialType, cutoff=False, onmin=0):
onCheck = 0

self.dispCoderWindow(0)
#self.win.flip() # clear screen (change?)
#self.win.flip() # clear screen (change?) TODO: For audio-only stim you need it...

def flashCoderWindow(self, rep=False):
"""
Expand Down
2 changes: 1 addition & 1 deletion PyHabDemo/PyHab/PyHabClassHPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ def SetupWindow(self):
:rtype:
"""
if self.stimPres:
# Stimulus presentation window TODO: REMOVE DEBUG GUI
# Stimulus presentation window
self.win = visual.Window((self.screenWidth['C'], self.screenHeight['C']), fullscr=False, screen=self.screenIndex['C'], allowGUI=False,
units='pix', color=self.screenColor['C'])
self.winL = visual.Window((self.screenWidth['L'], self.screenHeight['L']), fullscr=False, screen=self.screenIndex['L'], allowGUI=False,
Expand Down
1 change: 1 addition & 0 deletions PyHabDemo/PyHabDemoLauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from PyHab import PyHabClassHPP as PHPP
from PyHab import PyHabBuilder as PB
import csv, os
os.chdir(os.path.dirname(os.path.realpath(__file__)))

setName = "PyHabDemoSettings.csv"
#Created in PsychoPy version 3.1.2
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Looking time and stimulus presentation system for PsychoPy.
<li>If you do use PyHab for a study that you then submit for publication, please cite <b>both PsychoPy and PyHab</b>. PyHab relies very heavily on PsychoPy (but is not directly affiliated with or developed by the makers of PsychoPy), so credit is due as much to them as it is to me.</li>
<li><a href="https://groups.google.com/forum/#!forum/pyhab-announcements">Please join the Pyhab announcements mailing list for news about updates and important technical information</a></li>
<li><b>KNOWN ISSUES:</b> There may be an issue with multi-monitor displays where one of them is a Mac Retina display, starting with MacOS 10.13.5 (High Sierra June 2018). I am investigating the problem, but non-Retina displays or earlier versions of MacOS should be unaffected. Non-Macs are obviously unaffected.</li>
<li><b>BACKWARDS COMPATIBILITY 2020:</b> Versions 2020.1.0 and 2020.1.1 of PsychoPy introduced a change in how PsychoPy runs scripts. PyHab version 0.9 and later work with this, but experiments made with earlier versions need a small modification. See: <a href=https://pyhab.readthedocs.io/en/latest/PsychoPy2020BackCompat.html>Backwards compatibility in PsychoPy3 2020.1.0 and 2020.1.1</a><li>
</ul>
<h2>Installing PyHab and Getting Started</h2>
<p><a href="https://pyhab.readthedocs.io/en/latest/?badge=latest" target="_blank">Click here for the installation and quick-start guides</a></p>
Expand Down
10 changes: 10 additions & 0 deletions docs/PsychoPy2020BackCompat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
==============
Backwards compatibility in PsychoPy3 2020.1.0 and 2020.1.1
==============

Versions 2020.1.0 and 2020.1.1 of PsychoPy have a quirk that will break PyHab experiments made in versions prior to 0.9. The good news is that it is easily fixed. The short explanation is that these two versions of PsychoPy (but not those before and probably not those after) change the “working directory” of the script when you run it. Whereas PyHab expects the working directory to be the experiment folder, 2020.1.0 and 2020.1.1 move it somewhere else. The solution is simply to tell PsychoPy to put it back in the same folder as the experiment launcher.
In order to do this, open your experiment’s launcher file. On line 7 (the line after "import csv, os"), paste the following:

os.chdir(os.path.dirname(os.path.realpath(__file__)))

Save the launcher, and you’re good to go. Experiments made in version 0.9 have this built in, and versions of PsychoPy after 2020.1.1 should change this behavior back to the way it was before, but in this very narrow window, if you need to make a pre-0.9 experiment run in PsychoPy3 2020.1.0 or 2020.1.1, this is what you need.

0 comments on commit 186653f

Please sign in to comment.