コード例 #1
0
def main():
    numOfAgent = 4
    sheepId = 0
    wolfId = 1
    masterId = 2
    distractorId = 3

    manipulatedHyperVariables = co.OrderedDict()
    conditionList = [1, 2, 3, 4]
    #1:Chasing Present Master-Wolf Line; 2:Absent Master-Wolf Line
    #3:Chasing Present Master-Distractor Line; 4:Absent Master-Distractor Line
    manipulatedHyperVariables['ChaseCondition'] = conditionList
    trajetoryIndexList = [-1]
    manipulatedHyperVariables['TrajIndex'] = trajetoryIndexList

    conditionValues = {
        1: [wolfId, masterId],
        2: [wolfId, masterId],
        3: [distractorId, masterId],
        4: [distractorId, masterId]
    }
    print('loading')
    positionIndex = [0, 1]
    FPS = 60
    dataFileDir = '../PataData/withLine'
    rawXRange = [-10, 10]
    rawYRange = [-10, 10]
    scaledXRange = [200, 600]
    scaledYRange = [200, 600]
    scaleTrajectory = ScaleTrajectory(positionIndex, rawXRange, rawYRange,
                                      scaledXRange, scaledYRange)
    oldFPS = 5
    adjustFPS = AdjustDfFPStoTraj(oldFPS, FPS)
    getTrajectory = lambda trajectoryDf: scaleTrajectory(
        adjustFPS(trajectoryDf))
    trajectoryDf = lambda condition, index: pd.read_pickle(
        os.path.join(dataFileDir, '{}'.format(condition) + ' ({}).pickle'.
                     format(index)))
    stimulus = {
        condition: {
            index: getTrajectory(trajectoryDf(condition, index))
            for index in trajetoryIndexList
        }
        for condition in conditionList
    }

    savedataFileDir = '../PataData/withLineRescale'
    [[
        saveToPickle(
            stimulus[condition][index],
            os.path.join(
                savedataFileDir, 'condition={}'.format(condition) +
                '_Index=({}).pickle'.format(index)))
        for index in trajetoryIndexList
    ] for condition in conditionList]

    print('loding success')
