Guest User

Untitled

a guest
Sep 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.94 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 2,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "from cmlreaders import CMLReader, get_data_index"
  10. ]
  11. },
  12. {
  13. "cell_type": "markdown",
  14. "metadata": {},
  15. "source": [
  16. "# Loading an ltpFR2 subject:\n",
  17. "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",
  18. "\n",
  19. "Within the subject folder the eeg folder appears to have no eeg.reref or eeg.noreref anymore\n",
  20. "\n",
  21. "Issue appears on many subjects"
  22. ]
  23. },
  24. {
  25. "cell_type": "code",
  26. "execution_count": 10,
  27. "metadata": {},
  28. "outputs": [
  29. {
  30. "data": {
  31. "text/plain": [
  32. "array(['LTP093', 'LTP106', 'LTP115', 'LTP117', 'LTP122'], dtype=object)"
  33. ]
  34. },
  35. "metadata": {},
  36. "output_type": "display_data"
  37. },
  38. {
  39. "data": {
  40. "text/html": [
  41. "<div>\n",
  42. "<style scoped>\n",
  43. " .dataframe tbody tr th:only-of-type {\n",
  44. " vertical-align: middle;\n",
  45. " }\n",
  46. "\n",
  47. " .dataframe tbody tr th {\n",
  48. " vertical-align: top;\n",
  49. " }\n",
  50. "\n",
  51. " .dataframe thead th {\n",
  52. " text-align: right;\n",
  53. " }\n",
  54. "</style>\n",
  55. "<table border=\"1\" class=\"dataframe\">\n",
  56. " <thead>\n",
  57. " <tr style=\"text-align: right;\">\n",
  58. " <th></th>\n",
  59. " <th>eegoffset</th>\n",
  60. " <th>answer</th>\n",
  61. " <th>begin_distractor</th>\n",
  62. " <th>begin_math_correct</th>\n",
  63. " <th>eegfile</th>\n",
  64. " <th>eogArtifact</th>\n",
  65. " <th>experiment</th>\n",
  66. " <th>final_distractor</th>\n",
  67. " <th>final_math_correct</th>\n",
  68. " <th>intruded</th>\n",
  69. " <th>...</th>\n",
  70. " <th>mstime</th>\n",
  71. " <th>protocol</th>\n",
  72. " <th>recalled</th>\n",
  73. " <th>rectime</th>\n",
  74. " <th>serialpos</th>\n",
  75. " <th>session</th>\n",
  76. " <th>subject</th>\n",
  77. " <th>test</th>\n",
  78. " <th>trial</th>\n",
  79. " <th>type</th>\n",
  80. " </tr>\n",
  81. " </thead>\n",
  82. " <tbody>\n",
  83. " <tr>\n",
  84. " <th>0</th>\n",
  85. " <td>132641</td>\n",
  86. " <td>-999</td>\n",
  87. " <td>-999</td>\n",
  88. " <td>-999</td>\n",
  89. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  90. " <td>-1</td>\n",
  91. " <td>ltpFR2</td>\n",
  92. " <td>-999</td>\n",
  93. " <td>-999</td>\n",
  94. " <td>-999</td>\n",
  95. " <td>...</td>\n",
  96. " <td>1410203839373</td>\n",
  97. " <td>ltp</td>\n",
  98. " <td>-999</td>\n",
  99. " <td>-999</td>\n",
  100. " <td>-999</td>\n",
  101. " <td>1</td>\n",
  102. " <td>LTP093</td>\n",
  103. " <td>[-999, -999, -999]</td>\n",
  104. " <td>-999</td>\n",
  105. " <td>START</td>\n",
  106. " </tr>\n",
  107. " <tr>\n",
  108. " <th>1</th>\n",
  109. " <td>132666</td>\n",
  110. " <td>13</td>\n",
  111. " <td>-999</td>\n",
  112. " <td>-999</td>\n",
  113. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  114. " <td>-1</td>\n",
  115. " <td>ltpFR2</td>\n",
  116. " <td>-999</td>\n",
  117. " <td>-999</td>\n",
  118. " <td>-999</td>\n",
  119. " <td>...</td>\n",
  120. " <td>1410203839423</td>\n",
  121. " <td>ltp</td>\n",
  122. " <td>-999</td>\n",
  123. " <td>2404</td>\n",
  124. " <td>-999</td>\n",
  125. " <td>1</td>\n",
  126. " <td>LTP093</td>\n",
  127. " <td>[7, 4, 2]</td>\n",
  128. " <td>-999</td>\n",
  129. " <td>PROB</td>\n",
  130. " </tr>\n",
  131. " <tr>\n",
  132. " <th>2</th>\n",
  133. " <td>133904</td>\n",
  134. " <td>19</td>\n",
  135. " <td>-999</td>\n",
  136. " <td>-999</td>\n",
  137. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  138. " <td>-1</td>\n",
  139. " <td>ltpFR2</td>\n",
  140. " <td>-999</td>\n",
  141. " <td>-999</td>\n",
  142. " <td>-999</td>\n",
  143. " <td>...</td>\n",
  144. " <td>1410203841899</td>\n",
  145. " <td>ltp</td>\n",
  146. " <td>-999</td>\n",
  147. " <td>2193</td>\n",
  148. " <td>-999</td>\n",
  149. " <td>1</td>\n",
  150. " <td>LTP093</td>\n",
  151. " <td>[5, 6, 8]</td>\n",
  152. " <td>-999</td>\n",
  153. " <td>PROB</td>\n",
  154. " </tr>\n",
  155. " <tr>\n",
  156. " <th>3</th>\n",
  157. " <td>135040</td>\n",
  158. " <td>14</td>\n",
  159. " <td>-999</td>\n",
  160. " <td>-999</td>\n",
  161. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  162. " <td>-1</td>\n",
  163. " <td>ltpFR2</td>\n",
  164. " <td>-999</td>\n",
  165. " <td>-999</td>\n",
  166. " <td>-999</td>\n",
  167. " <td>...</td>\n",
  168. " <td>1410203844170</td>\n",
  169. " <td>ltp</td>\n",
  170. " <td>-999</td>\n",
  171. " <td>1433</td>\n",
  172. " <td>-999</td>\n",
  173. " <td>1</td>\n",
  174. " <td>LTP093</td>\n",
  175. " <td>[2, 4, 8]</td>\n",
  176. " <td>-999</td>\n",
  177. " <td>PROB</td>\n",
  178. " </tr>\n",
  179. " <tr>\n",
  180. " <th>4</th>\n",
  181. " <td>135795</td>\n",
  182. " <td>26</td>\n",
  183. " <td>-999</td>\n",
  184. " <td>-999</td>\n",
  185. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  186. " <td>-1</td>\n",
  187. " <td>ltpFR2</td>\n",
  188. " <td>-999</td>\n",
  189. " <td>-999</td>\n",
  190. " <td>-999</td>\n",
  191. " <td>...</td>\n",
  192. " <td>1410203845680</td>\n",
  193. " <td>ltp</td>\n",
  194. " <td>-999</td>\n",
  195. " <td>2211</td>\n",
  196. " <td>-999</td>\n",
  197. " <td>1</td>\n",
  198. " <td>LTP093</td>\n",
  199. " <td>[7, 8, 7]</td>\n",
  200. " <td>-999</td>\n",
  201. " <td>PROB</td>\n",
  202. " </tr>\n",
  203. " </tbody>\n",
  204. "</table>\n",
  205. "<p>5 rows × 27 columns</p>\n",
  206. "</div>"
  207. ],
  208. "text/plain": [
  209. " eegoffset answer begin_distractor begin_math_correct \\\n",
  210. "0 132641 -999 -999 -999 \n",
  211. "1 132666 13 -999 -999 \n",
  212. "2 133904 19 -999 -999 \n",
  213. "3 135040 14 -999 -999 \n",
  214. "4 135795 26 -999 -999 \n",
  215. "\n",
  216. " eegfile eogArtifact experiment \\\n",
  217. "0 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
  218. "1 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
  219. "2 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
  220. "3 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
  221. "4 /protocols/ltp/subjects/LTP093/experiments/ltp... -1 ltpFR2 \n",
  222. "\n",
  223. " final_distractor final_math_correct intruded ... mstime \\\n",
  224. "0 -999 -999 -999 ... 1410203839373 \n",
  225. "1 -999 -999 -999 ... 1410203839423 \n",
  226. "2 -999 -999 -999 ... 1410203841899 \n",
  227. "3 -999 -999 -999 ... 1410203844170 \n",
  228. "4 -999 -999 -999 ... 1410203845680 \n",
  229. "\n",
  230. " protocol recalled rectime serialpos session subject \\\n",
  231. "0 ltp -999 -999 -999 1 LTP093 \n",
  232. "1 ltp -999 2404 -999 1 LTP093 \n",
  233. "2 ltp -999 2193 -999 1 LTP093 \n",
  234. "3 ltp -999 1433 -999 1 LTP093 \n",
  235. "4 ltp -999 2211 -999 1 LTP093 \n",
  236. "\n",
  237. " test trial type \n",
  238. "0 [-999, -999, -999] -999 START \n",
  239. "1 [7, 4, 2] -999 PROB \n",
  240. "2 [5, 6, 8] -999 PROB \n",
  241. "3 [2, 4, 8] -999 PROB \n",
  242. "4 [7, 8, 7] -999 PROB \n",
  243. "\n",
  244. "[5 rows x 27 columns]"
  245. ]
  246. },
  247. "metadata": {},
  248. "output_type": "display_data"
  249. },
  250. {
  251. "data": {
  252. "text/html": [
  253. "<div>\n",
  254. "<style scoped>\n",
  255. " .dataframe tbody tr th:only-of-type {\n",
  256. " vertical-align: middle;\n",
  257. " }\n",
  258. "\n",
  259. " .dataframe tbody tr th {\n",
  260. " vertical-align: top;\n",
  261. " }\n",
  262. "\n",
  263. " .dataframe thead th {\n",
  264. " text-align: right;\n",
  265. " }\n",
  266. "</style>\n",
  267. "<table border=\"1\" class=\"dataframe\">\n",
  268. " <thead>\n",
  269. " <tr style=\"text-align: right;\">\n",
  270. " <th></th>\n",
  271. " <th>eegoffset</th>\n",
  272. " <th>answer</th>\n",
  273. " <th>begin_distractor</th>\n",
  274. " <th>begin_math_correct</th>\n",
  275. " <th>eegfile</th>\n",
  276. " <th>eogArtifact</th>\n",
  277. " <th>experiment</th>\n",
  278. " <th>final_distractor</th>\n",
  279. " <th>final_math_correct</th>\n",
  280. " <th>intruded</th>\n",
  281. " <th>...</th>\n",
  282. " <th>mstime</th>\n",
  283. " <th>protocol</th>\n",
  284. " <th>recalled</th>\n",
  285. " <th>rectime</th>\n",
  286. " <th>serialpos</th>\n",
  287. " <th>session</th>\n",
  288. " <th>subject</th>\n",
  289. " <th>test</th>\n",
  290. " <th>trial</th>\n",
  291. " <th>type</th>\n",
  292. " </tr>\n",
  293. " </thead>\n",
  294. " <tbody>\n",
  295. " <tr>\n",
  296. " <th>7</th>\n",
  297. " <td>169632</td>\n",
  298. " <td>-999</td>\n",
  299. " <td>0</td>\n",
  300. " <td>-999</td>\n",
  301. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  302. " <td>0</td>\n",
  303. " <td>ltpFR2</td>\n",
  304. " <td>1</td>\n",
  305. " <td>11</td>\n",
  306. " <td>0</td>\n",
  307. " <td>...</td>\n",
  308. " <td>1410203913351</td>\n",
  309. " <td>ltp</td>\n",
  310. " <td>1</td>\n",
  311. " <td>-999</td>\n",
  312. " <td>1</td>\n",
  313. " <td>1</td>\n",
  314. " <td>LTP093</td>\n",
  315. " <td>[0, 0, 0]</td>\n",
  316. " <td>1</td>\n",
  317. " <td>WORD</td>\n",
  318. " </tr>\n",
  319. " <tr>\n",
  320. " <th>8</th>\n",
  321. " <td>170937</td>\n",
  322. " <td>-999</td>\n",
  323. " <td>0</td>\n",
  324. " <td>-999</td>\n",
  325. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  326. " <td>3</td>\n",
  327. " <td>ltpFR2</td>\n",
  328. " <td>1</td>\n",
  329. " <td>11</td>\n",
  330. " <td>0</td>\n",
  331. " <td>...</td>\n",
  332. " <td>1410203915961</td>\n",
  333. " <td>ltp</td>\n",
  334. " <td>1</td>\n",
  335. " <td>-999</td>\n",
  336. " <td>2</td>\n",
  337. " <td>1</td>\n",
  338. " <td>LTP093</td>\n",
  339. " <td>[0, 0, 0]</td>\n",
  340. " <td>1</td>\n",
  341. " <td>WORD</td>\n",
  342. " </tr>\n",
  343. " <tr>\n",
  344. " <th>9</th>\n",
  345. " <td>172292</td>\n",
  346. " <td>-999</td>\n",
  347. " <td>0</td>\n",
  348. " <td>-999</td>\n",
  349. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  350. " <td>3</td>\n",
  351. " <td>ltpFR2</td>\n",
  352. " <td>1</td>\n",
  353. " <td>11</td>\n",
  354. " <td>0</td>\n",
  355. " <td>...</td>\n",
  356. " <td>1410203918671</td>\n",
  357. " <td>ltp</td>\n",
  358. " <td>1</td>\n",
  359. " <td>-999</td>\n",
  360. " <td>3</td>\n",
  361. " <td>1</td>\n",
  362. " <td>LTP093</td>\n",
  363. " <td>[0, 0, 0]</td>\n",
  364. " <td>1</td>\n",
  365. " <td>WORD</td>\n",
  366. " </tr>\n",
  367. " <tr>\n",
  368. " <th>10</th>\n",
  369. " <td>173590</td>\n",
  370. " <td>-999</td>\n",
  371. " <td>0</td>\n",
  372. " <td>-999</td>\n",
  373. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  374. " <td>3</td>\n",
  375. " <td>ltpFR2</td>\n",
  376. " <td>1</td>\n",
  377. " <td>11</td>\n",
  378. " <td>0</td>\n",
  379. " <td>...</td>\n",
  380. " <td>1410203921266</td>\n",
  381. " <td>ltp</td>\n",
  382. " <td>0</td>\n",
  383. " <td>-999</td>\n",
  384. " <td>4</td>\n",
  385. " <td>1</td>\n",
  386. " <td>LTP093</td>\n",
  387. " <td>[0, 0, 0]</td>\n",
  388. " <td>1</td>\n",
  389. " <td>WORD</td>\n",
  390. " </tr>\n",
  391. " <tr>\n",
  392. " <th>11</th>\n",
  393. " <td>174844</td>\n",
  394. " <td>-999</td>\n",
  395. " <td>0</td>\n",
  396. " <td>-999</td>\n",
  397. " <td>/protocols/ltp/subjects/LTP093/experiments/ltp...</td>\n",
  398. " <td>1</td>\n",
  399. " <td>ltpFR2</td>\n",
  400. " <td>1</td>\n",
  401. " <td>11</td>\n",
  402. " <td>0</td>\n",
  403. " <td>...</td>\n",
  404. " <td>1410203923774</td>\n",
  405. " <td>ltp</td>\n",
  406. " <td>0</td>\n",
  407. " <td>-999</td>\n",
  408. " <td>5</td>\n",
  409. " <td>1</td>\n",
  410. " <td>LTP093</td>\n",
  411. " <td>[0, 0, 0]</td>\n",
  412. " <td>1</td>\n",
  413. " <td>WORD</td>\n",
  414. " </tr>\n",
  415. " </tbody>\n",
  416. "</table>\n",
  417. "<p>5 rows × 27 columns</p>\n",
  418. "</div>"
  419. ],
  420. "text/plain": [
  421. " eegoffset answer begin_distractor begin_math_correct \\\n",
  422. "7 169632 -999 0 -999 \n",
  423. "8 170937 -999 0 -999 \n",
  424. "9 172292 -999 0 -999 \n",
  425. "10 173590 -999 0 -999 \n",
  426. "11 174844 -999 0 -999 \n",
  427. "\n",
  428. " eegfile eogArtifact experiment \\\n",
  429. "7 /protocols/ltp/subjects/LTP093/experiments/ltp... 0 ltpFR2 \n",
  430. "8 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
  431. "9 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
  432. "10 /protocols/ltp/subjects/LTP093/experiments/ltp... 3 ltpFR2 \n",
  433. "11 /protocols/ltp/subjects/LTP093/experiments/ltp... 1 ltpFR2 \n",
  434. "\n",
  435. " final_distractor final_math_correct intruded ... mstime \\\n",
  436. "7 1 11 0 ... 1410203913351 \n",
  437. "8 1 11 0 ... 1410203915961 \n",
  438. "9 1 11 0 ... 1410203918671 \n",
  439. "10 1 11 0 ... 1410203921266 \n",
  440. "11 1 11 0 ... 1410203923774 \n",
  441. "\n",
  442. " protocol recalled rectime serialpos session subject test trial \\\n",
  443. "7 ltp 1 -999 1 1 LTP093 [0, 0, 0] 1 \n",
  444. "8 ltp 1 -999 2 1 LTP093 [0, 0, 0] 1 \n",
  445. "9 ltp 1 -999 3 1 LTP093 [0, 0, 0] 1 \n",
  446. "10 ltp 0 -999 4 1 LTP093 [0, 0, 0] 1 \n",
  447. "11 ltp 0 -999 5 1 LTP093 [0, 0, 0] 1 \n",
  448. "\n",
  449. " type \n",
  450. "7 WORD \n",
  451. "8 WORD \n",
  452. "9 WORD \n",
  453. "10 WORD \n",
  454. "11 WORD \n",
  455. "\n",
  456. "[5 rows x 27 columns]"
  457. ]
  458. },
  459. "metadata": {},
  460. "output_type": "display_data"
  461. }
  462. ],
  463. "source": [
  464. "dataframe_ltp = get_data_index(\"ltp\")\n",
  465. "ltp_subjects = dataframe_ltp[dataframe_ltp['experiment']=='ltpFR2']['subject'].unique()\n",
  466. "display(ltp_subjects[:5])\n",
  467. "\n",
  468. "subject = 'LTP093'\n",
  469. "session = 1\n",
  470. "experiment = 'ltpFR2'\n",
  471. "\n",
  472. "ltp_reader = CMLReader(subject=subject, experiment = experiment, session=session)\n",
  473. "ltp_events = ltp_reader.load('events')\n",
  474. "display(ltp_events.head())\n",
  475. "\n",
  476. "encoding = ltp_events[ltp_events['type']=='WORD']\n",
  477. "display(encoding.head())"
  478. ]
  479. },
  480. {
  481. "cell_type": "code",
  482. "execution_count": 11,
  483. "metadata": {},
  484. "outputs": [
  485. {
  486. "ename": "ValueError",
  487. "evalue": "split EEG filenames don't seem to match what are in the events",
  488. "output_type": "error",
  489. "traceback": [
  490. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  491. "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
  492. "\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",
  493. "\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",
  494. "\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",
  495. "\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",
  496. "\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",
  497. "\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",
  498. "\u001b[0;31mValueError\u001b[0m: split EEG filenames don't seem to match what are in the events"
  499. ]
  500. }
  501. ],
  502. "source": [
  503. "eeg = ltp_reader.load_eeg(events=encoding, rel_start=0, rel_stop=1.6)"
  504. ]
  505. },
  506. {
  507. "cell_type": "markdown",
  508. "metadata": {},
  509. "source": [
  510. "# Loading RAM Subjects:\n",
  511. "\n",
  512. "Same issue"
  513. ]
  514. },
  515. {
  516. "cell_type": "code",
  517. "execution_count": 1,
  518. "metadata": {},
  519. "outputs": [],
  520. "source": [
  521. "check=[('R1207J', 'catFR1', 1),\n",
  522. "('R1207J', 'catFR1', 2),\n",
  523. "('R1207J', 'catFR1', 3), # WHY ARE THESE NOT WORKING? ValueError: split EEG filenames don't seem to match what are in the events\n",
  524. "('R1207J', 'catFR1', 0)]"
  525. ]
  526. },
  527. {
  528. "cell_type": "code",
  529. "execution_count": 14,
  530. "metadata": {},
  531. "outputs": [
  532. {
  533. "data": {
  534. "text/plain": [
  535. "array([0, 1])"
  536. ]
  537. },
  538. "metadata": {},
  539. "output_type": "display_data"
  540. },
  541. {
  542. "data": {
  543. "text/plain": [
  544. "array([0, 1, 2, 3])"
  545. ]
  546. },
  547. "metadata": {},
  548. "output_type": "display_data"
  549. }
  550. ],
  551. "source": [
  552. "dataframe_ram = get_data_index(\"r1\")\n",
  553. "display(dataframe_ram[(dataframe_ram['experiment']=='FR1') \n",
  554. " & (dataframe_ram['subject']=='R1207J')]['session'].unique())\n",
  555. "display(dataframe_ram[(dataframe_ram['experiment']=='catFR1') \n",
  556. " & (dataframe_ram['subject']=='R1207J')]['session'].unique())"
  557. ]
  558. },
  559. {
  560. "cell_type": "code",
  561. "execution_count": 16,
  562. "metadata": {},
  563. "outputs": [
  564. {
  565. "name": "stderr",
  566. "output_type": "stream",
  567. "text": [
  568. "/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",
  569. "/data/eeg/R1207J/eeg.noreref/R1207J_catFR1_0_17Aug16_1928.params.txt\n",
  570. "/data/eeg/R1207J/eeg.noreref/params.txt returning the first file found\n",
  571. " warnings.warn(msg, MultiplePathsFoundWarning)\n"
  572. ]
  573. },
  574. {
  575. "ename": "ValueError",
  576. "evalue": "split EEG filenames don't seem to match what are in the events",
  577. "output_type": "error",
  578. "traceback": [
  579. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  580. "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
  581. "\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",
  582. "\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",
  583. "\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",
  584. "\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",
  585. "\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",
  586. "\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",
  587. "\u001b[0;31mValueError\u001b[0m: split EEG filenames don't seem to match what are in the events"
  588. ]
  589. }
  590. ],
  591. "source": [
  592. "reader = CMLReader(subject='R1207J', experiment='catFR1', session=0)\n",
  593. "evs = reader.load('events')\n",
  594. "reader.load_eeg(events=evs[evs['type']=='WORD'], rel_start=0., rel_stop=1.)"
  595. ]
  596. }
  597. ],
  598. "metadata": {
  599. "kernelspec": {
  600. "display_name": "ptsa_rises",
  601. "language": "python",
  602. "name": "ptsa_rises"
  603. },
  604. "language_info": {
  605. "codemirror_mode": {
  606. "name": "ipython",
  607. "version": 3
  608. },
  609. "file_extension": ".py",
  610. "mimetype": "text/x-python",
  611. "name": "python",
  612. "nbconvert_exporter": "python",
  613. "pygments_lexer": "ipython3",
  614. "version": "3.6.6"
  615. }
  616. },
  617. "nbformat": 4,
  618. "nbformat_minor": 2
  619. }
Add Comment
Please, Sign In to add comment