Skip to content

Commit

Permalink
Merge pull request #172 from machineagency/HTTPpipette
Browse files Browse the repository at this point in the history
HTTP pipette addition
  • Loading branch information
brendenpelkie authored Oct 14, 2024
2 parents d9188c0 + 7b75d41 commit e7b03b7
Show file tree
Hide file tree
Showing 31 changed files with 6,436 additions and 13 deletions.
757 changes: 757 additions & 0 deletions HTTP_debug.ipynb

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "b656762c-1ca9-4f9c-9ba6-86a3f7190265",
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "1127740c-7620-447b-8204-741dfc8fe3cc",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"# ----------- Science Jubilee -------------\n",
"from science_jubilee import Machine as Jub\n",
"from science_jubilee.tools import HTTPSyringe as syringe\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "64788e2b-4060-4b44-8c87-cf6a880ad318",
"metadata": {},
"outputs": [],
"source": [
"url = 'http://192.168.1.5:5000'\n",
"volume = {'volume':5}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d1be2c94-8669-4bea-b057-a4a3acf035fd",
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(url + '/get_status')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "8228ca74-92e4-4761-b4ef-ef0c50fe7381",
"metadata": {},
"outputs": [],
"source": [
"jubilee = Jub.Machine(address='192.168.1.2', simulated = False) "
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c3d3bf61-1aed-476b-b36c-e2c5891f4986",
"metadata": {},
"outputs": [],
"source": [
"jubilee.home_all()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30f0c9b9-98da-46f9-945c-34607d3abaf5",
"metadata": {},
"outputs": [],
"source": [
"deck = jubilee.load_deck('lab_automation_deck.json')"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "8378fc8c-b57c-4f31-8acd-f681403444cc",
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "'super' object has no attribute '_HTTPSyringe__init'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m syringe \u001b[38;5;241m=\u001b[39m \u001b[43msyringe\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mHTTPSyringe\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfrom_config\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m3\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/home/brendenpelkie/Code/science-jubilee/src/science_jubilee/tools/configs/10cc_syringe.json\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Code/science-jubilee/src/science_jubilee/tools/HTTPSyringe.py:47\u001b[0m, in \u001b[0;36mHTTPSyringe.from_config\u001b[0;34m(cls, index, fp)\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(fp) \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 45\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m json\u001b[38;5;241m.\u001b[39mload(f)\n\u001b[0;32m---> 47\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/Code/science-jubilee/src/science_jubilee/tools/HTTPSyringe.py:31\u001b[0m, in \u001b[0;36mHTTPSyringe.__init__\u001b[0;34m(self, index, url)\u001b[0m\n\u001b[1;32m 27\u001b[0m config_r \u001b[38;5;241m=\u001b[39m requests\u001b[38;5;241m.\u001b[39mget(url\u001b[38;5;241m+\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/get_config\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 29\u001b[0m config \u001b[38;5;241m=\u001b[39m config_r\u001b[38;5;241m.\u001b[39mjson\n\u001b[0;32m---> 31\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__init\u001b[49m(index, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mconfig, url \u001b[38;5;241m=\u001b[39m url)\n\u001b[1;32m 33\u001b[0m status_r \u001b[38;5;241m=\u001b[39m requests\u001b[38;5;241m.\u001b[39mget(url \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/get_status\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 35\u001b[0m status \u001b[38;5;241m=\u001b[39m status_r\u001b[38;5;241m.\u001b[39mjson\n",
"\u001b[0;31mAttributeError\u001b[0m: 'super' object has no attribute '_HTTPSyringe__init'"
]
}
],
"source": [
"syringe = syringe.HTTPSyringe.from_config(3, \"/home/brendenpelkie/Code/science-jubilee/src/science_jubilee/tools/configs/10cc_syringe.json\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4febab10-2592-4ffa-8435-79944923c1f8",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit e7b03b7

Please sign in to comment.