|
@@ -13,33 +13,37 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 4,
|
|
|
+ "execution_count": 1,
|
|
|
"metadata": {},
|
|
|
- "outputs": [
|
|
|
- {
|
|
|
- "ename": "IndexError",
|
|
|
- "evalue": "too many indices for array: array is 1-dimensional, but 2 were indexed",
|
|
|
- "output_type": "error",
|
|
|
- "traceback": [
|
|
|
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
|
- "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)",
|
|
|
- "\u001b[1;32m<ipython-input-4-5f15cb32f5c4>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mh5name\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpack\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'sessions\\\\47_aSIT_2021-07-31_19-05-54'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
|
|
|
- "\u001b[1;32m<ipython-input-3-1b999426b089>\u001b[0m in \u001b[0;36mpack\u001b[1;34m(session_path)\u001b[0m\n\u001b[0;32m 73\u001b[0m \u001b[1;31m# save trials\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 74\u001b[0m \u001b[0mevents\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marray\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'raw'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'events'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 75\u001b[1;33m \u001b[0mevents\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mevents\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0ms_start\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 76\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 77\u001b[0m \u001b[0mt_count\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0munique\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mevents\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mevents\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m5\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m4\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|
|
- "\u001b[1;31mIndexError\u001b[0m: too many indices for array: array is 1-dimensional, but 2 were indexed"
|
|
|
- ]
|
|
|
- }
|
|
|
- ],
|
|
|
+ "outputs": [],
|
|
|
"source": [
|
|
|
- "h5name = pack('sessions\\\\47_aSIT_2021-07-31_19-05-54')"
|
|
|
+ "# Pack a particular session\n",
|
|
|
+ "#h5name = pack('sessions\\\\47_aSIT_2021-07-31_19-05-54')"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 3,
|
|
|
+ "execution_count": 2,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
"def pack(session_path):\n",
|
|
|
+ " \"\"\"\n",
|
|
|
+ " Pack independent tracking datasets into a single HDF5 file.\n",
|
|
|
+ " \n",
|
|
|
+ " File has the following structure:\n",
|
|
|
+ " \n",
|
|
|
+ " /raw\n",
|
|
|
+ " /positions - raw positions from .csv\n",
|
|
|
+ " /events - raw events from .csv\n",
|
|
|
+ " /sounds - raw sounds from .csv\n",
|
|
|
+ " /processed\n",
|
|
|
+ " /timeline - matrix of [time, x, y, speed] sampled at 50Hz, data is smoothed with gaussian kernel\n",
|
|
|
+ " /trial_idxs - matrix of trial indices to timeline\n",
|
|
|
+ " /sound_idxs - matrix of sound indices to timeline\n",
|
|
|
+ " \n",
|
|
|
+ " each dataset has an attribute 'headers' with the description of columns.\n",
|
|
|
+ " \"\"\"\n",
|
|
|
" params_file = [x for x in os.listdir(session_path) if x.endswith('.json')][0]\n",
|
|
|
"\n",
|
|
|
" with open(os.path.join(session_path, params_file)) as json_file:\n",
|
|
@@ -176,7 +180,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.8.8"
|
|
|
+ "version": "3.8.10"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|