コード例 #2
0
def main():
    numOfAgent = 4

    manipulatedVariables = co.OrderedDict()
    # manipulatedVariables['damping'] = [0.0]  # [0.0, 1.0]
    # manipulatedVariables['frictionloss'] = [0.0]  # [0.0, 0.2, 0.4]
    # manipulatedVariables['masterForce'] = [0.0]
    manipulatedVariables['damping'] = [0.0, 0.5]  # [0.0, 1.0]
    manipulatedVariables['frictionloss'] = [1.0]  # [0.0, 0.2, 0.4]
    manipulatedVariables['masterForce'] = [0.0, 1.0]  # [0.0, 2.0]

    chaseTrailVariables = manipulatedVariables.copy()
    catchTrailVariables = manipulatedVariables.copy()
    chaseTrailVariables['hideId'] = [3, 4
                                     ]  #0 wolf 1 sheep 2 master 3 4 distractor
    catchTrailVariables['hideId'] = [1]
    chaseTrailconditions = [
        dict(list(specificValueParameter))
        for specificValueParameter in it.product(
            *[[(key, value) for value in values]
              for key, values in chaseTrailVariables.items()])
    ]
    # chaseTrailconditionsWithId =list (zip(range(len(conditions)),conditions ))
    catchTrailconditions = [
        dict(list(specificValueParameter))
        for specificValueParameter in it.product(
            *[[(key, value) for value in values]
              for key, values in catchTrailVariables.items()])
    ]
    # catchTrailconditionsWithId =list (zip(range(len(conditions)),conditions ))
    # print('state',chaseTrailVariables,catchTrailVariables)
    conditionsWithId = list(
        zip(range(len(chaseTrailconditions) + len(catchTrailconditions)),
            chaseTrailconditions + catchTrailconditions))
    # print(conditionsWithId)
    # conditions = [dict(list(specificValueParameter)) for specificValueParameter in it.product(*[[(key, value) for value in values] for key, values in manipulatedVariables.items()])]
    # conditionsWithId =list (zip(range(len(conditions)),conditions ))
    # print(conditionsWithId)
    conditions = chaseTrailconditions + catchTrailconditions
    conditions = [
        condition.update({'conditionId': condtionId})
        for condtionId, condition in zip(range(len(conditions)), conditions)
    ]
    # print (conditions)

    chaseTrailTrajetoryIndexList = range(2)
    chaseTrailManipulatedVariablesForExp = co.OrderedDict()
    chaseTrailManipulatedVariablesForExp['conditonId'] = range(
        len(chaseTrailconditions))
    chaseTrailManipulatedVariablesForExp[
        'trajetoryIndex'] = chaseTrailTrajetoryIndexList
    chaseTrailProductedValues = it.product(
        *[[(key, value) for value in values]
          for key, values in chaseTrailManipulatedVariablesForExp.items()])

    catchTrailTrajetoryIndexList = range(1)
    catchTrailManipulatedVariablesForExp = co.OrderedDict()
    catchTrailManipulatedVariablesForExp['conditonId'] = range(
        len(chaseTrailconditions),
        len(chaseTrailconditions) + len(catchTrailconditions))
    catchTrailManipulatedVariablesForExp[
        'trajetoryIndex'] = catchTrailTrajetoryIndexList
    catchTrailProductedValues = it.product(
        *[[(key, value) for value in values]
          for key, values in catchTrailManipulatedVariablesForExp.items()])

    # print(productedValues)
    exprimentVarableList = [
        dict(list(specificValueParameter))
        for specificValueParameter in chaseTrailProductedValues
    ] + [
        dict(list(specificValueParameter))
        for specificValueParameter in catchTrailProductedValues
    ]

    [
        exprimentVarable.update(
            {'condition': conditionsWithId[exprimentVarable['conditonId']][1]})
        for exprimentVarable in exprimentVarableList
    ]
    # exprimentVarableList = [exprimentVarable.update({'condition': conditionsWithId[exprimentVarable['conditonId']][1]}) for exprimentVarable in exprimentVarableList ]
    print(exprimentVarableList)
    print(len(exprimentVarableList))
    numOfBlock = 1
    numOfTrialsPerBlock = 1
    designValues = createDesignValues(
        exprimentVarableList * numOfTrialsPerBlock, numOfBlock)

    positionIndex = [0, 1]
    FPS = 50
    rawXRange = [-1, 1]
    rawYRange = [-1, 1]
    scaledXRange = [200, 600]
    scaledYRange = [200, 600]
    scaleTrajectoryInSpace = ScaleTrajectory(positionIndex, rawXRange,
                                             rawYRange, scaledXRange,
                                             scaledYRange)
    oldFPS = 50
    numFramesToInterpolate = int(FPS / oldFPS - 1)
    interpolateState = InterpolateState(numFramesToInterpolate)

    scaleTrajectoryInTime = ScaleTrajectoryInTime(interpolateState)

    trajectoriesSaveDirectory = '../PataData/mujoco50Fps4Agent'
    # trajectoriesSaveDirectory =os.path.join(dataFolder, 'trajectory', modelSaveName)
    trajectorySaveExtension = '.pickle'

    evaluateEpisode = 120000
    evalNum = 20
    fixedParameters = {
        'distractorNoise': 3.0,
        'evaluateEpisode': evaluateEpisode
    }
    generateTrajectoryLoadPath = GetSavePath(trajectoriesSaveDirectory,
                                             trajectorySaveExtension,
                                             fixedParameters)
    trajectoryDf = lambda condition: pd.read_pickle(
        generateTrajectoryLoadPath({
            'hideId': condition['hideId'],
            'damping': condition['damping'],
            'frictionloss': condition['frictionloss'],
            'masterForce': condition['masterForce'],
            'evalNum': evalNum,
        }))
    # trajectoryDf = lambda condition: pd.read_pickle(generateTrajectoryLoadPath(condition))
    getTrajectory = lambda trajectoryDf: scaleTrajectoryInTime(
        scaleTrajectoryInSpace(trajectoryDf))
    # getTrajectory = lambda trajectoryDf: scaleTrajectoryInSpace(trajectoryDf)

    print('loading')
    stimulus = {
        conditionId: getTrajectory(trajectoryDf(condition))
        for conditionId, condition in conditionsWithId
    }
    print(stimulus[0][0][0])
    print(stimulus[10][0][0])
    print('loding success')

    # print(stimulus[1][1])
    experimentValues = co.OrderedDict()
    experimentValues["name"] = input("Please enter your name:").capitalize()

    screenWidth = 800
    screenHeight = 800

    fullScreen = False
    initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen)
    screen = initializeScreen()

    leaveEdgeSpace = 200
    circleSize = 10
    clickImageHeight = 80
    lineWidth = 3
    fontSize = 50
    xBoundary = [leaveEdgeSpace, screenWidth - leaveEdgeSpace * 2]
    yBoundary = [leaveEdgeSpace, screenHeight - leaveEdgeSpace * 2]

    screenColor = THECOLORS['black']
    lineColor = THECOLORS['white']
    textColor = THECOLORS['white']
    fixationPointColor = THECOLORS['white']

    colorSpace = [(203, 164, 4, 255), (49, 153, 0, 255), (255, 90, 16, 255),
                  (251, 7, 255, 255), (9, 204, 172, 255), (3, 28, 255, 255)]

    picturePath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'pictures')
    resultsPath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'results')

    introductionImage1 = pygame.image.load(
        os.path.join(picturePath, 'mujocoIntro1.png'))
    introductionImage2 = pygame.image.load(
        os.path.join(picturePath, 'mujocoIntro2.png'))
    finishImage = pygame.image.load(os.path.join(picturePath, 'over.jpg'))
    introductionImage1 = pygame.transform.scale(introductionImage1,
                                                (screenWidth, screenHeight))
    introductionImage2 = pygame.transform.scale(introductionImage2,
                                                (screenWidth, screenHeight))

    finishImage = pygame.transform.scale(
        finishImage, (int(screenWidth * 2 / 3), int(screenHeight / 4)))
    clickWolfImage = pygame.image.load(
        os.path.join(picturePath, 'clickwolf.png'))
    clickSheepImage = pygame.image.load(
        os.path.join(picturePath, 'clicksheep.png'))
    restImage = pygame.image.load(os.path.join(picturePath, 'rest.jpg'))

    drawImage = DrawImage(screen)
    drawText = DrawText(screen, fontSize, textColor)
    drawBackGround = DrawBackGround(screen, screenColor, xBoundary, yBoundary,
                                    lineColor, lineWidth)
    drawFixationPoint = DrawFixationPoint(screen, drawBackGround,
                                          fixationPointColor)
    drawImageClick = DrawImageClick(screen, clickImageHeight, drawText)

    drawState = DrawState(screen, circleSize, numOfAgent, positionIndex,
                          drawBackGround)
    # drawStateWithRope = DrawStateWithRope(screen, circleSize, numOfAgent, positionIndex, ropeColor, drawBackground)

    writerPath = os.path.join(resultsPath, experimentValues["name"]) + '.csv'
    writer = WriteDataFrameToCSV(writerPath)

    displayFrames = 500
    keysForCheck = {'f': 0, 'j': 1}
    checkHumanResponse = CheckHumanResponse(keysForCheck)
    trial = ChaseTrialMujoco(conditionsWithId, displayFrames, drawState,
                             drawImage, stimulus, checkHumanResponse,
                             colorSpace, numOfAgent, drawFixationPoint,
                             drawText, drawImageClick, clickWolfImage,
                             clickSheepImage, FPS)

    experiment = Experiment(trial, writer, experimentValues, drawImage,
                            restImage, drawBackGround)

    restDuration = 20

    drawImage(introductionImage1)
    drawImage(introductionImage2)

    experiment(designValues, restDuration)
    # self.darwBackground()
    drawImage(finishImage)

    print("Result saved at {}".format(writerPath))
