Browse Source

fixes to the hippoSIT

dianamaro 2 years ago
parent
commit
da0f5b632b
4 changed files with 74 additions and 61 deletions
  1. 3 3
      background.ipynb
  2. 18 4
      controllers/serial.ipynb
  3. 52 43
      hippoSIT.ipynb
  4. 1 11
      postprocessing.ipynb

+ 3 - 3
background.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 9,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -20,7 +20,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 10,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -33,7 +33,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 11,
    "metadata": {},
    "outputs": [],
    "source": [

+ 18 - 4
controllers/serial.ipynb

@@ -14,7 +14,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 3,
    "id": "4e6dfa60",
    "metadata": {},
    "outputs": [],
@@ -43,12 +43,15 @@
     "        print(\"Fake Arduino - sending a TTL pulse\")\n",
     "        \n",
     "    def exit(self):\n",
-    "        print(\"Fake Arduino - exiting...\")"
+    "        print(\"Fake Arduino - exiting...\")\n",
+    "        \n",
+    "    def switch_light(self):\n",
+    "        print(\"Fake Arduino - switching light on/off...\")"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 4,
    "id": "b59f6f32",
    "metadata": {},
    "outputs": [],
@@ -76,7 +79,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": 5,
    "id": "f1050f57",
    "metadata": {},
    "outputs": [],
@@ -95,6 +98,17 @@
     "board.switch_light()"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 32,
+   "id": "7e32618b",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# testing sync with acquisition system\n",
+    "board.start_or_stop()"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": 21,

File diff suppressed because it is too large
+ 52 - 43
hippoSIT.ipynb


+ 1 - 11
postprocessing.ipynb

@@ -94,13 +94,6 @@
     "        # make time from session start\n",
     "        pos_at_freq[:, 0] = pos_at_freq[:, 0] - pos_at_freq[0][0]\n",
     "\n",
-    "        # convert positions from pixels to meters and center\n",
-    "        #arena_d = parameters['position']['arena_diameter']\n",
-    "        #arena_d = 0.92\n",
-    "        #pixel_size = arena_d / (2 * float(parameters['position']['arena_radius']))\n",
-    "        #pos_at_freq[:, 1] = (parameters['position']['arena_x'] - pos_at_freq[:, 1]) * pixel_size\n",
-    "        #pos_at_freq[:, 2] = (parameters['position']['arena_y'] - pos_at_freq[:, 2]) * pixel_size\n",
-    "\n",
     "        width = 100  # 100 points ~= 1 sec with at 100Hz\n",
     "        kernel = signal.gaussian(width, std=(width) / 7.2)\n",
     "\n",
@@ -124,12 +117,9 @@
     "        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][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",
+    "            trials[i] = (t_start_idx, t_end_idx, events[2*i][1], events[2*i][2], events[2*i][3], state)\n",
     "\n",
     "        trial_idxs = proc.create_dataset('trial_idxs', data=trials)\n",
     "        trial_idxs.attrs['headers'] = 't_start_idx, t_end_idx, target_x, target_y, target_r, fail_or_success'\n",