Exemplo n.º 1
0
def main():
    wdth = 1024
    hght = 768
    flds = ['Luminance']
    args = prsr.parse_args()
    flnm = open('results/' + args.flnm,'w')

    # Initializations
    hrl = HRL(wdth,hght,args.lm,coords=(0,1,0,1),flipcoords=False,dpx=True,ocal=True,rfl=flnm,rhds=flds,fs=True)

    sqrwv = lambda x: args.ctst * round((np.sin(2*np.pi*x) + 1)/2) + (0.5 - args.ctst/2)

    pwdth,phght = int(wdth*args.sz),int(hght*args.sz)
    ppos = ((wdth - pwdth)/2,(hght - phght)/2)

    sqrwv1 = np.array([ [sqrwv(x)] for x in
                       np.linspace(0,args.scyc,phght,endpoint=False) ])
    sqrwv2 = np.array([[ sqrwv(x) for x in
                        np.linspace(0,args.scyc,pwdth,endpoint=False) ]])

    ptch1 = hrl.newTexture(sqrwv1)
    ptch2 = hrl.newTexture(sqrwv2)

    slptm = int(1000.0 / args.tfrq)
    print slptm

    for i in range(args.ncyc):

        ptch1.draw(ppos,pwdth,phght)
        hrl.flip()
        hrl.rmtx['Luminance'] = hrl.readLuminance(phtm,1,0)
        hrl.writeResultLine()

        pg.time.wait(slptm)

        ptch2.draw(ppos,pwdth,phght)
        hrl.flip()
        hrl.rmtx['Luminance'] = hrl.readLuminance(phtm,1,0)
        hrl.writeResultLine()

        pg.time.wait(slptm)

        if hrl.checkEscape(): break

# Experiment is over!
    hrl.close()
Exemplo n.º 2
0
 def opticalRead(its,phtm):
     print 'Current Intensity:', its
     lm = hrl.readLuminance(phtm,1,0)
     hrl.rmtx['Intensity'] = its
     hrl.rmtx['Luminance'] = lm
     hrl.writeResultLine()