コード例 #3
0
def main():
    numOfAgent = 4
    sheepId = 0
    wolfId = 1
    masterId = 2
    distractorId = 3

    manipulatedHyperVariables = co.OrderedDict()
    conditionList = [1, 2, 3, 4]
    #1:Chasing Present Master-Wolf Line; 2:Absent Master-Wolf Line
    #3:Chasing Present Master-Distractor Line; 4:Absent Master-Distractor Line
    manipulatedHyperVariables['ChaseCondition'] = conditionList
    trajetoryIndexList = range(20)
    manipulatedHyperVariables['TrajIndex'] = trajetoryIndexList

    conditionValues = {
        1: [wolfId, masterId],
        2: [wolfId, masterId],
        3: [distractorId, masterId],
        4: [distractorId, masterId]
    }

    print('loading')
    positionIndex = [0, 1]
    FPS = 60
    dataFileDir = '../PataData/withLineRescale'
    rawXRange = [-10, 10]
    rawYRange = [-10, 10]
    scaledXRange = [200, 600]
    scaledYRange = [200, 600]
    scaleTrajectory = ScaleTrajectory(positionIndex, rawXRange, rawYRange,
                                      scaledXRange, scaledYRange)
    oldFPS = 5
    adjustFPS = AdjustDfFPStoTraj(oldFPS, FPS)
    # getTrajectory = lambda trajectoryDf: scaleTrajectory(adjustFPS(trajectoryDf))
    # trajectoryDf = lambda condition,index: pd.read_pickle(os.path.join(dataFileDir, '{}'.format(condition)+' ({}).pickle'.format(index)))
    # stimulus = {condition:[getTrajectory(trajectoryDf(condition,index)) for index in trajetoryIndexList] for condition in conditionList}
    trajectoryDf = lambda condition, index: pd.read_pickle(
        os.path.join(
            dataFileDir, 'condition={}'.format(condition) +
            '_Index=({}).pickle'.format(index)))
    stimulus = {
        condition: {
            index: trajectoryDf(condition, index)
            for index in trajetoryIndexList
        }
        for condition in conditionList
    }

    print('loding success')

    experimentValues = co.OrderedDict()
    experimentValues["name"] = input("Please enter your name:").capitalize()
    # experimentValues["name"]='test'
    screenWidth = 800
    screenHeight = 800

    fullScreen = True
    initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen)
    screen = initializeScreen()

    leaveEdgeSpace = 200
    circleSize = 10
    clickImageHeight = 80
    lineWidth = 3
    fontSize = 50
    xBoundary = [leaveEdgeSpace, screenWidth - leaveEdgeSpace * 2]
    yBoundary = [leaveEdgeSpace, screenHeight - leaveEdgeSpace * 2]

    screenColor = THECOLORS['black']
    lineColor = THECOLORS['white']
    textColor = THECOLORS['white']
    fixationPointColor = THECOLORS['white']

    colorSpace = [(203, 164, 4, 255), (49, 153, 0, 255), (255, 90, 16, 255),
                  (251, 7, 255, 255), (9, 204, 172, 255), (3, 28, 255, 255)]

    picturePath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'pictures')
    resultsPath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'results')

    introductionImage1 = pygame.image.load(
        os.path.join(picturePath, 'withLineIntroduction1.png'))
    introductionImage2 = pygame.image.load(
        os.path.join(picturePath, 'introduction2.png'))
    finishImage = pygame.image.load(os.path.join(picturePath, 'over.jpg'))
    introductionImage1 = pygame.transform.scale(introductionImage1,
                                                (screenWidth, screenHeight))
    introductionImage2 = pygame.transform.scale(introductionImage2,
                                                (screenWidth, screenHeight))

    finishImage = pygame.transform.scale(
        finishImage, (int(screenWidth * 2 / 3), int(screenHeight / 4)))
    clickWolfImage = pygame.image.load(
        os.path.join(picturePath, 'clickwolf.png'))
    clickSheepImage = pygame.image.load(
        os.path.join(picturePath, 'clicksheep.png'))
    restImage = pygame.image.load(os.path.join(picturePath, 'rest.jpg'))

    drawImage = DrawImage(screen)
    drawText = DrawText(screen, fontSize, textColor)
    drawBackGround = DrawBackGround(screen, screenColor, xBoundary, yBoundary,
                                    lineColor, lineWidth)
    drawFixationPoint = DrawFixationPoint(screen, drawBackGround,
                                          fixationPointColor)
    drawImageClick = DrawImageClick(screen, clickImageHeight, drawText)

    ropeColor = THECOLORS['grey']
    ropeWidth = 4
    numRopePart = 9
    ropePartIndex = list(range(numOfAgent, numOfAgent + numRopePart))
    drawStateWithRope = DrawStateWithRope(screen, circleSize, numOfAgent,
                                          positionIndex, ropePartIndex,
                                          ropeColor, ropeWidth, drawBackGround)

    writerPath = os.path.join(resultsPath, experimentValues["name"]) + '.csv'
    writer = WriteDataFrameToCSV(writerPath)

    displayFrames = FPS * 20
    keysForCheck = {'f': 0, 'j': 1}
    checkHumanResponse = CheckHumanResponse(keysForCheck)
    #trial = ChaseTrial(conditionList,displayFrames, drawState, drawImage, stimulus, checkHumanResponse, colorSpace, numOfAgent, drawFixationPoint, drawText, drawImageClick, clickWolfImage, clickSheepImage, FPS)
    trial = ChaseTrialWithRope(conditionValues, displayFrames,
                               drawStateWithRope, drawImage, stimulus,
                               checkHumanResponse, colorSpace, numOfAgent,
                               drawFixationPoint, drawText, drawImageClick,
                               clickWolfImage, clickSheepImage, FPS)

    experiment = Experiment(trial, writer, experimentValues, drawImage,
                            restImage, drawBackGround)

    numOfBlock = 1
    numOfTrialsPerBlock = 1
    exprimentVarableList = crateVariableProduct(manipulatedHyperVariables)
    designValues = createDesignValues(
        exprimentVarableList * numOfTrialsPerBlock, numOfBlock)

    drawImage(introductionImage1)
    drawImage(introductionImage2)

    restDuration = 20
    experiment(designValues, restDuration)
    # self.darwBackground()
    drawImage(finishImage)

    print("Result saved at {}".format(writerPath))
