Skip to content

Commit 965b430

Browse files
committed
wip doc
1 parent 57af049 commit 965b430

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

examples/loading_data/loading_trials_data.ipynb

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"source": [
4848
"## Loading a session's trials\n",
4949
"\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`:"
5151
],
5252
"metadata": {
5353
"collapsed": false
@@ -58,6 +58,45 @@
5858
"execution_count": null,
5959
"outputs": [],
6060
"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",
61100
"from one.api import ONE\n",
62101
"one = ONE()\n",
63102
"eid = '4ecb5d24-f5cc-402c-be28-9d0f7cb14b3a'\n",
@@ -75,7 +114,7 @@
75114
"id": "0514237a",
76115
"metadata": {},
77116
"source": [
78-
"## Loading a subject's trials\n",
117+
"## Loading all the sessions' trials for a single subject at once\n",
79118
"This loads all trials data for a given subject (all session trials concatenated) into a DataFrame.\n",
80119
"The subjectTraining table contains the training statuses."
81120
]

0 commit comments

Comments
 (0)