def zollner_display(parameters):
    """
    """
    n.image(pyllusion_path + "line_red.png",
            x=parameters["Top_Line_x"],
            y=parameters["Top_Line_y"],
            size=parameters["Top_Line_size"],
            rotate=-parameters["Top_Line_Angle"],
            scale_by="width")
    n.image(pyllusion_path + "line_red.png",
            x=parameters["Bottom_Line_x"],
            y=parameters["Bottom_Line_y"],
            size=parameters["Bottom_Line_size"],
            rotate=-parameters["Bottom_Line_Angle"],
            scale_by="width")

    for i in range(15):
        n.line(left_x=-7.25 + i + parameters["Distractor_Left_x"],
               left_y=2.5 + parameters["Distractor_Left_y"],
               right_x=-7.25 + i + parameters["Distractor_Right_x"],
               right_y=2.5 + parameters["Distractor_Right_y"],
               line_color="black",
               thickness=parameters["Distractor_Thickness"])
    for i in range(15):
        n.line(left_x=-6.75 + i - parameters["Distractor_Left_x"],
               left_y=-2.5 + parameters["Distractor_Left_y"],
               right_x=-6.75 + i - parameters["Distractor_Right_x"],
               right_y=-2.5 + parameters["Distractor_Right_y"],
               line_color="black",
               thickness=parameters["Distractor_Thickness"])
def ponzo_display(parameters):
    """
    """
#    n.line(left_x=-5, left_y=-8, right_x=-1, right_y=8, line_color="black", thickness=parameters["Vertical_Lines_Thickness"])
#    n.line(left_x=1, left_y=8, right_x=5, right_y=-8, line_color="black", thickness=parameters["Vertical_Lines_Thickness"])
    n.image(pyllusion_path + "line.png", x=-3, y=0, size=20, rotate=-90-parameters["Vertical_Line_Angle"], scale_by="width")
    n.image(pyllusion_path + "line.png", x=3, y=0, size=20, rotate=-90+parameters["Vertical_Line_Angle"], scale_by="width")

    n.line(left_x=parameters["Bottom_Line_Left_x"], left_y=parameters["Bottom_Line_Left_y"], right_x=parameters["Bottom_Line_Right_x"], right_y=parameters["Bottom_Line_Right_y"], line_color="red", thickness=parameters["Bottom_Line_Thickness"])
    n.line(left_x=parameters["Top_Line_Left_x"], left_y=parameters["Top_Line_Left_y"], right_x=parameters["Top_Line_Right_x"], right_y=parameters["Top_Line_Right_y"], line_color="red", thickness=parameters["Bottom_Line_Thickness"])