コード例 #4
0
def main():
    numOfAgent = 4

    manipulatedVariables = co.OrderedDict()
    # manipulatedVariables['damping'] = [0.0]  # [0.0, 1.0]
    # manipulatedVariables['frictionloss'] = [0.0]  # [0.0, 0.2, 0.4]
    # manipulatedVariables['masterForce'] = [0.0]
    manipulatedVariables['damping'] = [0.0, 0.5]  # [0.0, 1.0]
    manipulatedVariables['frictionloss'] = [1.0]  # [0.0, 0.2, 0.4]
    manipulatedVariables['masterForce'] = [0.0]  # [0.0, 2.0]
    manipulatedVariables['offset'] = [0.0, 1.0]
    manipulatedVariables['hideId'] = [3, 4]
    manipulatedVariables['fps'] = [40, 50]
    manipulatedVariables['displayTime'] = [10, 15]

    chaseTrailVariables = manipulatedVariables.copy()
    # catchTrailVariables = manipulatedVariables.copy()
    # chaseTrailVariables['hideId'] = [3,4] #0 wolf 1 sheep 2 master 3 4 distractor
    # catchTrailVariables['hideId'] = [1]
    chaseTrailconditions = [
        dict(list(specificValueParameter))
        for specificValueParameter in it.product(
            *[[(key, value) for value in values]
              for key, values in chaseTrailVariables.items()])
    ]
    # catchTrailconditions = [dict(list(specificValueParameter)) for specificValueParameter in it.product(*[[(key, value) for value in values] for key, values in catchTrailVariables.items()])]

    conditionsWithId = list(
        zip(range(len(chaseTrailconditions)), chaseTrailconditions))
    print(conditionsWithId)
    conditions = chaseTrailconditions
    conditions = [
        condition.update({'conditionId': condtionId})
        for condtionId, condition in zip(range(len(conditions)), conditions)
    ]

    chaseTrailNum = 10
    chaseTrailTrajetoryIndexList = range(chaseTrailNum)
    chaseTrailManipulatedVariablesForExp = co.OrderedDict()
    chaseTrailManipulatedVariablesForExp['conditonId'] = range(
        len(chaseTrailconditions))
    chaseTrailManipulatedVariablesForExp[
        'trajetoryIndex'] = chaseTrailTrajetoryIndexList
    chaseTrailProductedValues = it.product(
        *[[(key, value) for value in values]
          for key, values in chaseTrailManipulatedVariablesForExp.items()])

    # catchTrailNum = 0
    # catchTrailTrajetoryIndexList = range (catchTrailNum)
    # catchTrailManipulatedVariablesForExp =  co.OrderedDict()
    # catchTrailManipulatedVariablesForExp['conditonId'] = range(len(chaseTrailconditions),len(chaseTrailconditions)+len(catchTrailconditions))
    # catchTrailManipulatedVariablesForExp['trajetoryIndex'] = catchTrailTrajetoryIndexList
    # catchTrailProductedValues = it.product(*[[(key, value) for value in values] for key, values in catchTrailManipulatedVariablesForExp.items()])

    # print(productedValues)
    exprimentVarableList = [
        dict(list(specificValueParameter))
        for specificValueParameter in chaseTrailProductedValues
    ]

    [
        exprimentVarable.update(
            {'condition': conditionsWithId[exprimentVarable['conditonId']][1]})
        for exprimentVarable in exprimentVarableList
    ]
    # exprimentVarableList = [exprimentVarable.update({'condition': conditionsWithId[exprimentVarable['conditonId']][1]}) for exprimentVarable in exprimentVarableList ]
    # print(exprimentVarableList)
    # print(len(exprimentVarableList))
    numOfBlock = 1
    numOfTrialsPerBlock = 1
    isShuffle = True
    designValues = createDesignValues(
        exprimentVarableList * numOfTrialsPerBlock, numOfBlock, isShuffle)

    positionIndex = [0, 1]
    standardFPS = 50
    rawXRange = [200, 600]
    rawYRange = [200, 600]
    scaledXRange = [200, 600]
    scaledYRange = [200, 600]
    scaleTrajectoryInSpace = ScaleTrajectory(positionIndex, rawXRange,
                                             rawYRange, scaledXRange,
                                             scaledYRange)
    oldFPS = 50
    numFramesToInterpolate = int(standardFPS / oldFPS - 1)
    interpolateState = InterpolateState(numFramesToInterpolate)
    scaleTrajectoryInTime = ScaleTrajectoryInTime(interpolateState)
    horizontalRotationTransformTrajectory = HorizontalRotationTransformTrajectory(
        positionIndex, rawXRange, rawYRange)
    rotationTransformTrajectory = RotationTransformTrajectory(
        positionIndex, rawXRange, rawYRange)

    def transFormTrajectory(trajList, randomId):
        randomSeed = np.mod(randomId, 8)
        rotationAngle = np.mod(randomSeed, 4) * np.pi / 2
        rotationTraj = rotationTransformTrajectory(trajList, rotationAngle)
        # if np.mod(randomSeed//4,2) ==1:
        # finalTrajs = horizontalRotationTransformTrajectory(rotationTraj)
        # else:
        finalTrajs = rotationTraj
        return finalTrajs

    trajectoriesSaveDirectory = '../PataData/exp2Traj'
    # trajectoriesSaveDirectory =os.path.join(dataFolder, 'trajectory', modelSaveName)
    trajectorySaveExtension = '.pickle'

    selctDict = {3: chaseTrailNum, 4: chaseTrailNum}
    evaluateEpisode = 120000
    evalNum = 20
    fixedParameters = {
        'distractorNoise': 3.0,
        'evaluateEpisode': evaluateEpisode
    }
    generateTrajectoryLoadPath = GetSavePath(trajectoriesSaveDirectory,
                                             trajectorySaveExtension,
                                             fixedParameters)
    trajectoryDf = lambda condition: loadFromPickle(
        generateTrajectoryLoadPath({
            'offset': condition['offset'],
            'hideId': condition['hideId'],
            'damping': condition['damping'],
            'frictionloss': condition['frictionloss'],
            'masterForce': condition['masterForce'],
            'select': selctDict[condition['hideId']]
        }))

    getTrajectory = lambda trajectoryDf: scaleTrajectoryInTime(
        scaleTrajectoryInSpace(trajectoryDf))

    print('loading')
    # stimulus = {conditionId:getTrajectory(trajectoryDf(condition))  for conditionId,condition in conditionsWithId}
    #
    transformedStimulus = {
        conditionId:
        transFormTrajectory(getTrajectory(trajectoryDf(condition)),
                            conditionId)
        for conditionId, condition in conditionsWithId
    }
    print('loding success')
    print(len(transformedStimulus[1]))
    experimentValues = co.OrderedDict()
    experimentValues["name"] = input("Please enter your name:").capitalize()

    screenWidth = 800
    screenHeight = 800

    fullScreen = True
    initializeScreen = InitializeScreen(screenWidth, screenHeight, fullScreen)
    screen = initializeScreen()

    leaveEdgeSpace = 180
    circleSize = 10
    clickImageHeight = 80
    lineWidth = 3
    fontSize = 50
    xBoundary = [leaveEdgeSpace, screenWidth - leaveEdgeSpace * 2]
    yBoundary = [leaveEdgeSpace, screenHeight - leaveEdgeSpace * 2]

    screenColor = THECOLORS['black']
    lineColor = THECOLORS['white']
    textColor = THECOLORS['white']
    fixationPointColor = THECOLORS['white']

    colorSpace = [(203, 164, 4, 255), (49, 153, 0, 255), (255, 90, 16, 255),
                  (251, 7, 255, 255), (9, 204, 172, 255), (3, 28, 255, 255)]

    picturePath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'pictures')
    resultsPath = os.path.join(
        os.path.abspath(os.path.join(os.getcwd(), os.pardir)), 'results',
        'exp2')
    if not os.path.exists(resultsPath):
        os.makedirs(resultsPath)
    introductionImage1 = pygame.image.load(
        os.path.join(picturePath, 'IdOnlyIntro1.png'))
    introductionImage2 = pygame.image.load(
        os.path.join(picturePath, 'IdOnlyIntro2.png'))
    finishImage = pygame.image.load(os.path.join(picturePath, 'over.jpg'))
    introductionImage1 = pygame.transform.scale(introductionImage1,
                                                (screenWidth, screenHeight))
    introductionImage2 = pygame.transform.scale(introductionImage2,
                                                (screenWidth, screenHeight))

    finishImage = pygame.transform.scale(
        finishImage, (int(screenWidth * 2 / 3), int(screenHeight / 4)))
    clickWolfImage = pygame.image.load(
        os.path.join(picturePath, 'clickwolf.png'))
    clickSheepImage = pygame.image.load(
        os.path.join(picturePath, 'clicksheep.png'))
    restImage = pygame.image.load(os.path.join(picturePath, 'rest.jpg'))

    drawImage = DrawImage(screen)
    drawText = DrawText(screen, fontSize, textColor)
    drawBackGround = DrawBackGround(screen, screenColor, xBoundary, yBoundary,
                                    lineColor, lineWidth)
    drawFixationPoint = DrawFixationPoint(screen, drawBackGround,
                                          fixationPointColor)
    drawImageClick = DrawImageClick(screen, clickImageHeight, drawText)

    drawState = DrawState(screen, circleSize, numOfAgent, positionIndex,
                          drawBackGround)

    writerPath = os.path.join(resultsPath, experimentValues["name"]) + '.csv'
    writer = WriteDataFrameToCSV(writerPath)

    # displayFrames = 500
    reactionWindowStart = 50
    keysForCheck = {'space': 1}
    checkHumanResponse = CheckHumanResponseWithSpace(keysForCheck)
    trial = ChaseTrialMujocoFps(conditionsWithId, reactionWindowStart,
                                drawState, drawImage, transformedStimulus,
                                checkHumanResponse, colorSpace, numOfAgent,
                                drawFixationPoint, drawText, drawImageClick,
                                clickWolfImage, clickSheepImage)

    experiment = Experiment(trial, writer, experimentValues, drawImage,
                            restImage, drawBackGround)

    restDuration = 120

    drawImage(introductionImage1)
    drawImage(introductionImage2)

    experiment(designValues, restDuration)
    # self.darwBackground()
    drawImage(finishImage)

    print("Result saved at {}".format(writerPath))