|
@@ -57,12 +57,12 @@
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
- "cfg_filename = os.path.join('profiles', 'gokce_timeSIT_50_70.json')\n",
|
|
|
- "\n",
|
|
|
+ "#cfg_filename = os.path.join('profiles', 'gokce_timeSIT_50_52.5.json')\n",
|
|
|
+ "#cfg_filename = os.path.join('profiles', 'gokce_timeSIT_90_60.json')\n",
|
|
|
"#'gokce_timeSIT_90_108.json')\n",
|
|
|
"\n",
|
|
|
"# cfg_filename = os.path.join('profiles', 'social_test_actual.json')\n",
|
|
|
- "# cfg_filename = os.path.join('profiles', 'andrey_hippoSIT_SL.json')"
|
|
|
+ "cfg_filename = os.path.join('profiles', 'andrey_ppcSIT_SL_009266.json')"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -124,6 +124,7 @@
|
|
|
"\n",
|
|
|
"# update paths (assuming this paths are relative to this notebook)\n",
|
|
|
"cfg['video']['file_path'] = os.path.join(save_to, cfg['video']['file_path'])\n",
|
|
|
+ "cfg['video']['csv_path'] = os.path.join(save_to, cfg['video']['csv_path'])\n",
|
|
|
"cfg['position']['file_path'] = os.path.join(save_to, cfg['position']['file_path'])\n",
|
|
|
"cfg['position']['contour_path'] = os.path.join(save_to, cfg['position']['contour_path'])\n",
|
|
|
"cfg['experiment']['file_path'] = os.path.join(save_to, cfg['experiment']['file_path'])\n",
|
|
@@ -212,7 +213,7 @@
|
|
|
"cell_type": "code",
|
|
|
"execution_count": 10,
|
|
|
"metadata": {
|
|
|
- "scrolled": false
|
|
|
+ "scrolled": true
|
|
|
},
|
|
|
"outputs": [
|
|
|
{
|
|
@@ -521,7 +522,7 @@
|
|
|
" timers.append(threading.Timer(event_t, switch_light, args=(pt, board)))\n",
|
|
|
" \n",
|
|
|
" if cfg['experiment']['enable_motors']:\n",
|
|
|
- " if not cfg['experiment']['phi_max'] == 0:\n",
|
|
|
+ " if not cfg['experiment']['phi_max'] == 0 and len(cfg['experiment']['timepoints']) > 0:\n",
|
|
|
" direction = False if cfg['experiment']['phi_max'] > 0 else True\n",
|
|
|
" t0, t1 = cfg['experiment']['timepoints'][0], cfg['experiment']['timepoints'][1]\n",
|
|
|
" timers.append(threading.Timer(t0, motor_board.rotate, args=(direction, abs(cfg['experiment']['phi_max']), t1-t0)))\n",
|
|
@@ -602,8 +603,9 @@
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
"session_path = save_to\n",
|
|
|
+ "#trial = 5\n",
|
|
|
"#session_path = os.path.join('sessions', '2021-07-30_09-24-14') # some particular session\n",
|
|
|
- "#session_path = 'Y:\\\\Michael\\\\FreeBehaving\\\\SIT_sessions\\\\50_aSIT_2021-10-25_10-32-19'"
|
|
|
+ "#session_path = 'Y:\\\\Michael\\\\FreeBehaving\\\\SIT_sessions\\\\51_aSIT_2021-12-03_13-31-51'"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -612,20 +614,16 @@
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
- "ename": "SystemExit",
|
|
|
- "evalue": "Nothing recorded. No sense to continue.",
|
|
|
+ "ename": "IndexError",
|
|
|
+ "evalue": "index 0 is out of bounds for axis 0 with size 0",
|
|
|
"output_type": "error",
|
|
|
"traceback": [
|
|
|
- "An exception has occurred, use %tb to see the full traceback.\n",
|
|
|
- "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m Nothing recorded. No sense to continue.\n"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "stderr",
|
|
|
- "output_type": "stream",
|
|
|
- "text": [
|
|
|
- "C:\\Users\\inhibition\\.conda\\envs\\runsit\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3445: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
|
|
|
- " warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
|
|
|
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
|
+ "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)",
|
|
|
+ "\u001b[1;32m<ipython-input-12-df6d003c4298>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;31m# do pack data to HDF5\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mh5name\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpack\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msession_path\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 6\u001b[0m \u001b[0mtrial\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|
|
+ "\u001b[1;32mD:\\runSIT\\..\\pipeline\\postprocessing\\pack.py\u001b[0m in \u001b[0;36mpack\u001b[1;34m(session_path)\u001b[0m\n\u001b[0;32m 165\u001b[0m \u001b[1;31m# head direction\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 166\u001b[0m \u001b[0mtemp_tl\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumn_stack\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mpos_at_freq\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[0mx_smooth\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my_smooth\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mspeed\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--> 167\u001b[1;33m \u001b[0mhd\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mhead_direction\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtemp_tl\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 168\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 169\u001b[0m \u001b[1;31m# trial numbers\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|
|
+ "\u001b[1;32mD:\\runSIT\\..\\pipeline\\postprocessing\\head_direction.py\u001b[0m in \u001b[0;36mhead_direction\u001b[1;34m(tl, hd_update_speed)\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[0mcrit\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwhere\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdiff\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0midle_idxs\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m1\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[0m\n\u001b[0;32m 23\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 24\u001b[1;33m \u001b[0midle_periods\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0midle_idxs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0midle_idxs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mcrit\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;31m# first idle period\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 25\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpoint\u001b[0m \u001b[1;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcrit\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\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[0;32m 26\u001b[0m \u001b[0midx_start\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0midle_idxs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mcrit\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\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: index 0 is out of bounds for axis 0 with size 0"
|
|
|
]
|
|
|
}
|
|
|
],
|
|
@@ -719,8 +717,17 @@
|
|
|
"\n",
|
|
|
"# speed\n",
|
|
|
"ax = fig.add_subplot(224)\n",
|
|
|
- "ax.hist(tl[:, 3], bins=50, ec='black')\n",
|
|
|
- "ax.set_xlabel('Speed, m/s', fontsize=14)\n",
|
|
|
+ "\n",
|
|
|
+ "s_rate = 100 # Hz\n",
|
|
|
+ "window = 60 # secs\n",
|
|
|
+ "step = 10 # secs\n",
|
|
|
+ "duration = tl[-1][0]\n",
|
|
|
+ "x_vals = np.arange(int(duration/step))\n",
|
|
|
+ "\n",
|
|
|
+ "inst_speed = [tl[x*step*s_rate:(x*step + window)*s_rate][:, 3].mean() for x in x_vals]\n",
|
|
|
+ "ax.plot(x_vals*step, inst_speed)\n",
|
|
|
+ "ax.set_ylabel('Speed, m/s', fontsize=14)\n",
|
|
|
+ "ax.set_xlabel('Time, s', fontsize=14)\n",
|
|
|
"ax.set_title('Speed', fontsize=14)"
|
|
|
]
|
|
|
},
|
|
@@ -734,7 +741,9 @@
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "metadata": {},
|
|
|
+ "metadata": {
|
|
|
+ "scrolled": true
|
|
|
+ },
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
"h5name = os.path.join(session_path, experiment_id + '.h5')\n",
|
|
@@ -751,8 +760,10 @@
|
|
|
"\n",
|
|
|
"timepoints = cfg['experiment']['timepoints']\n",
|
|
|
"s_duration = cfg['experiment']['session_duration']\n",
|
|
|
- "\n",
|
|
|
- "periods = [[0, s_duration], [0, timepoints[0]], [timepoints[1], timepoints[2]], [timepoints[3], s_duration]]\n",
|
|
|
+ "if len(timepoints) > 0:\n",
|
|
|
+ " periods = [[0, s_duration], [0, timepoints[0]], [timepoints[1], timepoints[2]], [timepoints[3], s_duration]]\n",
|
|
|
+ "else:\n",
|
|
|
+ " periods = [[0, s_duration]]\n",
|
|
|
"\n",
|
|
|
"# separate ALL, L, D, L'\n",
|
|
|
"ds_names = ['performance_ALL', 'performance_L', 'performance_D', 'performance_Lp']\n",
|
|
@@ -771,9 +782,7 @@
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
"execution_count": null,
|
|
|
- "metadata": {
|
|
|
- "scrolled": true
|
|
|
- },
|
|
|
+ "metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
"fig = plt.figure(figsize=(4, 4))\n",
|