Переглянути джерело

Add functionality of dropping multiple pellets

miguel_bengala 11 місяців тому
батько
коміт
95913b244b
3 змінених файлів з 21 додано та 7 видалено
  1. 7 1
      SIT.ipynb
  2. 12 5
      controllers/serial.ipynb
  3. 2 1
      profiles/default.json

+ 7 - 1
SIT.ipynb

@@ -44,6 +44,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -102,6 +103,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -199,6 +201,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -374,7 +377,7 @@
     "\n",
     "                    elif c_time - target_since > cfg_exp['target_duration']: # successful trial\n",
     "                        log_event(c_time, round(tgt.x, 4), round(tgt.y, 4), round(tgt.r, 4), trial, 1) # log trial success\n",
-    "                        board.feed()\n",
+    "                        board.feed(n_pellets = cfg_exp['n_pellets'])\n",
     "                        \n",
     "                        # init inter-trial interval and new trial\n",
     "                        trial_start = c_time + cfg_exp['iti_duration'] + 5 * np.random.rand()  # random b/w 20-25 sec\n",
@@ -603,6 +606,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -650,6 +654,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -745,6 +750,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [

+ 12 - 5
controllers/serial.ipynb

@@ -76,12 +76,13 @@
     "        self.is_light_off = not self.is_light_off\n",
     "        self.digital[MCSArduino.pin_LED_lights].write(self.is_light_off)\n",
     "        \n",
-    "    def feed(self):\n",
+    "    def feed(self, n_pellets = 1):\n",
     "        self.digital[MCSArduino.pin_feeder_power].write(True)\n",
-    "        time.sleep(0.5)\n",
-    "        self.digital[MCSArduino.pin_feeder].write(True)\n",
-    "        time.sleep(0.02)\n",
-    "        self.digital[MCSArduino.pin_feeder].write(False)\n",
+    "        for n in range(n_pellets):\n",
+    "            time.sleep(0.5)\n",
+    "            self.digital[MCSArduino.pin_feeder].write(True)\n",
+    "            time.sleep(0.02)\n",
+    "            self.digital[MCSArduino.pin_feeder].write(False)\n",
     "        time.sleep(1.5)\n",
     "        self.digital[MCSArduino.pin_feeder_power].write(False)\n",
     "        \n",
@@ -172,6 +173,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "56d33a31",
    "metadata": {},
@@ -309,6 +311,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "ff6d72c0",
    "metadata": {},
@@ -357,6 +360,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "89b10d38",
    "metadata": {},
@@ -410,6 +414,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "e6df6e15",
    "metadata": {},
@@ -576,6 +581,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "fdb584fe",
    "metadata": {},
@@ -671,6 +677,7 @@
    "source": []
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "ae2fe188",
    "metadata": {},

+ 2 - 1
profiles/default.json

@@ -81,6 +81,7 @@
         "punishment_duration": 10,
         "distractor_islands": 1,
         "distractor_fail": false,
-        "enable_motors": false
+        "enable_motors": false,
+        "n_pellets": 1
     }
 }