def main(): parser = argparse.ArgumentParser() parser.add_argument("--content", help="1: Point To Target" + " 2: Change Detection" + " 3: Odd One Out" + " 4: Visual Search" + " 5: Multiple Object Tracking" + " 6: Random Dot Motion Descrimination", type=int, default=1) args = parser.parse_args() content_type = args.content if content_type == CONTENT_POINT_TO_TARGET: content = PointToTargetContent() elif content_type == CONTENT_CHANGE_DETECTION: content = ChangeDetectionContent() elif content_type == CONTENT_ODD_ONE_OUT: content = OddOneOutContent() elif content_type == CONTENT_VISUAL_SEARCH: content = VisualSearchContent() elif content_type == CONTENT_MULTIPLE_OBJECT_TRACKING: content = MultipleObjectTrackingContent() else: content = RandomDotMotionDiscriminationContent() FPS = 60 display_size = (128 * 4 + 16, 500) inspector = Inspector(content, display_size) clock = pygame.time.Clock() running = True frame_count = 0 if RECORDING: writer = MovieWriter("out.mov", inspector.display_size, FPS) while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False inspector.update() clock.tick(FPS) if RECORDING: d = inspector.get_frame() writer.add_frame(d) frame_count += 1 if frame_count > 1000: running = False if RECORDING: writer.close()
def get_content(content_type): if content_type == Contents.POINT_TO_TARGET: content = PointToTargetContent() elif content_type == Contents.CHANGE_DETECTION: content = ChangeDetectionContent() elif content_type == Contents.ODD_ONE_OUT: content = OddOneOutContent() elif content_type == Contents.VISUAL_SEARCH: content = VisualSearchContent() elif content_type == Contents.MULTIPLE_OBJECT_TRACKING: content = MultipleObjectTrackingContent() else: content = RandomDotMotionDiscriminationContent() return content
from oculoenv import PointToTargetContent, ChangeDetectionContent, OddOneOutContent, VisualSearchContent, MultipleObjectTrackingContent, RandomDotMotionDiscriminationContent from inspector import Inspector import flask from flask import Flask, make_response, send_from_directory from jinja2 import FileSystemLoader from werkzeug.local import Local, LocalManager app = Flask(__name__, static_url_path='') app.secret_key = 'oculomotor' app.jinja_loader = FileSystemLoader(os.getcwd() + '/templates') contents = [ PointToTargetContent(), ChangeDetectionContent(), OddOneOutContent(), VisualSearchContent(), MultipleObjectTrackingContent(), RandomDotMotionDiscriminationContent(), ] display_size = (128 * 4 + 16, 500) class Runner(object): def __init__(self): self.content_id = 0 self.inspector = Inspector(contents[self.content_id], display_size) self.lock = Lock() def step(self):
type=int, default=1) parser.add_argument( "--step_debug", help="Flag to debug execute step by step with one key press", type=bool, default=False) args = parser.parse_args() if args.content == Contents.POINT_TO_TARGET: content = PointToTargetContent() elif args.content == Contents.CHANGE_DETECTION: content = ChangeDetectionContent() elif args.content == Contents.ODD_ONE_OUT: content = OddOneOutContent() elif args.content == Contents.VISUAL_SEARCH: content = VisualSearchContent() elif args.content == Contents.MULTIPLE_OBJECT_TRACKING: content = MultipleObjectTrackingContent() elif args.content == Contents.RANDOM_DOT_MOTION_DISCRIMINATION: content = RandomDotMotionDiscriminationContent() else: print("Unknown argument") sys.exit(1) env = Environment(content) env.render() # env.window is created here handler = KeyHandler(env, args.step_debug)
id='ChangeDetectionSkip-v0', entry_point='gym_oculoenv.oculo:GymOculoEnv', kwargs={'content': ChangeDetectionContent(), 'skip_red_cursor': True} ) register( id='ChangeDetectionRetina-v0', entry_point='gym_oculoenv.oculo:GymOculoEnv', kwargs={'content': ChangeDetectionContent(), 'retina': True} ) # OddOneOut register( id='OddOneOut-v0', entry_point='gym_oculoenv.oculo:GymOculoEnv', kwargs={'content': OddOneOutContent()} ) register( id='OddOneOutSkip-v0', entry_point='gym_oculoenv.oculo:GymOculoEnv', kwargs={'content': OddOneOutContent(), 'skip_red_cursor': True} ) register( id='OddOneOutRetina-v0', entry_point='gym_oculoenv.oculo:GymOculoEnv', kwargs={'content': OddOneOutContent(), 'retina': True} ) # VisualSearch
def make_contents(): return [PointToTargetContent(), ChangeDetectionContent(), OddOneOutContent(), VisualSearchContent(), MultipleObjectTrackingContent(), RandomDotMotionDiscriminationContent()]