def PDM_response(parameters):
    pygame.mouse.set_visible(True)

    n.newpage("grey")
    pygame.draw.circle(n.screen, n.color("black"),
                       parameters["Mask_Corrdinates"], parameters["Mask_Size"],
                       0)

    angles = np.array([
        parameters["Angle"], parameters["Angle"] + 90,
        parameters["Angle"] + 180, parameters["Angle"] + 270
    ])
    angles[angles > 360] = angles[angles > 360] - 360
    angles = np.sort(angles)

    n.image(pyllusion_path + "arrow.png",
            x=1.5,
            y=-5,
            size=2,
            rotate=angles[0],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=-1.5,
            y=-5,
            size=2,
            rotate=angles[1],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=-1.5,
            y=-8,
            size=2,
            rotate=angles[2],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=1.5,
            y=-8,
            size=2,
            rotate=angles[3],
            scale_by="width")

    n.line(left_x=-10,
           left_y=-6.5,
           right_x=10,
           right_y=-6.5,
           line_color="black",
           thickness=2)
    n.line(left_x=0,
           left_y=-10,
           right_x=0,
           right_y=10,
           line_color="black",
           thickness=2)
    n.refresh()

    loop = True
    while loop == True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                quit()
            x, y = pygame.mouse.get_pos()

            if pygame.mouse.get_pressed() == (1, 0, 0):
                loop = False

    x, y = n.Coordinates.from_pygame(x=x, y=y)
    if x < 0:
        if y < -6.5:
            response = angles[2]
            n.rectangle(x=-1.5,
                        y=-8,
                        width=3,
                        height=3,
                        fill_color="green",
                        thickness=2)
        else:
            response = angles[1]
            n.rectangle(x=-1.5,
                        y=-5,
                        width=3,
                        height=3,
                        fill_color="green",
                        thickness=2)
    else:
        if y < -6.5:
            response = angles[3]
            n.rectangle(x=1.5,
                        y=-8,
                        width=3,
                        height=3,
                        fill_color="green",
                        thickness=2)
        else:
            response = angles[0]
            n.rectangle(x=1.5,
                        y=-5,
                        width=3,
                        height=3,
                        fill_color="green",
                        thickness=2)

    n.image(pyllusion_path + "arrow.png",
            x=1.5,
            y=-5,
            size=2,
            rotate=angles[0],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=-1.5,
            y=-5,
            size=2,
            rotate=angles[1],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=-1.5,
            y=-8,
            size=2,
            rotate=angles[2],
            scale_by="width")
    n.image(pyllusion_path + "arrow.png",
            x=1.5,
            y=-8,
            size=2,
            rotate=angles[3],
            scale_by="width")

    n.line(left_x=-10,
           left_y=-6.5,
           right_x=10,
           right_y=-6.5,
           line_color="black",
           thickness=2)
    n.line(left_x=0,
           left_y=-10,
           right_x=0,
           right_y=10,
           line_color="black",
           thickness=2)

    pygame.draw.circle(n.screen, n.color("black"),
                       parameters["Mask_Corrdinates"], parameters["Mask_Size"],
                       0)
    #    n.write(str(response), color="white")
    n.refresh()
    n.time.wait(50)
    pygame.mouse.set_visible(False)
    return (response)
Exemple #4
0
def TFM_response(parameters):
    pygame.mouse.set_visible(True)

    n.newpage("grey")
    pygame.draw.circle(
        n.screen,
        n.color("black"),
        parameters["Mask_Corrdinates"],
        parameters["Mask_Size"],
        0,
    )

    n.image(
        pyllusion_path + "arrow_grey.png",
        x=-1.7,
        y=-6.2,
        size=2,
        rotate=parameters["Angle"] + 180,
        scale_by="width",
    )
    n.image(
        pyllusion_path + "arrow_grey.png",
        x=-2.3,
        y=-5.8,
        size=2,
        rotate=parameters["Angle"] + 180,
        scale_by="width",
    )
    n.image(
        pyllusion_path + "arrow.png",
        x=-2,
        y=-6,
        size=3,
        rotate=parameters["Angle"],
        scale_by="width",
    )

    n.image(
        pyllusion_path + "arrow_grey.png",
        x=1.7,
        y=-6.2,
        size=2,
        rotate=parameters["Angle"],
        scale_by="width",
    )
    n.image(
        pyllusion_path + "arrow_grey.png",
        x=2.3,
        y=-5.8,
        size=2,
        rotate=parameters["Angle"],
        scale_by="width",
    )
    n.image(
        pyllusion_path + "arrow.png",
        x=2,
        y=-6,
        size=3,
        rotate=parameters["Angle"] + 180,
        scale_by="width",
    )

    n.line(left_x=0,
           left_y=-10,
           right_x=0,
           right_y=10,
           line_color="black",
           thickness=1)
    n.refresh()

    loop = True
    while loop == True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                quit()
            x, y = pygame.mouse.get_pos()

            if pygame.mouse.get_pressed() == (1, 0, 0):
                loop = False

    x, y = n.Coordinates.from_pygame(x=x, y=y)
    if x < 0:
        response_side = "LEFT"
        response = parameters["Angle"]
        n.rectangle(x=-5, width=10, height=20, fill_color="green")
    else:
        response_side = "RIGHT"
        response = parameters["Angle"] + 180
        n.rectangle(x=5, width=10, height=20, fill_color="green")
    if response >= 360:
        response -= 360
    pygame.draw.circle(
        n.screen,
        n.color("black"),
        parameters["Mask_Corrdinates"],
        parameters["Mask_Size"],
        0,
    )
    #    n.write(str(response), color="white")
    n.refresh()
    n.time.wait(50)
    pygame.mouse.set_visible(False)
    return (response, response_side)