Blank screen when running timer countdown in Psychopy 1.82.01 Builder on Windows 8.1

292 views
Skip to first unread message

nann...@hotmail.com

unread,
Nov 3, 2015, 11:39:43 AM11/3/15
to psychopy-users

Dear list,

I am new at programming. I am trying to use task developed by someone else using Builder. The task duration is 20 min and if completed before that time is elapsed, a countdown is displayed for the remaining period of time. So for instance if the the participant has spent 15 minutes on the test, the timer will count down from 5min. Unfortunately, after a random amount of time the screen becomes and stays white. However, by printing the remaining time on the command line, I can verify that the task does not crash. This task actually works correctly on some computers.

I know there is not much information to go on here, but any suggestion for tracking this bug down would be appreciated. Is there for example known instance in Psychopy where this white screen might occur? Could there be something linked to the configuration of the videocard?

The timer is initialized as follow:
countDown = core.CountdownTimer(1200) # 20 minutes count down

The actual code for the routine generated by Builder is :

#-------Start Routine "end"-------
continueRoutine = True
while continueRoutine:
# get current time
t = endClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
minsCount = countDown.getTime() / 60
secsCount = countDown.getTime() % 60

if responseQuit=="q":
countdownText="Time remaining: %d minutes %d seconds" % (minsCount, secsCount)
if countDown.getTime()<0:
continueRoutine=False
else:
continueRoutine=False

# *endText* updates
if t >= 0.0 and endText.status == NOT_STARTED:
# keep track of start time/frame for later
endText.tStart = t # underestimates by a little under one frame
endText.frameNStart = frameN # exact frame index
endText.setAutoDraw(True)
if endText.status == STARTED: # only update if being drawn
endText.setText(countdownText, log=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 endComponents:
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()
print 'flip'

Please let me know if you need more information

Kind regards,

Nanna



Michael MacAskill

unread,
Nov 3, 2015, 5:48:57 PM11/3/15
to psychop...@googlegroups.com
Dear Nanna,

Welcome along. It seems unlikely this is a video card problem, although it is hard to tell from what we know so far.

It's not clear how you have implemented the countdown. Are you using a code component to add some extra function, or is this all handled via standard Builder components, perhaps with individual code expressions in certain fields? It doesn't seem like what you sent is all Builder-generated code, e.g. this:


if countDown.getTime()<0:
continueRoutine=False
else:
continueRoutine=False

does the same thing regardless of the time.

And here:

if responseQuit=="q":
countdownText="Time remaining: %d minutes %d seconds" % (minsCount, secsCount)

it isn't clear what "responseQuit" refers to.

Give you give us some more detail, and if pasting in code MAKE SURE IT INCLUDES THE INDENTING. We can't tell if the code structure and logic is correct without the indenting, which has crucial meaning in Python.

Having said that, it is likely that you would get a much quicker answer by just sending the whole .psyexp Builder file rather than extracting bits of code.

Regards,

Michael
--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

nann...@hotmail.com

unread,
Nov 6, 2015, 10:01:26 AM11/6/15
to psychopy-users

Dear Micheal,

Thank you for your kind answer. The task was actually implemented by someone else ;) I'm just struggling to make it work.

Everything is handled via standard Builder components. However there is a Builder code component which specifies the conditions to end the timer routine and which contains the code that you pointed out. Unfortunately, due to the missing indentation, you were mislead in thinking that the code was doing the same thing regardless of time, sorry about that. With the correct indentation ;) the snippet of code is as follow:

if responseQuit=="q":
  countdownText="Time remaining: %d minutes %d seconds" % (minsCount, secsCount)
  if countDown.getTime()<0:
    continueRoutine=False
else:
  continueRoutine=False

hence time is the factor controlling the end of the routine (responseQuit is almost always equal to "q"). But even if there was a mistake in that "exit" code, it wouldn't explain why the screen randomly becomes blank before the end of the countdown. I do not get an error message when the experiment has been run, I just get a white screen during the test. This is the only output I get:

############# Running: C:\Users\Bruger\Desktop\PRv2_simplified.py ##############

