Basic architecture — psychopy_ext 0.5.4 documentation
Author: Jonas Kubilius
Description: A framework for a rapid reproducible design, analysis and plotting of experiments in neuroscience and psychology

# Basic architecture

Functions in bold are mandatory to define. Everything else just works.

- A Project (accessible via the command line or graphic user interface)
  - Control interface: `Control`
    - Choices of things to do: `Choices` - path to modyle to run, e.g., ‘scripts.main’ - name of experiment - alias to access experiment via command line - order of possible tasks (methods) to run
    - Initialization
      - Docstring to describe the experiment for participants
      - Call parent class: `super(MyExp, self).__init__()`
      - Define global parameters, like `self.stim_size = 3`
      - Redefine computer parameters, usually `self.computer.valid_responses`
      - Redefine `self.paths`
      - Define tasks in the experiment, if any: `self.tasks = []`
    - Setup: `setup()`
      - Collect run time information: `psychopy.info.RunTimeInfo()`
      - Set random seed
      - Set logging: `set_logging()`
      - Create `psychopy.visualWindow`: `create_win()`
    - Define tasks (inherit from `Task` or define within the experiment class if there is a single task only)
      - Initialization
        - Docstring to describe the task for participants
        - Call parent class: `super(MyExp, self).__init__()`
        - Define which column in `self.exp_plan` determines splitting into blocks (`self.blockcol`)
        - Define global parameters, like `self.stim_size = 3`
        - Redefine computer parameters, usually `self.computer.valid_responses`
        - Define data file name
      - Setup: `setup_task()`
        - Inherit properties from parent
        - Create stimuli: `create_stimuli()`
          - Create fixation: `create_fixation()`
          - Define your own stimuli
        - Create trial: `create_trial()`
          - Define events: `Event`
            - Duration
            - Display (which stimulus type is presented)
            - Default function (what to do during the event)
              - Do nothing: `idle_event()`
              - Wait until response: `wait_until_response()`
              - Give feedback: `feedback()`
              - Or define your own
        - Create experimental plan: `create_exp_plan()`
        - Determine if stimulus presentation should be controlled by global timing
        - Set up auto run
        - Split into blocks: `get_blocks()`
    - Run: `run()`
      - Show instructions: `before_exp()`
      - Loop over tasks: `run_task()`
        - Show instructions: `before_task()`
        - Loop over blocks: `before_task()`
          - Show instructions: `before_block()`
          - Loop over trials: `run_trial()`
            - Loop over events: `run_event()`
              - Execute the default function
              - Register responses and their timing (with respect to the onset of the trial)
            - Record accuracy and response time: `post_trial()`
          - Wait between blocks: `after_block()`
        - Wait between tasks: `after_task()`
      - Show a “thank you” at the end: `after_exp()`
      - Push data to a repository
  - Analysis
    - Get data: `get_behav_df()`
    - Aggregate data: `aggregate()` or `accuracy()`
    - Plot:
      - Initialize plot: `Plot`
      - Plot: `plot()`
      - Show plot: `show()`
  - Simulation:
    - Get images of stimuli
    - Choose a model from `models`
    - Run it, e.g., `run()`