PsychoPy running on mac os high sierra

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): mac os high sierra
PsychoPy version (e.g. 1.84.x): v1.9.1
Standard Standalone? (y/n) If not then what?:standalone mac
**What are you trying to achieve?:**running a self paced reading study with excel files imported into psychopy

**What did you try to make it work?:**creating smaller excel files of stims

**What specifically went wrong when you tried that?:**can’t run even a simple experiment with minimal stims files
Include pasted full error message if possible. “That didn’t work” is not enough information.

You have not described your issue in sufficient detail for anyone else to understand it.

I attempt to set up a self-paced reading experiment in builder mode using stims from excel files and there are delays with creating the trials-a long lag in the set up of trials. Then when I set up an experiment with just two sentences, and try to run it by clicking the ‘run’ button, the program doesn’t run the experiment at all, i.e. nothing happens etc. Just a lot of lags, and, also, I cannot start up the new version of psychopy with the icon from launchpad. I have to manually start it up from the app folder. I like the program and really want to make it work so any suggestions would be great.

PS I tried using the older version available online and had issues with that as well, e.g it would run a simple version of the experiment but just stopped responding after one sentence.

OK, we’re getting closer. But there is a lot here. Let’s just deal with the issue of getting your experiment to work. Launching and so on is an operating system-specific thing and should be in a separate topic.

Let’s start with this, re your original (i.e. not reduced) experiment:

What do you mean precisely? All PsychoPy experiments take a while to get started, as there is quite a lot of work that needs to be done in the background before the first screen can be displayed. If that is all, then don’t worry about it. Or are you talking about delays during your experiment, that are disrupting the way it should perform? If so, describe exactly what the issues are.

Lastly, we probably need to see what you are doing. Post a screenshot of the flow panel of your experiment, of the components in your main routine, and show any custom code that you might be using.

Thanks Michael, I think the ‘lag’ as I describe might be normal. With that said once the trials (2 total) are setup and I click run (the green button) the experiment doesn’t load. I don’t know any better way to describe it other than that. Also is this what you requested? (there wasn’t any custom code-to advanced for my knowledge of this).

#!/usr/bin/env python2

-- coding: utf-8 --

“”"
This experiment was created using PsychoPy2 Experiment Builder (v1.82.01), Sat Sep 15 15:51:35 2018
If you publish work using this script please cite the relevant PsychoPy publications
Peirce, JW (2007) PsychoPy - Psychophysics software in Python. Journal of Neuroscience Methods, 162(1-2), 8-13.
Peirce, JW (2009) Generating stimuli for neuroscience using PsychoPy. Frontiers in Neuroinformatics, 2:10. doi: 10.3389/neuro.11.010.2008
“”"

from future import division # so that 1/3=0.333 instead of 1/3=0
from psychopy import visual, core, data, event, logging, sound, gui
from psychopy.constants import * # things like STARTED, FINISHED
import numpy as np # whole numpy lib is available, prepend ‘np.’
from numpy import sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray
from numpy.random import random, randint, normal, shuffle
import os # handy system and path functions

Ensure that relative paths start from the same directory as this script

_thisDir = os.path.dirname(os.path.abspath(file))
os.chdir(_thisDir)

Store info about the experiment session

expName = u’untitled’ # from the Builder filename that created this script
expInfo = {‘participant’:’’, ‘session’:‘001’}
dlg = gui.DlgFromDict(dictionary=expInfo, title=expName)
if dlg.OK == False: core.quit() # user pressed cancel
expInfo[‘date’] = data.getDateStr() # add a simple timestamp
expInfo[‘expName’] = expName

Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc

filename = thisDir + os.sep + 'data/%s%s_%s’ %(expInfo[‘participant’], expName, expInfo[‘date’])

An ExperimentHandler isn’t essential but helps with data saving

thisExp = data.ExperimentHandler(name=expName, version=’’,
extraInfo=expInfo, runtimeInfo=None,
originPath=u’/Users/Paul/Desktop/untitled.psyexp’,
savePickle=True, saveWideText=True,
dataFileName=filename)
#save a log file for detail verbose info
logFile = logging.LogFile(filename+’.log’, level=logging.EXP)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file

