Skip to content

Commit c07b22d

Browse files
Introduce Worklist(diti_mode=...) for DiTi-compatible wash schemes
Closes #77
1 parent 745f064 commit c07b22d

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

robotools/fluenttools/worklist.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ def __init__(
2525
filepath: Optional[Union[str, Path]] = None,
2626
max_volume: Union[int, float] = 950,
2727
auto_split: bool = True,
28+
diti_mode: bool = False,
2829
) -> None:
29-
super().__init__(filepath, max_volume, auto_split)
30+
super().__init__(filepath, max_volume, auto_split, diti_mode)
3031

3132
def _get_well_position(self, labware: Labware, well: str) -> int:
3233
return get_well_position(labware, well)

robotools/worklists/base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(
2626
filepath: Optional[Union[str, Path]] = None,
2727
max_volume: Union[int, float] = 950,
2828
auto_split: bool = True,
29+
diti_mode: bool = False,
2930
) -> None:
3031
"""Creates a worklist writer.
3132
@@ -38,6 +39,9 @@ def __init__(
3839
auto_split : bool
3940
If `True`, large volumes in transfer operations are automatically splitted.
4041
If set to `False`, `InvalidOperationError` is raised when a pipetting volume exceeds `max_volume`.
42+
diti_mode
43+
Activate this when using DiTis.
44+
Uses ``W;`` for all wash schemes and raises errors when using commands that are only for fixed tips.
4145
"""
4246
self._filepath: Optional[Path] = None
4347
if filepath is not None:
@@ -46,6 +50,7 @@ def __init__(
4650
raise ValueError("The `max_volume` parameter is required.")
4751
self.max_volume = max_volume
4852
self.auto_split = auto_split
53+
self.diti_mode = diti_mode
4954
super().__init__()
5055

5156
@property
@@ -113,13 +118,19 @@ def wash(self, scheme: int = 1) -> None:
113118
scheme : int
114119
Number indicating the wash scheme (default: 1)
115120
"""
121+
if self.diti_mode:
122+
self.append("W;")
123+
return
124+
116125
if not scheme in {1, 2, 3, 4}:
117126
raise ValueError("scheme must be either 1, 2, 3 or 4")
118127
self.append(f"W{scheme};")
119128
return
120129

121130
def decontaminate(self) -> None:
122131
"""Decontamination wash consists of a decontamination wash followed by a normal wash."""
132+
if self.diti_mode:
133+
raise InvalidOperationError("Decontamination wash is not available with DiTis.")
123134
self.append("WD;")
124135
return
125136

robotools/worklists/test_base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ def test_wash(self) -> None:
201201
"W4;",
202202
]
203203
assert wl == exp
204+
205+
with BaseWorklist(diti_mode=True) as wl:
206+
wl.wash()
207+
wl.wash(3)
208+
assert wl == [
209+
"W;",
210+
"W;",
211+
]
204212
return
205213

206214
@pytest.mark.parametrize("cls", [EvoWorklist, FluentWorklist])
@@ -233,12 +241,21 @@ def test_wash_schemes(self, cls, scheme, exp):
233241
assert wl[-1] == "F;"
234242
else:
235243
raise NotImplementedError()
244+
245+
# In DiTi mode, any numeric wash scheme results in "W;"
246+
with cls(diti_mode=True) as wl:
247+
wl.transfer(A, "A01", A, "A01", 25, wash_scheme=2)
248+
assert wl[-1] == "W;"
236249
pass
237250

238251
def test_decontaminate(self) -> None:
239252
with BaseWorklist() as wl:
240253
wl.decontaminate()
241254
assert wl == ["WD;"]
255+
256+
with BaseWorklist(diti_mode=True) as wl:
257+
with pytest.raises(InvalidOperationError, match="not available"):
258+
wl.decontaminate()
242259
return
243260

244261
def test_flush(self) -> None:

0 commit comments

Comments
 (0)