{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c3600838",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "nbsphinx": "hidden",
    "tags": []
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "import os\n",
    "\n",
    "sys.path.append('../../../')\n",
    "\n",
    "from bci_framework.utils import Paradigm\n",
    "from matplotlib import pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "eefd6ef7",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true,
     "source_hidden": true
    },
    "nbsphinx": "hidden",
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25596 characters]\n",
      "text/plain": [
       "<Figure size 900x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(10, 4), dpi=90)\n",
    "\n",
    "paradigm = (\n",
    "    {\n",
    "        'time': (-3, 0),\n",
    "        'level': (0.5, 1),        \n",
    "        'label': 'Fixation cross',\n",
    "        'color': 'C0',\n",
    "    },\n",
    "    {\n",
    "        'time': (0, -1, -3),\n",
    "        'level': (0, 0.5),    \n",
    "        'label': 'Stimulus onset\\nasynchronously',\n",
    "        'color': 'C3',\n",
    "    },       \n",
    "    {\n",
    "        'time': (0, 4),\n",
    "        'label': 'Cue',\n",
    "        'color': 'C2',\n",
    "        'marker': {\n",
    "            'label': 'Marker streamed',\n",
    "            'width': 2,\n",
    "            'level': 1,\n",
    "        }\n",
    "    },   \n",
    ")\n",
    "\n",
    "Paradigm.build_paradigm(paradigm)\n",
    "plt.savefig('paradigm.png')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be339d5a",
   "metadata": {},
   "source": [
    "# 4-Class motor imagery (Pacman)\n",
    "\n",
    "Implemented through extensions systems in the [PacmanMotorImagery](../../../../_modules/bci_framework.default_extensions.Class_motor_imagery_Pacman.main.rst) module.\n",
    "\n",
    "<img src='paradigm.png'></img>\n",
    "\n",
    "This cue-based BCI paradigm consisted of up to four different motor imagery tasks, represented by the classic Pacman character displacements and separated with an asynchronous break. This paradigm implements a clean interface, unlike the game-like design used in <cite data-footcite=\"perdikis2014subject\">perdikis2014subject</cite>.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b0c341d0",
   "metadata": {},
   "source": [
    "## Configuration options\n",
    "\n",
    "<img src='../../../images/extensions/4class_mi_pacman.gif'></img>\n",
    "\n",
    "**Cues:**  \n",
    "Is possible to select up to 4 classes, represented by one arrow. All 4 classes are active by default.\n",
    "\n",
    "**Trials per class:**  \n",
    "How many trials per class will contain the run. Between 1 and 100, 10 by default.\n",
    "\n",
    "**Stimulus onset asynchronously:**  \n",
    "To prevent fixed time between trials. A range between 1000 and 3000 ms, (2000-3000) by default. This means that for each trial a random number (with uniform distribution) is generated between this range and used as inter stimulus interval."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb3db91e",
   "metadata": {},
   "source": [
    "### References\n",
    ".. footbibliography::"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