6.1910 WARNING t of last frame was 6.55ms (=1/152)

6.2063 WARNING t of last frame was 6.24ms (=1/160)

6.2221 WARNING t of last frame was 6.03ms (=1/165)

saved data to u'C:\\Users\\Bruger\\Desktop\\Data/999_2015_nov_06_1532_PR.csv'


I've attached a simplified version of the task, including only the last countdown part which crashes. Please let me know if you have any insight on how to fix this problem. 

One of the thing I've tried was to change the update of the timer text from "frame" to "repeat", however when doing this the screen stays white and the text is never displayed. I've tried including a loop but the results was the same. Its seems to me rather inefficient to try to update on every frame but I'm not sure what is meant by repeat here.  


Cheers,

Nanna.

PRv2_simplified.psyexp

nann...@hotmail.com

unread,
Nov 10, 2015, 10:24:39 AM11/10/15
to psychopy-users
Hi psychopy community,

I'm just bumping this up as I need to fix this soon for testing. Has anyone had a chance to try the task on their system? Should I report this as a bug?

Kind regards,
Nanna

Michael MacAskill

unread,
Nov 10, 2015, 4:05:56 PM11/10/15
to <psychopy-users@googlegroups.com>
Hi Nanna,

> I'm just bumping this up as I need to fix this soon for testing. Has anyone had a chance to try the task on their system?

I had looked at it, but as it required waiting for 20 minutes to see what would happen, I must admit I didn't persist ;-)

I just ran it again, edited to last just 20 s, and it seemed to work properly.

One thing I would recommend is that you insert this:

countDown.reset()

at the beginning of your routine. The countdown timer will start counting down from the moment it is created (currently at the beginning of the experiment). So by the time you get to your trial with the text stimulus, it may have quite a bit less than 20 minutes to run, as it takes quite a few seconds for the experiment to get up and running. Maybe that causes some sort of conflict in other aspects of your full experiment, which assume a 20 min duration? Calling 'reset' starts it back at 1200 seconds at exactly the point you need it.

> Should I report this as a bug?
No, because there is no evidence of a PsychoPy bug as yet. You haven't yet described really what is going wrong. You mentioned it being a "crash", yet there were no error messages. You also mentioned a blank screen appearing when it shouldn't. We need a precise description of what is actually going wrong. In the absence of a true crash, the problem is more likely in the way the task has been created. But we would need more detail.

Best wishes,

Michael

nann...@hotmail.com

unread,
Nov 13, 2015, 5:52:50 AM11/13/15
to psychopy-users
Dear Michael, 

Thank you for your help.

The task including the things happening before the countdown is 20 minutes long by design therefore this is why we don't reset the timer. The test also works fine for me when I edit it to only 20 s. The problem occurs after approximately 14 minutes of running the tests. I have put a short video on dropbox, showing the change from showing the countdown to white screen. This is the link to the video:

https://dl.dropboxusercontent.com/u/53635653/vlc-record-2015-11-13-11h28m36s-Prv2_error.MOV-.mp4

However by an additional print statement to display the remaining time to the console output I can verify that the task is still running. Also, the task always closes down after 20 minutes which I think would support the fact that the countdown function is working fine and that the problem is related to something else. The task does not exactly "crash", as in stop running, but there is definitely a bug here. 

While running on a different computer, I've got the following error message:

######### Running: C:\Users\Bruger\Desktop\PRv2_simplified2_lastrun.py #########

saved data to u'C:\\Users\\Bruger\\Desktop\\Data/999_2015_nov_13_0805_PR.csv'

Traceback (most recent call last):

  File "C:\Users\Bruger\Desktop\PRv2_simplified2_lastrun.py", line 196, in <module>

    win.flip()

  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.82.00-py2.7.egg\psychopy\visual\window.py", line 563, in flip

    self._renderFBO()

  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.82.00-py2.7.egg\psychopy\visual\window.py", line 1702, in _renderFBO

    GL.glBegin(GL.GL_QUADS)

WindowsError: exception: access violation writing 0x0003C01C


Best regards, 
Nanna

Reply all
Reply to author
Forward
0 new messages