Skip to content

Expose Well.bottom() & Well.top() #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pylabrobot/resources/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import math
from typing import Callable, List, Optional, Tuple, Union

from pylabrobot.resources.coordinate import Coordinate
from pylabrobot.resources.container import Container
from pylabrobot.resources.liquid import Liquid

Expand Down Expand Up @@ -128,6 +129,29 @@ def compute_height_from_volume(self, liquid_volume: float) -> float:

return self._compute_height_from_volume(liquid_volume)

def bottom(self, z_offset: float = 0.0):
""" Compute the absolute coordinate of the bottom of a well, with the potential
to conveniantly declare a z_offset directly.
"""

if self.location is None:
return None
else:
well_bottom_coordinate = self.get_absolute_location() + self.center()
return well_bottom_coordinate + Coordinate(0,0,z_offset)

def top(self, z_offset: float = 0.0):
""" Compute the absolute coordinate of the top of a well, with the potential
to conveniantly declare a z_offset directly.
"""

if self.location is None:
return None
else:
well_top_coordinate = self.get_absolute_location() + self.center() + \
Coordinate(0,0,self.get_size_z())
return well_top_coordinate + Coordinate(0,0,z_offset)

def set_liquids(self, liquids: List[Tuple[Optional["Liquid"], float]]):
""" Set the liquids in the well.

Expand Down
Loading