def trial_P1(length, height): """ Initiates part 1 of a new trial, draws sample stimulus :param length: length of stimuli :param height: height of stimuli """ screen.refresh() global trialStart global sampleStim trialStart = True sampleStim = pg.draw.rect( screen.fg, posColor, ( int((PgTools.SCREEN_SIZE[0] - length) / 2), int((PgTools.SCREEN_SIZE[1] - height) / 5), length, height, ), ) PgTools.rand_pattern( screen.fg, ( int((PgTools.SCREEN_SIZE[0] - length) * 0.5), int((PgTools.SCREEN_SIZE[1] - height) * 0.2), ), (length, height), patColor, randNums, ) if randShapes: PgTools.rand_shape(screen.fg, ((PgTools.SCREEN_SIZE[0] - length) / 2, (PgTools.SCREEN_SIZE[1] - height) / 5), (stimLength, stimHeight), seed)
def trial_P2(posColor): """ Initiates part 2 of a trial, draws comparison stimuli :param colorPair: pair of random colors for stimuli base colors """ if not sampleStimVis: screen.refresh() global stimList currentLength = int(maxLength / 4) currentHeight = int(maxHeight * 0.4) for i in range(stimAmt): if i == posLocation: stimList.append( pg.draw.rect( screen.fg, posColor, ( currentLength, currentHeight, stimLength, stimHeight, ), )) PgTools.rand_pattern( screen.fg, (currentLength, currentHeight), (stimLength, stimHeight), patColor, randNums, ) if randShapes: PgTools.rand_shape(screen.fg, (currentLength, currentHeight), (stimLength, stimHeight), seed) else: stimList.append( pg.draw.rect( screen.fg, PgTools.rand_color(), ( currentLength, currentHeight, stimLength, stimHeight, ), )) PgTools.rand_pattern(screen.fg, (currentLength, currentHeight), (stimLength, stimHeight), PgTools.rand_color(), (randint(0, 2), randint(0, 2))) if randShapes: PgTools.rand_shape(screen.fg, (currentLength, currentHeight), (stimLength, stimHeight), randint(0, 99999)) currentLength += maxLength / 2 currentLength = int(currentLength) if i == 1: currentLength = int(maxLength / 4) currentHeight = int(maxHeight * 0.8)
def trial(length, height): """ Initiates a new trial, draws stimuli :param length: length of stimuli :param height: height of stimuli """ screen.refresh() global stimList global oddLength global oddHeight currentLength = int(maxLength / 4) currentHeight = int(maxHeight / 4) for i in range(stimAmt): if i == oddLocation: oddLength = currentLength oddHeight = currentHeight stimList.append( pg.draw.rect( screen.fg, PgTools.rand_color(), ( currentLength, currentHeight, length, height, ), )) PgTools.rand_pattern( screen.fg, ( currentLength, currentHeight, ), (length, height), i=(randint(0, 2), randint(0, 1)), ) if randShapes: PgTools.rand_shape(screen.fg, (currentLength, currentHeight), (length, height), oddSeed) else: stimList.append( pg.draw.rect( screen.fg, color, ( currentLength, currentHeight, length, height, ), )) PgTools.rand_pattern( screen.fg, ( currentLength, currentHeight, ), (length, height), patColor, randNums, ) if randShapes: PgTools.rand_shape(screen.fg, (currentLength, currentHeight), (length, height), regSeed) currentLength += maxLength / 4 currentLength = int(currentLength) if (i + 1) % 3 == 0: currentLength = maxLength / 4 currentLength = int(currentLength) currentHeight += maxHeight / 4 currentHeight = int(currentHeight) PgTools.set_cursor(screen, randCorner=True)