Skip to content

Commit

Permalink
removed protocols and added module calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
rclarke0 committed May 3, 2024
1 parent 25baba6 commit 7d6ec49
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 6,467 deletions.
3 changes: 0 additions & 3 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,11 @@ def _save_vol_and_loc(self, vol: float, well: str) -> None:
self._saved_volumes[well] = 0.0
self._saved_volumes[well] += vol


def print_saved_volumes(self) -> None:
print("Beginning print for pipette", self.name, self.mount)
for well, volume in self._saved_volumes.items():
print(well, volume)


def _determine_speed(self, speed: float) -> float:
if self.api_version < APIVersion(2, 4):
return clamp_value(speed, 80, 20, "touch_tip:")
Expand Down Expand Up @@ -768,7 +766,6 @@ def air_gap(
target = loc.labware.as_well().top(height)
self.move_to(target, publish=False)
self.aspirate(volume)
#self.aspirate(0)
return self

@publisher.publish(command=cmds.return_tip)
Expand Down
41 changes: 32 additions & 9 deletions api/src/opentrons/protocol_api/module_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def __init__(
self._core_map = core_map
self._api_version = api_version
self._open_close_count: Dict[str, float] = {}
self._temp_switch_count: Dict[str,float] = {}
self._home_count: Dict[str,float] = {}

@property # type: ignore[misc]
@requires_version(2, 0)
Expand Down Expand Up @@ -111,11 +113,23 @@ def load_labware_object(self, labware: Labware) -> Labware:

return self._core.geometry.add_labware(labware)

def _open_close_counter(self):
serial = self._core.get_serial_number()
if serial not in self._open_close_count:
self._open_close_count[serial] = 0.0
self._open_close_count[serial] += 1
def _open_close_counter(self, part_name: str):
"""Counts Number of Open/Close Cycles."""
if part_name not in self._open_close_count:
self._open_close_count[part_name] = 0
self._open_close_count[part_name] += 0.5

def _home_counter(self, action_name):
"""Counts Number of heater shaker homes."""
if action_name not in self._home_count:
self._home_count[action_name] = 0
self._home_count[action_name] += 1

def _temp_switch_counter(self, action_name: str):
"""Counts Number of Times Module Changes temperature."""
if action_name not in self._temp_switch_count:
self._temp_switch_count[action_name] = 0
self._temp_switch_count[action_name] +=1

def load_labware(
self,
Expand Down Expand Up @@ -343,6 +357,7 @@ def set_temperature(self, celsius: float) -> None:
"""
self._core.set_target_temperature(celsius)
self._core.wait_for_target_temperature()
self._temp_switch_counter("# of TM Temp Changes")

@publish(command=cmds.tempdeck_set_temp)
@requires_version(2, 3)
Expand All @@ -352,6 +367,8 @@ def start_set_temperature(self, celsius: float) -> None:
:param celsius: A value between 4 and 95, representing the target temperature in °C.
"""
self._core.set_target_temperature(celsius)
self._temp_switch_counter("# of TM Temp Changes")


@publish(command=cmds.tempdeck_await_temp)
@requires_version(2, 3)
Expand Down Expand Up @@ -528,14 +545,14 @@ def serial_number(self) -> str:
@requires_version(2, 0)
def open_lid(self) -> str:
"""Open the lid."""
self._open_close_counter()
self._open_close_counter("# of TC Lid Open/Close")
return self._core.open_lid().value

@publish(command=cmds.thermocycler_close)
@requires_version(2, 0)
def close_lid(self) -> str:
"""Close the lid."""
self._open_close_counter()
self._open_close_counter("# of TC Lid Open/Close")
return self._core.close_lid().value

@publish(command=cmds.thermocycler_set_block_temp)
Expand Down Expand Up @@ -579,6 +596,7 @@ def set_block_temperature(
block_max_volume=block_max_volume,
)
self._core.wait_for_block_temperature()
self._temp_switch_counter("# of TC Block Temp Changes")

@publish(command=cmds.thermocycler_set_lid_temperature)
@requires_version(2, 0)
Expand All @@ -596,6 +614,7 @@ def set_lid_temperature(self, temperature: float) -> None:
"""
self._core.set_target_lid_temperature(celsius=temperature)
self._core.wait_for_lid_temperature()
self._temp_switch_counter("# of TC Lid Temp Changes")

@publish(command=cmds.thermocycler_execute_profile)
@requires_version(2, 0)
Expand Down Expand Up @@ -632,6 +651,9 @@ def execute_profile(
repetitions=repetitions,
block_max_volume=block_max_volume,
)
total_changes = steps * repetitions
for i in total_changes:
self._temp_switch_counter("# of TC Block Temp Changes")

@publish(command=cmds.thermocycler_deactivate_lid)
@requires_version(2, 0)
Expand Down Expand Up @@ -923,7 +945,7 @@ def open_labware_latch(self) -> None:
if they are parked adjacent to the left or right of the Heater-Shaker.
"""
self._core.open_labware_latch()
self._open_close_counter()
self._open_close_counter("# of HS Latch/Open Close")


@requires_version(2, 13)
Expand All @@ -935,7 +957,7 @@ def close_labware_latch(self) -> None:
even if the latch was manually closed before starting the protocol.
"""
self._core.close_labware_latch()
self._open_close_counter()
self._open_close_counter("# of HS Latch/Open Close")


@requires_version(2, 13)
Expand All @@ -946,6 +968,7 @@ def deactivate_shaker(self) -> None:
Decelerating to 0 rpm typically only takes a few seconds.
"""
self._core.deactivate_shaker()
self._home_counter("# of HS Homes")

@requires_version(2, 13)
@publish(command=cmds.heater_shaker_deactivate_heater)
Expand Down
Loading

0 comments on commit 7d6ec49

Please sign in to comment.