Skip to content

Commit fda5bd2

Browse files
committed
rewrite byonoy with delf suggestions
1 parent 7ba4fcc commit fda5bd2

File tree

9 files changed

+346
-458
lines changed

9 files changed

+346
-458
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .byonoy import byonoy_luminescence96_base_and_reader, byonoy_luminescence_adapter
2+
from .byonoy_backend import ByonoyAbsorbance96AutomateBackend, ByonoyLuminescence96AutomateBackend

pylabrobot/plate_reading/byonoy.py renamed to pylabrobot/plate_reading/byonoy/byonoy.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from typing import Optional, Tuple
2-
from pylabrobot.plate_reading import PlateReader, ByonoyAbsorbance96AutomateBackend
3-
from pylabrobot.resources import Resource, ResourceHolder, PlateHolder, Coordinate
2+
3+
from pylabrobot.plate_reading.byonoy.byonoy_backend import ByonoyAbsorbance96AutomateBackend
4+
from pylabrobot.plate_reading.plate_reader import PlateReader
5+
from pylabrobot.resources import Coordinate, PlateHolder, Resource, ResourceHolder
46

57

68
def byonoy_luminescence_adapter(name: str) -> ResourceHolder:
@@ -12,7 +14,7 @@ def byonoy_luminescence_adapter(name: str) -> ResourceHolder:
1214
child_location=Coordinate(
1315
x=-(138 - 127.76) / 2, # measured
1416
y=-(95.7 - 85.59) / 2, # measured
15-
z=14.07-2.45 # measured
17+
z=14.07 - 2.45, # measured
1618
),
1719
)
1820

@@ -50,7 +52,7 @@ def check_can_drop_resource_here(self, resource: Resource) -> None:
5052
"ByonoyBase not assigned its plate holder. "
5153
"Please assign a ByonoyBase instance to the plate holder."
5254
)
53-
55+
5456
if self._byonoy_base.reader_holder.resource is not None:
5557
raise RuntimeError(
5658
f"Cannot drop resource {resource.name} onto plate holder while reader is on the base. "
@@ -61,7 +63,7 @@ def check_can_drop_resource_here(self, resource: Resource) -> None:
6163

6264

6365
class ByonoyBase(Resource):
64-
def __init__(self, name, rotation = None, category = None, model = None, barcode = None):
66+
def __init__(self, name, rotation=None, category=None, model=None, barcode=None):
6567
super().__init__(
6668
name=name,
6769
size_x=138,
@@ -74,12 +76,8 @@ def __init__(self, name, rotation = None, category = None, model = None, barcode
7476
size_x=127.76,
7577
size_y=85.59,
7678
size_z=0,
77-
child_location=Coordinate(
78-
x=(138 - 127.76) / 2,
79-
y=(95.7 - 85.59) / 2,
80-
z=27.7
81-
),
82-
pedestal_size_z=0
79+
child_location=Coordinate(x=(138 - 127.76) / 2, y=(95.7 - 85.59) / 2, z=27.7),
80+
pedestal_size_z=0,
8381
)
8482
self.assign_child_resource(self.plate_holder, location=Coordinate.zero())
8583

@@ -88,37 +86,32 @@ def __init__(self, name, rotation = None, category = None, model = None, barcode
8886
size_x=138,
8987
size_y=95.7,
9088
size_z=0,
91-
child_location=Coordinate(
92-
x=0,
93-
y=0,
94-
z=10.66
95-
),
89+
child_location=Coordinate(x=0, y=0, z=10.66),
9690
)
9791
self.assign_child_resource(self.reader_holder, location=Coordinate.zero())
9892

99-
def assign_child_resource(self, resource: Resource, location: Coordinate, reassign = True):
93+
def assign_child_resource(self, resource: Resource, location: Coordinate, reassign=True):
10094
if isinstance(resource, _ByonoyAbsorbanceReaderPlateHolder):
10195
if self.plate_holder._byonoy_base is not None:
10296
raise ValueError("ByonoyBase can only have one plate holder assigned.")
10397
self.plate_holder._byonoy_base = self
10498
return super().assign_child_resource(resource, location, reassign)
105-
99+
106100
def check_can_drop_resource_here(self, resource: Resource) -> None:
107101
raise RuntimeError(
108102
"ByonoyBase does not support assigning child resources directly. "
109103
"Use the plate_holder or reader_holder to assign plates and the reader, respectively."
110104
)
111105

112106

113-
def byonoy_luminescence96_base_and_reader(name: str, assign = True) -> Tuple[ByonoyBase, PlateReader]:
107+
def byonoy_luminescence96_base_and_reader(name: str, assign=True) -> Tuple[ByonoyBase, PlateReader]:
114108
"""Creates a ByonoyBase and a PlateReader instance."""
115109
byonoy_base = ByonoyBase(name=name + "_base")
116110
reader = PlateReader(
117111
name=name + "_reader",
118112
size_x=138,
119113
size_y=95.7,
120114
size_z=0,
121-
122115
backend=ByonoyAbsorbance96AutomateBackend(),
123116
)
124117
if assign:
@@ -155,4 +148,3 @@ def byonoy_luminescence96_base_and_reader(name: str, assign = True) -> Tuple[Byo
155148
# x: 155.5
156149
# y: 95.7
157150
# z: 56.9
158-

0 commit comments

Comments
 (0)