Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "from cmlreaders import CMLReader, get_data_index"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Loading an ltpFR2 subject:\n",
- "Events load properly, however eeg does not load. There's an ValueError of \"split EEG filenames don't seem to match what are in the events\"\n",
- "\n",
- "Within the subject folder the eeg folder appears to have no eeg.reref or eeg.noreref anymore\n",
- "\n",
- "Issue appears on many subjects"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array(['LTP093', 'LTP106', 'LTP115', 'LTP117', 'LTP122'], dtype=object)"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>eegoffset</th>\n",
- " <th>answer</th>\n",
- " <th>begin_distractor</th>\n",
- " <th>begin_math_correct</th>\n",
- " <th>eegfile</th>\n",
- " <th>eogArtifact</th>\n",
- " <th>experiment</th>\n",
- " <th>final_distractor</th>\n",
- " <th>final_math_correct</th>\n",
- " <th>intruded</th>\n",
- " <th>...</th>\n",
- " <th>mstime</th>\n",
- " <th>protocol</th>\n",
- " <th>recalled</th>\n",
- " <th>rectime</th>\n",
- " <th>serialpos</th>\n",
- " <th>session</th>\n",
- " <th>subject</th>\n",
- " <th>test</th>\n",
- " <th>trial</th>\n",
- " <th>type</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>132641</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>-1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>...</td>\n",
- " <td>1410203839373</td>\n",
- " <td>ltp</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[-999, -999, -999]</td>\n",
- " <td>-999</td>\n",
- " <td>START</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>132666</td>\n",
- " <td>13</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>-1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>...</td>\n",
- " <td>1410203839423</td>\n",
- " <td>ltp</td>\n",
- " <td>-999</td>\n",
- " <td>2404</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[7, 4, 2]</td>\n",
- " <td>-999</td>\n",
- " <td>PROB</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>133904</td>\n",
- " <td>19</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>-1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>...</td>\n",
- " <td>1410203841899</td>\n",
- " <td>ltp</td>\n",
- " <td>-999</td>\n",
- " <td>2193</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[5, 6, 8]</td>\n",
- " <td>-999</td>\n",
- " <td>PROB</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>135040</td>\n",
- " <td>14</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>-1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>...</td>\n",
- " <td>1410203844170</td>\n",
- " <td>ltp</td>\n",
- " <td>-999</td>\n",
- " <td>1433</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[2, 4, 8]</td>\n",
- " <td>-999</td>\n",
- " <td>PROB</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>135795</td>\n",
- " <td>26</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>-1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>-999</td>\n",
- " <td>...</td>\n",
- " <td>1410203845680</td>\n",
- " <td>ltp</td>\n",
- " <td>-999</td>\n",
- " <td>2211</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[7, 8, 7]</td>\n",
- " <td>-999</td>\n",
- " <td>PROB</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>5 rows × 27 columns</p>\n",
- "</div>"
- ],
- "text/plain": [
- " eegoffset answer begin_distractor begin_math_correct \\\n",
- "0 132641 -999 -999 -999 \n",
- "1 132666 13 -999 -999 \n",
- "2 133904 19 -999 -999 \n",
- "3 135040 14 -999 -999 \n",
- "4 135795 26 -999 -999 \n",
- "\n",
- " eegfile eogArtifact experiment \\\n",
- "0 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
- "1 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
- "2 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
- "3 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
- "4 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
- "\n",
- " final_distractor final_math_correct intruded ... mstime \\\n",
- "0 -999 -999 -999 ... 1410203839373 \n",
- "1 -999 -999 -999 ... 1410203839423 \n",
- "2 -999 -999 -999 ... 1410203841899 \n",
- "3 -999 -999 -999 ... 1410203844170 \n",
- "4 -999 -999 -999 ... 1410203845680 \n",
- "\n",
- " protocol recalled rectime serialpos session subject \\\n",
- "0 ltp -999 -999 -999 1 LTP093 \n",
- "1 ltp -999 2404 -999 1 LTP093 \n",
- "2 ltp -999 2193 -999 1 LTP093 \n",
- "3 ltp -999 1433 -999 1 LTP093 \n",
- "4 ltp -999 2211 -999 1 LTP093 \n",
- "\n",
- " test trial type \n",
- "0 [-999, -999, -999] -999 START \n",
- "1 [7, 4, 2] -999 PROB \n",
- "2 [5, 6, 8] -999 PROB \n",
- "3 [2, 4, 8] -999 PROB \n",
- "4 [7, 8, 7] -999 PROB \n",
- "\n",
- "[5 rows x 27 columns]"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>eegoffset</th>\n",
- " <th>answer</th>\n",
- " <th>begin_distractor</th>\n",
- " <th>begin_math_correct</th>\n",
- " <th>eegfile</th>\n",
- " <th>eogArtifact</th>\n",
- " <th>experiment</th>\n",
- " <th>final_distractor</th>\n",
- " <th>final_math_correct</th>\n",
- " <th>intruded</th>\n",
- " <th>...</th>\n",
- " <th>mstime</th>\n",
- " <th>protocol</th>\n",
- " <th>recalled</th>\n",
- " <th>rectime</th>\n",
- " <th>serialpos</th>\n",
- " <th>session</th>\n",
- " <th>subject</th>\n",
- " <th>test</th>\n",
- " <th>trial</th>\n",
- " <th>type</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>7</th>\n",
- " <td>169632</td>\n",
- " <td>-999</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>0</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>1</td>\n",
- " <td>11</td>\n",
- " <td>0</td>\n",
- " <td>...</td>\n",
- " <td>1410203913351</td>\n",
- " <td>ltp</td>\n",
- " <td>1</td>\n",
- " <td>-999</td>\n",
- " <td>1</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[0, 0, 0]</td>\n",
- " <td>1</td>\n",
- " <td>WORD</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>8</th>\n",
- " <td>170937</td>\n",
- " <td>-999</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>3</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>1</td>\n",
- " <td>11</td>\n",
- " <td>0</td>\n",
- " <td>...</td>\n",
- " <td>1410203915961</td>\n",
- " <td>ltp</td>\n",
- " <td>1</td>\n",
- " <td>-999</td>\n",
- " <td>2</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[0, 0, 0]</td>\n",
- " <td>1</td>\n",
- " <td>WORD</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9</th>\n",
- " <td>172292</td>\n",
- " <td>-999</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>3</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>1</td>\n",
- " <td>11</td>\n",
- " <td>0</td>\n",
- " <td>...</td>\n",
- " <td>1410203918671</td>\n",
- " <td>ltp</td>\n",
- " <td>1</td>\n",
- " <td>-999</td>\n",
- " <td>3</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[0, 0, 0]</td>\n",
- " <td>1</td>\n",
- " <td>WORD</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10</th>\n",
- " <td>173590</td>\n",
- " <td>-999</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>3</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>1</td>\n",
- " <td>11</td>\n",
- " <td>0</td>\n",
- " <td>...</td>\n",
- " <td>1410203921266</td>\n",
- " <td>ltp</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>4</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[0, 0, 0]</td>\n",
- " <td>1</td>\n",
- " <td>WORD</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>11</th>\n",
- " <td>174844</td>\n",
- " <td>-999</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
- " <td>1</td>\n",
- " <td>ltpFR2</td>\n",
- " <td>1</td>\n",
- " <td>11</td>\n",
- " <td>0</td>\n",
- " <td>...</td>\n",
- " <td>1410203923774</td>\n",
- " <td>ltp</td>\n",
- " <td>0</td>\n",
- " <td>-999</td>\n",
- " <td>5</td>\n",
- " <td>1</td>\n",
- " <td>LTP093</td>\n",
- " <td>[0, 0, 0]</td>\n",
- " <td>1</td>\n",
- " <td>WORD</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>5 rows × 27 columns</p>\n",
- "</div>"
- ],
- "text/plain": [
- " eegoffset answer begin_distractor begin_math_correct \\\n",
- "7 169632 -999 0 -999 \n",
- "8 170937 -999 0 -999 \n",
- "9 172292 -999 0 -999 \n",
- "10 173590 -999 0 -999 \n",
- "11 174844 -999 0 -999 \n",
- "\n",
- " eegfile eogArtifact experiment \\\n",
- "7 /protocols/ltp/subjects/LTP093/experiments/ltp... 0 ltpFR2 \n",
- "8 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
- "9 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
- "10 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
- "11 /protocols/ltp/subjects/LTP093/experiments/ltp... 1 ltpFR2 \n",
- "\n",
- " final_distractor final_math_correct intruded ... mstime \\\n",
- "7 1 11 0 ... 1410203913351 \n",
- "8 1 11 0 ... 1410203915961 \n",
- "9 1 11 0 ... 1410203918671 \n",
- "10 1 11 0 ... 1410203921266 \n",
- "11 1 11 0 ... 1410203923774 \n",
- "\n",
- " protocol recalled rectime serialpos session subject test trial \\\n",
- "7 ltp 1 -999 1 1 LTP093 [0, 0, 0] 1 \n",
- "8 ltp 1 -999 2 1 LTP093 [0, 0, 0] 1 \n",
- "9 ltp 1 -999 3 1 LTP093 [0, 0, 0] 1 \n",
- "10 ltp 0 -999 4 1 LTP093 [0, 0, 0] 1 \n",
- "11 ltp 0 -999 5 1 LTP093 [0, 0, 0] 1 \n",
- "\n",
- " type \n",
- "7 WORD \n",
- "8 WORD \n",
- "9 WORD \n",
- "10 WORD \n",
- "11 WORD \n",
- "\n",
- "[5 rows x 27 columns]"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "dataframe_ltp = get_data_index(\"ltp\")\n",
- "ltp_subjects = dataframe_ltp[dataframe_ltp['experiment']=='ltpFR2']['subject'].unique()\n",
- "display(ltp_subjects[:5])\n",
- "\n",
- "subject = 'LTP093'\n",
- "session = 1\n",
- "experiment = 'ltpFR2'\n",
- "\n",
- "ltp_reader = CMLReader(subject=subject, experiment = experiment, session=session)\n",
- "ltp_events = ltp_reader.load('events')\n",
- "display(ltp_events.head())\n",
- "\n",
- "encoding = ltp_events[ltp_events['type']=='WORD']\n",
- "display(encoding.head())"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 11,
- "metadata": {},
- "outputs": [
- {
- "ename": "ValueError",
- "evalue": "split EEG filenames don't seem to match what are in the events",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m<ipython-input-11-4ac75818b519>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0meeg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mltp_reader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload_eeg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencoding\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrel_start\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrel_stop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.6\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/cmlreader.py\u001b[0m in \u001b[0;36mload_eeg\u001b[0;34m(self, events, rel_start, rel_stop, scheme)\u001b[0m\n\u001b[1;32m 275\u001b[0m })\n\u001b[1;32m 276\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 277\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'eeg'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 278\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 279\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mclassmethod\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/cmlreader.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(self, data_type, **kwargs)\u001b[0m\n\u001b[1;32m 217\u001b[0m )\n\u001b[1;32m 218\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 219\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 220\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m def load_eeg(self, events: Optional[pd.DataFrame] = None,\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 502\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 503\u001b[0m \u001b[0mevents\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_eegfile_absolute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 504\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_timeseries\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"rel_start\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"rel_stop\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 505\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 506\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mas_dataframe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mas_timeseries\u001b[0;34m(self, events, rel_start, rel_stop)\u001b[0m\n\u001b[1;32m 590\u001b[0m \u001b[0mepochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 591\u001b[0m scheme=self.scheme)\n\u001b[0;32m--> 592\u001b[0;31m \u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcontacts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mreader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 593\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 594\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscheme\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 250\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 251\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfiles\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 252\u001b[0;31m raise ValueError(\"split EEG filenames don't seem to match what\"\n\u001b[0m\u001b[1;32m 253\u001b[0m \" are in the events\")\n\u001b[1;32m 254\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mValueError\u001b[0m: split EEG filenames don't seem to match what are in the events"
- ]
- }
- ],
- "source": [
- "eeg = ltp_reader.load_eeg(events=encoding, rel_start=0, rel_stop=1.6)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Loading RAM Subjects:\n",
- "\n",
- "Same issue"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "check=[('R1207J', 'catFR1', 1),\n",
- "('R1207J', 'catFR1', 2),\n",
- "('R1207J', 'catFR1', 3), # WHY ARE THESE NOT WORKING? ValueError: split EEG filenames don't seem to match what are in the events\n",
- "('R1207J', 'catFR1', 0)]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 14,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([0, 1])"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "text/plain": [
- "array([0, 1, 2, 3])"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
- "source": [
- "dataframe_ram = get_data_index(\"r1\")\n",
- "display(dataframe_ram[(dataframe_ram['experiment']=='FR1') \n",
- " & (dataframe_ram['subject']=='R1207J')]['session'].unique())\n",
- "display(dataframe_ram[(dataframe_ram['experiment']=='catFR1') \n",
- " & (dataframe_ram['subject']=='R1207J')]['session'].unique())"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/path_finder.py:238: MultiplePathsFoundWarning: Multiple files found: /protocols/r1/subjects/R1207J/experiments/catFR1/sessions/1/ephys/current_processed/sources.json\n",
- "/data/eeg/R1207J/eeg.noreref/R1207J_catFR1_0_17Aug16_1928.params.txt\n",
- "/data/eeg/R1207J/eeg.noreref/params.txt returning the first file found\n",
- " warnings.warn(msg, MultiplePathsFoundWarning)\n"
- ]
- },
- {
- "ename": "ValueError",
- "evalue": "split EEG filenames don't seem to match what are in the events",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m<ipython-input-16-aa08bfbc22ea>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mreader\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mCMLReader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubject\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'R1207J'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexperiment\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'catFR1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mevs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mreader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'events'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mreader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload_eeg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mevs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mevs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'type'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34m'WORD'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrel_start\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrel_stop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1.\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/cmlreader.py\u001b[0m in \u001b[0;36mload_eeg\u001b[0;34m(self, events, rel_start, rel_stop, scheme)\u001b[0m\n\u001b[1;32m 275\u001b[0m })\n\u001b[1;32m 276\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 277\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'eeg'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 278\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 279\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mclassmethod\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/cmlreader.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(self, data_type, **kwargs)\u001b[0m\n\u001b[1;32m 217\u001b[0m )\n\u001b[1;32m 218\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 219\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 220\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m def load_eeg(self, events: Optional[pd.DataFrame] = None,\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 502\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 503\u001b[0m \u001b[0mevents\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_eegfile_absolute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 504\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mas_timeseries\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"rel_start\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"rel_stop\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 505\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 506\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mas_dataframe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mas_timeseries\u001b[0;34m(self, events, rel_start, rel_stop)\u001b[0m\n\u001b[1;32m 590\u001b[0m \u001b[0mepochs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mepochs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 591\u001b[0m scheme=self.scheme)\n\u001b[0;32m--> 592\u001b[0;31m \u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcontacts\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mreader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 593\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 594\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscheme\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home2/loganf/anaconda3/envs/ptsa_rises/lib/python3.6/site-packages/cmlreaders/readers/eeg.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 250\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 251\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfiles\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 252\u001b[0;31m raise ValueError(\"split EEG filenames don't seem to match what\"\n\u001b[0m\u001b[1;32m 253\u001b[0m \" are in the events\")\n\u001b[1;32m 254\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mValueError\u001b[0m: split EEG filenames don't seem to match what are in the events"
- ]
- }
- ],
- "source": [
- "reader = CMLReader(subject='R1207J', experiment='catFR1', session=0)\n",
- "evs = reader.load('events')\n",
- "reader.load_eeg(events=evs[evs['type']=='WORD'], rel_start=0., rel_stop=1.)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "ptsa_rises",
- "language": "python",
- "name": "ptsa_rises"
- },
- "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.6.6"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Add Comment
Please, Sign In to add comment