|
@@ -2,7 +2,7 @@
|
|
|
"cells": [
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 1,
|
|
|
+ "execution_count": 2,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
@@ -11,6 +11,28 @@
|
|
|
"from scipy import signal"
|
|
|
]
|
|
|
},
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 4,
|
|
|
+ "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"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "h5name = pack('sessions\\\\47_aSIT_2021-07-31_19-05-54')"
|
|
|
+ ]
|
|
|
+ },
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": 3,
|
|
@@ -93,15 +115,15 @@
|
|
|
" events = np.array(f['raw']['events'])\n",
|
|
|
" events[:, 0] = events[:, 0] - s_start\n",
|
|
|
"\n",
|
|
|
- " t_count = len(np.unique(events[events[:, 7] != 0][:, 6]))\n",
|
|
|
+ " t_count = len(np.unique(events[events[:, 5] != 0][:, 4]))\n",
|
|
|
" trials = np.zeros((t_count, 6))\n",
|
|
|
" for i in range(t_count):\n",
|
|
|
" t_start_idx = (np.abs(pos_at_freq[:, 0] - events[2*i][0])).argmin()\n",
|
|
|
" t_end_idx = (np.abs(pos_at_freq[:, 0] - events[2*i + 1][0])).argmin()\n",
|
|
|
- " x_in_m = (parameters['position']['arena_x'] - events[2*i][3]) * pixel_size\n",
|
|
|
- " y_in_m = (parameters['position']['arena_y'] - events[2*i][4]) * pixel_size\n",
|
|
|
- " r_in_m = events[2*i][5] * pixel_size\n",
|
|
|
- " state = 0 if events[2*i + 1][7] > 1 else 1\n",
|
|
|
+ " x_in_m = (parameters['position']['arena_x'] - events[2*i][1]) * pixel_size\n",
|
|
|
+ " y_in_m = (parameters['position']['arena_y'] - events[2*i][2]) * pixel_size\n",
|
|
|
+ " r_in_m = events[2*i][3] * pixel_size\n",
|
|
|
+ " state = 0 if events[2*i + 1][5] > 1 else 1\n",
|
|
|
"\n",
|
|
|
" trials[i] = (t_start_idx, t_end_idx, x_in_m, y_in_m, r_in_m, state)\n",
|
|
|
"\n",
|
|
@@ -154,7 +176,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.8.10"
|
|
|
+ "version": "3.8.8"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|