Issue in compatibility - visual.GratingStim() in 64 bit system with 32 bit system in psychop
Hello All,
I am working on displaying visual stimuli using the visual.GratingStim() function. The program seeks to show a combination of vertical and horizontal white & black lines that alternate one after the other.
I have no issues with the methodology & the overall sequence of how the program runs.
The issue I am facing is that while the lines get displayed quite well on a Windos 64 bit system, but when the program is run on a 32 bit system with 4 times the RAM, there is a flickering effect that gets induced along with a rainbow effect.
Can someone suggest what to do, if I want a smooth display of the alternating lines on a 32 bit system and whether some changes in the visual.GratingStim() function are suggested.
The code also sends a trigger to a brainvision actichamp EEG system when it changes its sequence speed.
The code is as follows:
from psychopy import visual, core, event, monitors, gui, data
import numpy as np
import os
import sys
import psychopy
import pygame
import time
import random
import winsound
from random import shuffle
from psychopy import parallel
try:
from ctypes import windll
global io
io = windll.dlportio # requires dlportio.dll !!!
print 'Parallel port open'
except:
print 'The parallel port couldn\'t be opened'
myWinIN = visual.Window(
size=(1920, 1080),
allowGUI=False,
monitor="testMonitor",
fullscr=True,
units="deg",
color=[1, 1, 1])
myWinIN.setMouseVisible(False)
psychopy.event.Mouse(visible = False, newPos = None, win = None)
Instruction = visual.TextStim(win = myWinIN,text = 'Experiment is About to Start Be Ready',pos=(0.0, 0.0), color=(1.0, -1.0, -1.0), colorSpace='rgb', opacity=1.0, contrast=1.0)
myWinIN.flip()
Instruction.draw(win = myWinIN)
myWinIN.flip()
core.wait(4)
#create a window
mywin = visual.Window([1920,1080],monitor="testMonitor", units="pix")
mywin.setMouseVisible(False)
psychopy.event.Mouse(visible = False, newPos = None, win = None)
grating = visual.GratingStim(win=mywin, mask='none', size=1366, pos=[0.0,0.0], contrast=0.0)
message = visual.TextStim(mywin, text='+',height=50.0, color=[0,0,0])
message1 = visual.TextStim(mywin, text='+',height=50.0, color=[-1,-1,-1])
grating.draw()
message1.draw()
mywin.flip()
core.wait(2)
t=0
bw=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
#bw=[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, .15]
#bw=[15, 16, 17, 18, 19, 20]
#bw=[1, 2]
for i in range(20):
width=2*bw[i]
print width
s=(1080,1920)
a=np.ones(s)*1
print a.shape
b=np.ones(s)*1
[r,c]=a.shape
for ib in range(bw[i]):
a[:,ib:c:width]=-1;
b[ib:r:width,:]=-1;
for k in range(20):
for key in event.getKeys():
if key in ['escape', 'q']:
mywin.close()
core.quit()
myStim = visual.GratingStim(mywin,size=1920, contrast=1.0, tex=a, mask='none',pos=[0.0,0.0])
myStim.draw()
message.draw()
mywin.flip()
if k == 0:
try:
windll.inpout32.Out32(0x0000D100, i+1)
core.wait(0.01)
windll.inpout32.Out32(0x0000D100, 0)
except:
print 'Error sending trigger'
core.wait(0.002)
myStim = visual.GratingStim(mywin,size=1920, contrast=1.0, tex=a, ori=90, mask='none',pos=[0.0,0.0])
myStim.draw()
message.draw()
mywin.flip()
core.wait(0.002)
grating.draw()
message1.draw()
mywin.flip()
core.wait(2)