Hi Jon,
Thank you for taking the time on a Friday afternoon to reply to my question.
My stimuli is a randot defined circle containing 1 pixel dots on a white background, with pixels either on full brightness, or totally off. At 3m a one pixel shift (between the left and right eye) gives about 32" of disparity, but the next step up is 64" and so on. I was hoping to be able to test values in between, without having the physically move the display during the experiment and adjusting the stimuli size etc.
I tried the code you posed and recorded a macro video at screen refresh rate. It appears that the one pixel line fades, whilst the next triplet of pixels light to the same intensity (presumably 1/3 brightness?), fade and return the original line to full brightness. In my case i guess this would provide an oscillation between disparity levels, but be negated by the reduced noise/signal ratio.
As the stimuli is black and white, i was hoping that instead of using the RGB pixel set on one pixel, to use the GB of one pixel and the R on the next pixel to represent the 'white'. Similar to the way the white line moves in the code Rob Black posted (below) but using the setPos function to define the disparity.
Is there a mechanism that could automatically change the colour of the line on one pixel to 'cyan' and the next to 'red', to represent the subpixel shift of a white line??
I suppose was I naively hoping that the setPos source code prevented shifts of less than one pixel (as the quadro card states it has 12-bit subpixel precision) and could be unprevented somehow?
I have only just started to learn programming, coming into this from a clinical background, so please forgive any badly phrased questions.
Cheers,
Laurence
Robs white line shifting by 1/3 of a pixel code:
#!/usr/bin/env python
from psychopy import core, visual, event
import scipy
import numpy
from PIL import Image
#create a window to draw in
winsize= (1920,1080)
win = visual.Window(size=winsize, pos=[0,0], screen=0, allowGUI=False, fullscr=False)
rgbArray = numpy.zeros((512,512,3), 'uint8')
img = Image.fromarray(rgbArray)
myImg = visual.GratingStim(win, tex=img, pos=(0,0), units='pix')
for x in range(15,200):
x2=x+15
rgbArray[0::2,x-1,2] = 0 # DRAW WHITE LINE REMOVE PREV BLUE, PAINT RGB
rgbArray[0::2,x,0] = 255
rgbArray[0::2,x,1] = 255
rgbArray[0::2,x,2] = 255
img = Image.fromarray(rgbArray)
myImg.setTex(img)
myImg.draw()
win.flip()
rgbArray[0::2,x,0] = 0 # DRAW WHITE LINE REMOVE PREV RED, PAINT GBR
rgbArray[0::2,x,1] = 255
rgbArray[0::2,x,2] = 255
rgbArray[0::2,x+1,0] = 255
img = Image.fromarray(rgbArray)
myImg.setTex(img)
myImg.draw()
win.flip()
rgbArray[1::2,x2,1] = 0 # DRAW WHITE LINE REMOVE PREV GREEN, PAINT BRG
rgbArray[1::2,x2,2] = 255
rgbArray[1::2,x2+1,0] = 255
rgbArray[1::2,x2+1,1] = 255
img = Image.fromarray(rgbArray)
myImg.setTex(img)
myImg.draw()
win.flip()