Skip to content

Commit bce4852

Browse files
committed
resource modeling draft
1 parent 581d659 commit bce4852

File tree

9 files changed

+462
-40
lines changed

9 files changed

+462
-40
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "6aa99372",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from byonoy import byonoy_absorbance_adapter, byonoy_absorbance96_base_and_reader\n",
11+
"a = byonoy_absorbance_adapter(name='a')\n",
12+
"b, r = byonoy_absorbance96_base_and_reader(name='b', assign=True)"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"id": "84949548",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"a.assign_child_resource(b)"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": 3,
28+
"id": "b2e6e986",
29+
"metadata": {},
30+
"outputs": [
31+
{
32+
"data": {
33+
"text/plain": [
34+
"(ResourceHolder(name=a, location=None, size_x=127.76, size_y=85.59, size_z=14.07, category=resource_holder),\n",
35+
" ByonoyBase(name=b_base, location=Coordinate(-05.120, -05.055, 011.620), size_x=138, size_y=95.7, size_z=27.7, category=None),\n",
36+
" PlateReader(name=b_reader, location=Coordinate(000.000, 000.000, 010.660), size_x=138, size_y=95.7, size_z=0, category=None))"
37+
]
38+
},
39+
"execution_count": 3,
40+
"metadata": {},
41+
"output_type": "execute_result"
42+
}
43+
],
44+
"source": [
45+
"a, b, r"
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": 4,
51+
"id": "1fd4d917",
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"from pylabrobot.liquid_handling import LiquidHandler, LiquidHandlerChatterboxBackend\n",
56+
"from pylabrobot.resources import STARDeck\n",
57+
"\n",
58+
"lh = LiquidHandler(deck=STARDeck(), backend=LiquidHandlerChatterboxBackend())"
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 5,
64+
"id": "abde0e65",
65+
"metadata": {},
66+
"outputs": [
67+
{
68+
"name": "stdout",
69+
"output_type": "stream",
70+
"text": [
71+
"Setting up the liquid handler.\n",
72+
"Resource deck was assigned to the liquid handler.\n",
73+
"Resource trash was assigned to the liquid handler.\n",
74+
"Resource trash_core96 was assigned to the liquid handler.\n",
75+
"Resource waste_block was assigned to the liquid handler.\n"
76+
]
77+
}
78+
],
79+
"source": [
80+
"await lh.setup()"
81+
]
82+
},
83+
{
84+
"cell_type": "code",
85+
"execution_count": 6,
86+
"id": "5be9a197",
87+
"metadata": {},
88+
"outputs": [
89+
{
90+
"name": "stdout",
91+
"output_type": "stream",
92+
"text": [
93+
"Resource plate was assigned to the liquid handler.\n"
94+
]
95+
}
96+
],
97+
"source": [
98+
"from pylabrobot.resources.coordinate import Coordinate\n",
99+
"from pylabrobot.resources.cellvis.plates import CellVis_96_wellplate_350uL_Fb\n",
100+
"\n",
101+
"\n",
102+
"plate = CellVis_96_wellplate_350uL_Fb(name='plate')\n",
103+
"lh.deck.assign_child_resource(plate, location=Coordinate(0, 0, 0))"
104+
]
105+
},
106+
{
107+
"cell_type": "code",
108+
"execution_count": 7,
109+
"id": "219becbc",
110+
"metadata": {},
111+
"outputs": [
112+
{
113+
"name": "stdout",
114+
"output_type": "stream",
115+
"text": [
116+
"Picking up resource: ResourcePickup(resource=PlateReader(name=b_reader, location=Coordinate(000.000, 000.000, 010.660), size_x=138, size_y=95.7, size_z=0, category=None), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, direction=<GripDirection.FRONT: 1>)\n",
117+
"Dropping resource: ResourceDrop(resource=PlateReader(name=b_reader, location=Coordinate(000.000, 000.000, 010.660), size_x=138, size_y=95.7, size_z=0, category=None), destination=Coordinate(x=200, y=0, z=0), destination_absolute_rotation=Rotation(x=0, y=0, z=0), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, pickup_direction=<GripDirection.FRONT: 1>, drop_direction=<GripDirection.FRONT: 1>, rotation=0)\n",
118+
"Resource b_reader was assigned to the liquid handler.\n"
119+
]
120+
}
121+
],
122+
"source": [
123+
"# move the reader off the base\n",
124+
"await lh.move_resource(r, Coordinate(200, 0, 0))"
125+
]
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": 8,
130+
"id": "c7f821fd",
131+
"metadata": {},
132+
"outputs": [
133+
{
134+
"name": "stdout",
135+
"output_type": "stream",
136+
"text": [
137+
"Resource a was assigned to the liquid handler.\n"
138+
]
139+
}
140+
],
141+
"source": [
142+
"lh.deck.assign_child_resource(a, location=Coordinate(400, 0, 0))"
143+
]
144+
},
145+
{
146+
"cell_type": "code",
147+
"execution_count": 9,
148+
"id": "134cd064",
149+
"metadata": {},
150+
"outputs": [
151+
{
152+
"name": "stdout",
153+
"output_type": "stream",
154+
"text": [
155+
"Picking up resource: ResourcePickup(resource=Plate(name=plate, size_x=127.6, size_y=85.75, size_z=13.83, location=Coordinate(000.000, 000.000, 000.000)), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, direction=<GripDirection.FRONT: 1>)\n",
156+
"Dropping resource: ResourceDrop(resource=Plate(name=plate, size_x=127.6, size_y=85.75, size_z=13.83, location=Coordinate(000.000, 000.000, 000.000)), destination=Coordinate(x=400.0, y=0.0, z=39.32), destination_absolute_rotation=Rotation(x=0, y=0, z=0), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, pickup_direction=<GripDirection.FRONT: 1>, drop_direction=<GripDirection.FRONT: 1>, rotation=0)\n",
157+
"Resource plate was unassigned from the liquid handler.\n",
158+
"Resource plate was assigned to the liquid handler.\n"
159+
]
160+
}
161+
],
162+
"source": [
163+
"await lh.move_resource(plate, b.plate_holder)"
164+
]
165+
},
166+
{
167+
"cell_type": "code",
168+
"execution_count": 10,
169+
"id": "867ec7d8",
170+
"metadata": {},
171+
"outputs": [
172+
{
173+
"name": "stdout",
174+
"output_type": "stream",
175+
"text": [
176+
"Picking up resource: ResourcePickup(resource=PlateReader(name=b_reader, location=Coordinate(200.000, 000.000, 000.000), size_x=138, size_y=95.7, size_z=0, category=None), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, direction=<GripDirection.FRONT: 1>)\n",
177+
"Dropping resource: ResourceDrop(resource=PlateReader(name=b_reader, location=Coordinate(200.000, 000.000, 000.000), size_x=138, size_y=95.7, size_z=0, category=None), destination=Coordinate(x=394.88, y=-5.055, z=22.28), destination_absolute_rotation=Rotation(x=0, y=0, z=0), offset=Coordinate(x=0, y=0, z=0), pickup_distance_from_top=0, pickup_direction=<GripDirection.FRONT: 1>, drop_direction=<GripDirection.FRONT: 1>, rotation=0)\n",
178+
"Resource b_reader was unassigned from the liquid handler.\n",
179+
"Resource b_reader was assigned to the liquid handler.\n"
180+
]
181+
}
182+
],
183+
"source": [
184+
"await lh.move_resource(r, b.reader_holder)"
185+
]
186+
},
187+
{
188+
"cell_type": "code",
189+
"execution_count": 11,
190+
"id": "439663bd",
191+
"metadata": {},
192+
"outputs": [
193+
{
194+
"data": {
195+
"text/plain": [
196+
"ResourceHolder(name=b_base_reader_holder, location=Coordinate(000.000, 000.000, 000.000), size_x=138, size_y=95.7, size_z=0, category=resource_holder)"
197+
]
198+
},
199+
"execution_count": 11,
200+
"metadata": {},
201+
"output_type": "execute_result"
202+
}
203+
],
204+
"source": [
205+
"r.parent"
206+
]
207+
}
208+
],
209+
"metadata": {
210+
"kernelspec": {
211+
"display_name": "env (3.10.15)",
212+
"language": "python",
213+
"name": "python3"
214+
},
215+
"language_info": {
216+
"codemirror_mode": {
217+
"name": "ipython",
218+
"version": 3
219+
},
220+
"file_extension": ".py",
221+
"mimetype": "text/x-python",
222+
"name": "python",
223+
"nbconvert_exporter": "python",
224+
"pygments_lexer": "ipython3",
225+
"version": "3.10.15"
226+
}
227+
},
228+
"nbformat": 4,
229+
"nbformat_minor": 5
230+
}

docs/user_guide/02_analytical/plate-reading/plate-reading.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ Plate Readers
33

44
PyLabRobot supports the following plate readers:
55

6-
- :ref:`BMG Clariostar <clariostar>`
7-
8-
9-
106
.. toctree::
117
:maxdepth: 1
128
:hidden:
139

1410
bmg-clariostar
1511
cytation5
12+
byonoy

pylabrobot/liquid_handling/liquid_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,9 @@ async def drop_resource(
19431943
raise RuntimeError("No resource picked up")
19441944
resource = self._resource_pickup.resource
19451945

1946+
if isinstance(destination, Resource):
1947+
destination.check_can_drop_resource_here(resource)
1948+
19461949
# compute rotation based on the pickup_direction and drop_direction
19471950
if self._resource_pickup.direction == direction:
19481951
rotation_applied_by_move = 0
@@ -2292,7 +2295,7 @@ async def move_plate(
22922295
**backend_kwargs,
22932296
)
22942297

2295-
def serialize(self):
2298+
def serialize(self) -> dict:
22962299
return {**Resource.serialize(self), **Machine.serialize(self)}
22972300

22982301
@classmethod

0 commit comments

Comments
 (0)