endExpNow = False # flag for ‘escape’ or other condition => quit the exp

Start Code - component code to be run before the window creation

Setup the Window

win = visual.Window(size=(1920, 1080), fullscr=True, screen=0, allowGUI=False, allowStencil=False,
monitor=‘testMonitor’, color=[0,0,0], colorSpace=‘rgb’,
blendMode=‘avg’, useFBO=True,
)

store frame rate of monitor if we can measure it successfully

expInfo[‘frameRate’]=win.getActualFrameRate()
if expInfo[‘frameRate’]!=None:
frameDur = 1.0/round(expInfo[‘frameRate’])
else:
frameDur = 1.0/60.0 # couldn’t get a reliable measure so guess

Initialize components for Routine “trial”

trialClock = core.Clock()
ISI = core.StaticPeriod(win=win, screenHz=expInfo[‘frameRate’], name=‘ISI’)
text = visual.TextStim(win=win, ori=0, name=‘text’,
text=‘default text’, font=u’Arial’,
pos=[0, 0], height=0.1, wrapWidth=None,
color=u’white’, colorSpace=‘rgb’, opacity=1,
depth=-1.0)

Initialize components for Routine “trial2”

trial2Clock = core.Clock()
text_2 = visual.TextStim(win=win, ori=0, name=‘text_2’,
text=‘default text’, font=u’Arial’,
pos=[0, 0], height=0.1, wrapWidth=None,
color=u’white’, colorSpace=‘rgb’, opacity=1,
depth=0.0)

Create some handy timers

globalClock = core.Clock() # to track the time since experiment started
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine

set up handler to look after randomisation of conditions etc

trials = data.TrialHandler(nReps=1, method=‘sequential’,
extraInfo=expInfo, originPath=u’/Users/Paul/Desktop/untitled.psyexp’,
trialList=data.importConditions(u’…/…/…/…/Users/Paul/Desktop/Stims.xlsx’),
seed=None, name=‘trials’)
thisExp.addLoop(trials) # add the loop to the experiment
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values

abbreviate parameter names if possible (e.g. rgb=thisTrial.rgb)

if thisTrial != None:
for paramName in thisTrial.keys():
exec(paramName + ‘= thisTrial.’ + paramName)

for thisTrial in trials:
currentLoop = trials
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
if thisTrial != None:
for paramName in thisTrial.keys():
exec(paramName + ‘= thisTrial.’ + paramName)

#------Prepare to start Routine "trial"-------
t = 0
trialClock.reset()  # clock 
frameN = -1
# update component parameters for each repeat
text.setText(F1)
key_resp_2 = event.BuilderKeyResponse()  # create an object of type KeyResponse
key_resp_2.status = NOT_STARTED
# keep track of which components have finished
trialComponents = []
trialComponents.append(ISI)
trialComponents.append(text)
trialComponents.append(key_resp_2)
for thisComponent in trialComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "trial"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = trialClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *text* updates
    if t >= 0.0 and text.status == NOT_STARTED:
        # keep track of start time/frame for later
        text.tStart = t  # underestimates by a little under one frame
        text.frameNStart = frameN  # exact frame index
        text.setAutoDraw(True)
    
    # *key_resp_2* updates
    if t >= 0.0 and key_resp_2.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_2.tStart = t  # underestimates by a little under one frame
        key_resp_2.frameNStart = frameN  # exact frame index
        key_resp_2.status = STARTED
        # keyboard checking is just starting
        key_resp_2.clock.reset()  # now t=0
    if key_resp_2.status == STARTED:
        theseKeys = event.getKeys(keyList=['y', 'n', 'left', 'right', 'space'])
        
        # check for quit:
        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_2.keys = theseKeys[-1]  # just the last key pressed
            key_resp_2.rt = key_resp_2.clock.getTime()
            # a response ends the routine
            continueRoutine = False
    # *ISI* period
    if t >= 0.0 and ISI.status == NOT_STARTED:
        # keep track of start time/frame for later
        ISI.tStart = t  # underestimates by a little under one frame
        ISI.frameNStart = frameN  # exact frame index
        ISI.start(0.5)
    elif ISI.status == STARTED: #one frame should pass before updating params and completing
        ISI.complete() #finish the static period
    
    # check if all components have finished
    if not continueRoutine:  # a component has requested a forced-end of Routine
        break
    continueRoutine = False  # will revert to True if at least one component still running
    for thisComponent in trialComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # check for quit (the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

