Skip to content

Commit

Permalink
Update move_liha
Browse files Browse the repository at this point in the history
  • Loading branch information
sirno committed Mar 25, 2024
1 parent c0c7b7a commit 49828aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## 1.0.1 --- Pypetting Guidance System (WIP)
## 1.1.0 --- Pypetting Guidance System (WIP)

- Fix labware passed as string in storex module.
- Change `move_liha` function to create less faulty entries

## 1.0.0 --- Pypetting Guidance System (Dec 16, 2021)

Expand Down
26 changes: 17 additions & 9 deletions pypetting/liha.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def aspirate(
column_mask : array_like
Boolean mask to indicate which wells to aspirate from
volumes : array_like | int | float
Array showing which volumes each tip aspirates; a number is given, all
tips will aspirate that volume.
Array showing which volumes each tip aspirates; if a number is given,
all tips will aspirate that volume.
spacing : int, optional
Spacing of the tips with respect to the column mask
labware : Labware | str, optional
Expand Down Expand Up @@ -118,7 +118,8 @@ def wash(waste_volume: int | float, cleaner_volume: int | float, station: int):
def move_liha(
grid_site: GridSite,
column: int,
positions: ArrayLike = None,
column_mask: ArrayLike,
tip_array: ArrayLike = None,
spacing: int = 1,
labware: Labware | str = "greiner96",
local: bool = False,
Expand All @@ -130,21 +131,28 @@ def move_liha(
if isinstance(labware, str):
labware = labwares[labware]

if positions is None:
positions = np.array([True] * 8)
if tip_array is None:
tip_array = np.array([True] * 8)

if column not in range(1, labware.cols + 1):
raise IndexError(f"Plate column out of bounds: {column=}")

tip_array = np.array(tip_array)
column_mask = np.array(column_mask)

if tip_array.sum() != column_mask.sum():
n, m = tip_array.sum(), column_mask.sum()
raise IndexError(f"Number of tips in `tip_array` and `column_mask` do not match: {n} != {m})

command = (
(
"B;MoveLiha("
"255,"
f"{bin_to_dec(tip_array)},"
f"{grid_site.grid},"
f"{grid_site.site},"
f'{spacing},"'
f"{spacing},\""
).encode()
+ _well_select(positions, column, labware.rows, labware.cols)
+ _well_select(column_mask, column, labware.rows, labware.cols)
+ (f'",{local:#d},{z_pos},0,{speed},0,0);').encode()
)

Expand Down Expand Up @@ -188,7 +196,7 @@ def _liha_command(
labware: Labware | str = "greiner96",
):
if isinstance(volumes, int | float):
volumes = np.array(column_mask * volumes)
volumes = np.array(column_mask) * volumes

if isinstance(labware, str):
labware = labwares[labware]
Expand Down

0 comments on commit 49828aa

Please # to comment.