|
47 | 47 | "source": [ |
48 | 48 | "## Loading a session's trials\n", |
49 | 49 | "\n", |
50 | | - "If you want to load the trials data for a single session, we recommend you use the SessionLoader:" |
| 50 | + "If you want to load the trials data for a single session, we recommend you use the `SessionLoader`:" |
51 | 51 | ], |
52 | 52 | "metadata": { |
53 | 53 | "collapsed": false |
|
58 | 58 | "execution_count": null, |
59 | 59 | "outputs": [], |
60 | 60 | "source": [ |
| 61 | + "'''\n", |
| 62 | + "RECOMMENDED\n", |
| 63 | + "'''\n", |
| 64 | + "from brainbox.io.one import SessionLoader\n", |
| 65 | + "from one.api import ONE\n", |
| 66 | + "one = ONE()\n", |
| 67 | + "eid = '4ecb5d24-f5cc-402c-be28-9d0f7cb14b3a'\n", |
| 68 | + "sl = SessionLoader(eid=eid, one=one)\n", |
| 69 | + "sl.load_trials()\n", |
| 70 | + "\n", |
| 71 | + "# The datasets are attributes of the sl.trials, for example probabilityLeft :\n", |
| 72 | + "probabilityLeft = sl.trials['probabilityLeft']\n", |
| 73 | + "# Find all of them using:\n", |
| 74 | + "sl.trials.keys()" |
| 75 | + ], |
| 76 | + "metadata": { |
| 77 | + "collapsed": false, |
| 78 | + "pycharm": { |
| 79 | + "name": "#%%\n" |
| 80 | + } |
| 81 | + } |
| 82 | + }, |
| 83 | + { |
| 84 | + "cell_type": "markdown", |
| 85 | + "source": [ |
| 86 | + "For completeness, we present below how to load the trials object using the `one.load_object` method, however we recommend you use the code above and use the `SessionLoader` instead." |
| 87 | + ], |
| 88 | + "metadata": { |
| 89 | + "collapsed": false |
| 90 | + } |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "code", |
| 94 | + "execution_count": null, |
| 95 | + "outputs": [], |
| 96 | + "source": [ |
| 97 | + "'''\n", |
| 98 | + "ALTERNATIVE - NOT RECOMMENDED\n", |
| 99 | + "'''\n", |
61 | 100 | "from one.api import ONE\n", |
62 | 101 | "one = ONE()\n", |
63 | 102 | "eid = '4ecb5d24-f5cc-402c-be28-9d0f7cb14b3a'\n", |
|
75 | 114 | "id": "0514237a", |
76 | 115 | "metadata": {}, |
77 | 116 | "source": [ |
78 | | - "## Loading a subject's trials\n", |
| 117 | + "## Loading all the sessions' trials for a single subject at once\n", |
79 | 118 | "This loads all trials data for a given subject (all session trials concatenated) into a DataFrame.\n", |
80 | 119 | "The subjectTraining table contains the training statuses." |
81 | 120 | ] |
|
0 commit comments