#-------Ending Routine "trial"-------
for thisComponent in trialComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
# check responses
if key_resp_2.keys in ['', [], None]:  # No response was made
   key_resp_2.keys=None
# store data for trials (TrialHandler)
trials.addData('key_resp_2.keys',key_resp_2.keys)
if key_resp_2.keys != None:  # we had a response
    trials.addData('key_resp_2.rt', key_resp_2.rt)
# the Routine "trial" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
thisExp.nextEntry()

completed 1 repeats of ‘trials’

set up handler to look after randomisation of conditions etc

trials_2 = data.TrialHandler(nReps=1, method=‘sequential’,
extraInfo=expInfo, originPath=u’/Users/Paul/Desktop/untitled.psyexp’,
trialList=data.importConditions(u’Ex1F2.xlsx’),
seed=None, name=‘trials_2’)
thisExp.addLoop(trials_2) # add the loop to the experiment
thisTrial_2 = trials_2.trialList[0] # so we can initialise stimuli with some values

abbreviate parameter names if possible (e.g. rgb=thisTrial_2.rgb)

if thisTrial_2 != None:
for paramName in thisTrial_2.keys():
exec(paramName + ‘= thisTrial_2.’ + paramName)

for thisTrial_2 in trials_2:
currentLoop = trials_2
# abbreviate parameter names if possible (e.g. rgb = thisTrial_2.rgb)
if thisTrial_2 != None:
for paramName in thisTrial_2.keys():
exec(paramName + ‘= thisTrial_2.’ + paramName)

#------Prepare to start Routine "trial2"-------
t = 0
trial2Clock.reset()  # clock 
frameN = -1
# update component parameters for each repeat
text_2.setText(F1)
key_resp_3 = event.BuilderKeyResponse()  # create an object of type KeyResponse
key_resp_3.status = NOT_STARTED
# keep track of which components have finished
trial2Components = []
trial2Components.append(text_2)
trial2Components.append(key_resp_3)
for thisComponent in trial2Components:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "trial2"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = trial2Clock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *text_2* updates
    if t >= 0.0 and text_2.status == NOT_STARTED:
        # keep track of start time/frame for later
        text_2.tStart = t  # underestimates by a little under one frame
        text_2.frameNStart = frameN  # exact frame index
        text_2.setAutoDraw(True)
    
    # *key_resp_3* updates
    if t >= 0.0 and key_resp_3.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_3.tStart = t  # underestimates by a little under one frame
        key_resp_3.frameNStart = frameN  # exact frame index
        key_resp_3.status = STARTED
        # keyboard checking is just starting
        key_resp_3.clock.reset()  # now t=0
    if key_resp_3.status == STARTED:
        theseKeys = event.getKeys(keyList=['y', 'n', 'left', 'right', 'space'])
        
        # check for quit:
        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_3.keys = theseKeys[-1]  # just the last key pressed
            key_resp_3.rt = key_resp_3.clock.getTime()
            # a response ends the routine
            continueRoutine = False
    
    # check if all components have finished
    if not continueRoutine:  # a component has requested a forced-end of Routine
        break
    continueRoutine = False  # will revert to True if at least one component still running
    for thisComponent in trial2Components:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # check for quit (the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

#-------Ending Routine "trial2"-------
for thisComponent in trial2Components:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
# check responses
if key_resp_3.keys in ['', [], None]:  # No response was made
   key_resp_3.keys=None
# store data for trials_2 (TrialHandler)
trials_2.addData('key_resp_3.keys',key_resp_3.keys)
if key_resp_3.keys != None:  # we had a response
    trials_2.addData('key_resp_3.rt', key_resp_3.rt)
# the Routine "trial2" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
thisExp.nextEntry()

completed 1 repeats of ‘trials_2’

win.close()
core.quit()

Hi Michael here is that screen shot.

Mike, please respond asap I need to better understand what I’m doing wrong when setting up the experiment. If I can clarify the problem or provide any additional information please let me know.

Thank you