Skip to content

Commit b0da084

Browse files
authored
configure trash on decks (#347)
1 parent b4ff02c commit b0da084

File tree

5 files changed

+44
-12
lines changed

5 files changed

+44
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5959
- put_direction -> drop_direction
6060
- `location` parameter of `assign_child_resource` is not optional (https://github.com/PyLabRobot/pylabrobot/pull/336)
6161
- `Resource.get_absolute_location` raises `NoLocationError` instead of `AssertionError` when absolute location is not defined (https://github.com/PyLabRobot/pylabrobot/pull/338)
62+
- `no_trash` and `no_teaching_rack` were renamed to `with_trash` and `with_teaching_rack` to avoid double negatives (https://github.com/PyLabRobot/pylabrobot/pull/347)
6263

6364
### Added
6465

@@ -143,6 +144,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
143144
- `hotel_high_speed=False`
144145
- `use_unsafe_hotel: bool = False`
145146
- `iswap_collision_control_level: int = 0`
147+
- `with_trash96` on `HamiltonSTARDeck` so there is more fine grained control (https://github.com/PyLabRobot/pylabrobot/pull/347)
146148

147149
### Deprecated
148150

pylabrobot/resources/hamilton/hamilton_decks.py

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def serialize(self) -> dict:
6767
return {
6868
**super().serialize(),
6969
"num_rails": self.num_rails,
70-
"no_trash": True, # data encoded as child. (not very pretty to have this key though...)
70+
"with_trash": False, # data encoded as child. (not very pretty to have this key though...)
71+
"with_trash96": False,
7172
}
7273

7374
def _check_safe_z_height(self, resource: Resource):
@@ -356,8 +357,11 @@ def __init__(
356357
name="deck",
357358
category: str = "deck",
358359
origin: Coordinate = Coordinate.zero(),
359-
no_trash: bool = False,
360-
no_teaching_rack: bool = False,
360+
with_trash: bool = True,
361+
with_trash96: bool = True,
362+
with_teaching_rack: bool = True,
363+
no_trash: Optional[bool] = None,
364+
no_teaching_rack: Optional[bool] = None,
361365
) -> None:
362366
"""Create a new STAR(let) deck of the given size."""
363367

@@ -371,8 +375,15 @@ def __init__(
371375
origin=origin,
372376
)
373377

378+
if no_trash is not None:
379+
raise NotImplementedError("no_trash is deprecated. Use with_trash=False instead.")
380+
if no_teaching_rack is not None:
381+
raise NotImplementedError(
382+
"no_teaching_rack is deprecated. Use with_teaching_rack=False instead."
383+
)
384+
374385
# assign trash area
375-
if not no_trash:
386+
if with_trash:
376387
trash_x = (
377388
size_x - 560
378389
) # only tested on STARLet, assume STAR is same distance from right max..
@@ -382,14 +393,16 @@ def __init__(
382393
location=Coordinate(x=trash_x, y=190.6, z=137.1),
383394
) # z I am not sure about
384395

396+
self._trash96: Optional[Trash] = None
397+
if with_trash96:
385398
# got this location from a .lay file, but will probably need to be adjusted by the user.
386399
self._trash96 = Trash("trash_core96", size_x=82.6, size_y=122.4, size_z=0) # size of tiprack
387400
self.assign_child_resource(
388401
resource=self._trash96,
389402
location=Coordinate(x=-232.1, y=110.3, z=189.0),
390403
) # 165.0 -> 189.0
391404

392-
if not no_teaching_rack:
405+
if with_teaching_rack:
393406
teaching_carrier = Resource(name="teaching_carrier", size_x=30, size_y=445.2, size_z=100)
394407
tip_spots = [
395408
TipSpot(
@@ -423,19 +436,26 @@ def __init__(
423436
def serialize(self) -> dict:
424437
return {
425438
**super().serialize(),
426-
"no_teaching_rack": True, # data encoded as child. (not very pretty to have this key though...)
439+
"with_teaching_rack": False, # data encoded as child. (not very pretty to have this key though...)
427440
}
428441

429442
def rails_to_location(self, rails: int) -> Coordinate:
430443
x = 100.0 + (rails - 1) * _RAILS_WIDTH
431444
return Coordinate(x=x, y=63, z=100)
432445

433446
def get_trash_area96(self) -> Trash:
447+
if self._trash96 is None:
448+
raise RuntimeError(
449+
"Trash area for 96-well plates was not created. Initialize with `with_trash96=True`."
450+
)
434451
return self._trash96
435452

436453

437454
def STARLetDeck(
438455
origin: Coordinate = Coordinate.zero(),
456+
with_trash: bool = True,
457+
with_trash96: bool = True,
458+
with_teaching_rack: bool = True,
439459
) -> HamiltonSTARDeck:
440460
"""Create a new STARLet deck.
441461
@@ -448,11 +468,17 @@ def STARLetDeck(
448468
size_y=STARLET_SIZE_Y,
449469
size_z=STARLET_SIZE_Z,
450470
origin=origin,
471+
with_trash=with_trash,
472+
with_trash96=with_trash96,
473+
with_teaching_rack=with_teaching_rack,
451474
)
452475

453476

454477
def STARDeck(
455478
origin: Coordinate = Coordinate.zero(),
479+
with_trash: bool = True,
480+
with_trash96: bool = True,
481+
with_teaching_rack: bool = True,
456482
) -> HamiltonSTARDeck:
457483
"""Create a new STAR deck.
458484
@@ -465,4 +491,7 @@ def STARDeck(
465491
size_y=STAR_SIZE_Y,
466492
size_z=STAR_SIZE_Z,
467493
origin=origin,
494+
with_trash=with_trash,
495+
with_trash96=with_trash96,
496+
with_teaching_rack=with_teaching_rack,
468497
)

pylabrobot/resources/hamilton/vantage_decks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(
1515
name="deck",
1616
category: str = "deck",
1717
origin: Coordinate = Coordinate.zero(),
18-
no_trash: bool = False,
18+
with_trash: bool = True,
1919
) -> None:
2020
"""Create a new Vantage deck of the given size.
2121
@@ -41,7 +41,7 @@ def __init__(
4141
)
4242
self.size = 1.3
4343

44-
if not no_trash:
44+
if with_trash:
4545
trash_x = size_x - 480 # works with vantage 1.3 (480) (used to be 460)
4646

4747
# an experimentally informed guess.

pylabrobot/resources/opentrons/deck.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(
1616
size_y: float = 565.2,
1717
size_z: float = 900,
1818
origin: Coordinate = Coordinate(0, 0, 0),
19-
no_trash: bool = False,
19+
with_trash: bool = True,
2020
name: str = "deck",
2121
):
2222
# size_z is probably wrong
@@ -40,7 +40,7 @@ def __init__(
4040
Coordinate(x=265.0, y=271.5, z=0.0),
4141
]
4242

43-
if not no_trash:
43+
if with_trash:
4444
self._assign_trash()
4545

4646
def _assign_trash(self):

pylabrobot/visualizer/lib.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ class HamiltonSTARDeck extends Deck {
469469
...super.serialize(),
470470
...{
471471
num_rails: this.num_rails,
472-
no_trash: true,
472+
with_trash: false,
473+
with_trash96: false,
473474
},
474475
};
475476
}
@@ -547,7 +548,7 @@ class OTDeck extends Deck {
547548
return {
548549
...super.serialize(),
549550
...{
550-
no_trash: true,
551+
with_trash: false,
551552
},
552553
};
553554
}

0 commit comments

Comments
 (0)