コード例 #1
0
ファイル: newPoints.py プロジェクト: evgluk/delay3ways
 def __init__(self):
     self.__pileOrigin = [0, -230]
     self.__rad = 100
     self.__cPos = [0, 0]
     self.__OneStack = 50
     self.__OneBigStack = 50
     self.black = "#000000"
     self.coin = visual.Polygon(setup.mywin,
                                edges=32,
                                units='pix',
                                radius=self.__rad / 20,
                                size=(5, 2.5))
     self.bigcoin = visual.Polygon(setup.mywin,
                                   edges=32,
                                   units='pix',
                                   radius=self.__rad / 20,
                                   size=(10, 5))
     self.dollarSign = visual.TextStim(setup.mywin,
                                       text='$',
                                       color=self.black,
                                       italic=True)
     self.dollarSign3 = visual.TextStim(setup.mywin,
                                        text='$$$',
                                        color=self.black,
                                        italic=True)
コード例 #2
0
ファイル: TargetsWindow.py プロジェクト: aung2phyowai/VEP-BCI
 def getTriangle(self, window, options, color, x, y, ori=0, offset=20):
     return visual.Polygon(
         window,
         edges=3,
         radius=10,
         fillColor=color,
         ori=ori,
         pos=(options[c.TARGET_X] +
              (options[c.TARGET_WIDTH] / 2 + offset) * x,
              options[c.TARGET_Y] +
              (options[c.TARGET_HEIGHT] / 2 + offset) * y))
コード例 #3
0
ファイル: practise.py プロジェクト: MrbioDT/stimulus_cs_hffc
def VisGrat_drifting(orientation, off=False):
    #This function generate a drifting visual grating, given the argument of orientation(int)
    NEC = monitors.Monitor('NEC')
    NEC.setDistance(14)  # mice is cm from the screen
    NEC.setSizePix([1280, 1024])  # resolution(pixel) of the monitor
    NEC.setWidth(37.5)  # width of monitor, cm
    win0 = visual.Window(screen=1,
                         monitor=NEC,
                         fullscr=True,
                         color=[-1, -1, -1],
                         unit='deg')  #create window
    myCentre = visual.Polygon(win=win0,
                              edges=100,
                              radius=100000000000,
                              units='degFlat',
                              lineColor=[-1, -1, -1],
                              fillColor=[-1, -1, -1],
                              pos=[0, 0])
    grat_stim = visual.GratingStim(win=win0,
                                   tex='sin',
                                   units='deg',
                                   pos=(0.0, 0.0),
                                   size=100000,
                                   sf=0.04,
                                   ori=orientation,
                                   phase=(0.0, 0.0))
    # sf is spatial frequency, when units == ‘deg’ or ‘cm’ units are in cycles per deg or cm as appropriate
    frametime = win0.getMsPerFrame(
        nFrames=60, showVisual=False, msg='', msDelay=0.0)[
            0]  # return the the average time per frame, with unit of ms
    timeout = time.time() + 600  # seconds, duration of visual stimulus
    if not off:
        while True:
            if time.time() > timeout:
                break
            grat_stim.setPhase(
                2 / float(1000 / frametime), '+'
            )  # advance phase by 0.05 of a cycle, '-' is opposite directions
            #grat_stim.setPhase(0,'+') # advance phase by 0.05 of a cycle, '-' is opposite directions

            # speed of visual stimulus
            grat_stim.draw()
            win0.flip()
    else:
        while True:
            myCentre.draw()
            win0.flip()

    win0.close()
    return 0