opentrons 8.7.0a5__py3-none-any.whl → 8.7.0a7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of opentrons might be problematic. Click here for more details.

Files changed (144) hide show
  1. opentrons/_version.py +2 -2
  2. opentrons/drivers/asyncio/communication/serial_connection.py +129 -52
  3. opentrons/drivers/heater_shaker/abstract.py +5 -0
  4. opentrons/drivers/heater_shaker/driver.py +10 -0
  5. opentrons/drivers/heater_shaker/simulator.py +4 -0
  6. opentrons/drivers/thermocycler/abstract.py +6 -0
  7. opentrons/drivers/thermocycler/driver.py +61 -10
  8. opentrons/drivers/thermocycler/simulator.py +6 -0
  9. opentrons/hardware_control/api.py +24 -5
  10. opentrons/hardware_control/backends/controller.py +8 -2
  11. opentrons/hardware_control/backends/ot3controller.py +3 -0
  12. opentrons/hardware_control/backends/ot3simulator.py +2 -1
  13. opentrons/hardware_control/backends/simulator.py +2 -1
  14. opentrons/hardware_control/backends/subsystem_manager.py +5 -2
  15. opentrons/hardware_control/emulation/abstract_emulator.py +6 -4
  16. opentrons/hardware_control/emulation/connection_handler.py +8 -5
  17. opentrons/hardware_control/emulation/heater_shaker.py +12 -3
  18. opentrons/hardware_control/emulation/settings.py +1 -1
  19. opentrons/hardware_control/emulation/thermocycler.py +67 -15
  20. opentrons/hardware_control/module_control.py +82 -8
  21. opentrons/hardware_control/modules/__init__.py +3 -0
  22. opentrons/hardware_control/modules/absorbance_reader.py +11 -4
  23. opentrons/hardware_control/modules/flex_stacker.py +38 -9
  24. opentrons/hardware_control/modules/heater_shaker.py +42 -5
  25. opentrons/hardware_control/modules/magdeck.py +8 -4
  26. opentrons/hardware_control/modules/mod_abc.py +13 -5
  27. opentrons/hardware_control/modules/tempdeck.py +25 -5
  28. opentrons/hardware_control/modules/thermocycler.py +68 -11
  29. opentrons/hardware_control/modules/types.py +20 -1
  30. opentrons/hardware_control/modules/utils.py +11 -4
  31. opentrons/hardware_control/nozzle_manager.py +3 -0
  32. opentrons/hardware_control/ot3api.py +26 -5
  33. opentrons/hardware_control/poller.py +22 -8
  34. opentrons/hardware_control/scripts/update_module_fw.py +5 -0
  35. opentrons/hardware_control/types.py +31 -2
  36. opentrons/legacy_commands/module_commands.py +23 -0
  37. opentrons/legacy_commands/protocol_commands.py +20 -0
  38. opentrons/legacy_commands/types.py +80 -0
  39. opentrons/motion_planning/deck_conflict.py +17 -12
  40. opentrons/motion_planning/waypoints.py +15 -29
  41. opentrons/protocol_api/__init__.py +5 -1
  42. opentrons/protocol_api/_types.py +6 -1
  43. opentrons/protocol_api/core/common.py +3 -1
  44. opentrons/protocol_api/core/engine/_default_labware_versions.py +32 -11
  45. opentrons/protocol_api/core/engine/labware.py +8 -1
  46. opentrons/protocol_api/core/engine/module_core.py +75 -8
  47. opentrons/protocol_api/core/engine/protocol.py +18 -1
  48. opentrons/protocol_api/core/engine/tasks.py +48 -0
  49. opentrons/protocol_api/core/engine/well.py +8 -0
  50. opentrons/protocol_api/core/legacy/legacy_module_core.py +24 -4
  51. opentrons/protocol_api/core/legacy/legacy_protocol_core.py +11 -1
  52. opentrons/protocol_api/core/legacy/legacy_well_core.py +4 -0
  53. opentrons/protocol_api/core/legacy/tasks.py +19 -0
  54. opentrons/protocol_api/core/legacy_simulator/legacy_protocol_core.py +14 -2
  55. opentrons/protocol_api/core/legacy_simulator/tasks.py +19 -0
  56. opentrons/protocol_api/core/module.py +37 -4
  57. opentrons/protocol_api/core/protocol.py +11 -2
  58. opentrons/protocol_api/core/tasks.py +31 -0
  59. opentrons/protocol_api/core/well.py +4 -0
  60. opentrons/protocol_api/labware.py +5 -0
  61. opentrons/protocol_api/module_contexts.py +117 -11
  62. opentrons/protocol_api/protocol_context.py +26 -4
  63. opentrons/protocol_api/robot_context.py +38 -21
  64. opentrons/protocol_api/tasks.py +48 -0
  65. opentrons/protocol_api/validation.py +6 -1
  66. opentrons/protocol_engine/actions/__init__.py +4 -2
  67. opentrons/protocol_engine/actions/actions.py +22 -9
  68. opentrons/protocol_engine/clients/sync_client.py +42 -7
  69. opentrons/protocol_engine/commands/__init__.py +42 -0
  70. opentrons/protocol_engine/commands/absorbance_reader/close_lid.py +2 -15
  71. opentrons/protocol_engine/commands/absorbance_reader/open_lid.py +2 -15
  72. opentrons/protocol_engine/commands/aspirate.py +1 -0
  73. opentrons/protocol_engine/commands/command.py +1 -0
  74. opentrons/protocol_engine/commands/command_unions.py +49 -0
  75. opentrons/protocol_engine/commands/create_timer.py +83 -0
  76. opentrons/protocol_engine/commands/dispense.py +1 -0
  77. opentrons/protocol_engine/commands/drop_tip.py +32 -8
  78. opentrons/protocol_engine/commands/heater_shaker/__init__.py +14 -0
  79. opentrons/protocol_engine/commands/heater_shaker/common.py +20 -0
  80. opentrons/protocol_engine/commands/heater_shaker/set_and_wait_for_shake_speed.py +5 -4
  81. opentrons/protocol_engine/commands/heater_shaker/set_shake_speed.py +136 -0
  82. opentrons/protocol_engine/commands/heater_shaker/set_target_temperature.py +31 -5
  83. opentrons/protocol_engine/commands/movement_common.py +2 -0
  84. opentrons/protocol_engine/commands/pick_up_tip.py +21 -11
  85. opentrons/protocol_engine/commands/set_tip_state.py +97 -0
  86. opentrons/protocol_engine/commands/temperature_module/set_target_temperature.py +38 -7
  87. opentrons/protocol_engine/commands/thermocycler/__init__.py +16 -0
  88. opentrons/protocol_engine/commands/thermocycler/run_extended_profile.py +6 -0
  89. opentrons/protocol_engine/commands/thermocycler/run_profile.py +8 -0
  90. opentrons/protocol_engine/commands/thermocycler/set_target_block_temperature.py +40 -6
  91. opentrons/protocol_engine/commands/thermocycler/set_target_lid_temperature.py +29 -5
  92. opentrons/protocol_engine/commands/thermocycler/start_run_extended_profile.py +191 -0
  93. opentrons/protocol_engine/commands/touch_tip.py +1 -1
  94. opentrons/protocol_engine/commands/unsafe/unsafe_place_labware.py +6 -22
  95. opentrons/protocol_engine/commands/wait_for_tasks.py +98 -0
  96. opentrons/protocol_engine/errors/__init__.py +4 -0
  97. opentrons/protocol_engine/errors/exceptions.py +55 -0
  98. opentrons/protocol_engine/execution/__init__.py +2 -0
  99. opentrons/protocol_engine/execution/command_executor.py +8 -0
  100. opentrons/protocol_engine/execution/create_queue_worker.py +5 -1
  101. opentrons/protocol_engine/execution/labware_movement.py +9 -12
  102. opentrons/protocol_engine/execution/movement.py +2 -0
  103. opentrons/protocol_engine/execution/queue_worker.py +4 -0
  104. opentrons/protocol_engine/execution/run_control.py +8 -0
  105. opentrons/protocol_engine/execution/task_handler.py +157 -0
  106. opentrons/protocol_engine/protocol_engine.py +75 -34
  107. opentrons/protocol_engine/resources/__init__.py +2 -0
  108. opentrons/protocol_engine/resources/concurrency_provider.py +27 -0
  109. opentrons/protocol_engine/resources/deck_configuration_provider.py +7 -0
  110. opentrons/protocol_engine/resources/labware_validation.py +10 -6
  111. opentrons/protocol_engine/state/_well_math.py +60 -18
  112. opentrons/protocol_engine/state/addressable_areas.py +2 -0
  113. opentrons/protocol_engine/state/commands.py +14 -11
  114. opentrons/protocol_engine/state/geometry.py +213 -374
  115. opentrons/protocol_engine/state/labware.py +52 -102
  116. opentrons/protocol_engine/state/labware_origin_math/errors.py +94 -0
  117. opentrons/protocol_engine/state/labware_origin_math/stackup_origin_to_labware_origin.py +1331 -0
  118. opentrons/protocol_engine/state/module_substates/thermocycler_module_substate.py +37 -0
  119. opentrons/protocol_engine/state/modules.py +21 -8
  120. opentrons/protocol_engine/state/motion.py +44 -0
  121. opentrons/protocol_engine/state/state.py +14 -0
  122. opentrons/protocol_engine/state/state_summary.py +2 -0
  123. opentrons/protocol_engine/state/tasks.py +139 -0
  124. opentrons/protocol_engine/state/tips.py +177 -258
  125. opentrons/protocol_engine/state/update_types.py +16 -9
  126. opentrons/protocol_engine/types/__init__.py +9 -3
  127. opentrons/protocol_engine/types/deck_configuration.py +5 -1
  128. opentrons/protocol_engine/types/instrument.py +8 -1
  129. opentrons/protocol_engine/types/labware.py +1 -13
  130. opentrons/protocol_engine/types/module.py +10 -0
  131. opentrons/protocol_engine/types/tasks.py +38 -0
  132. opentrons/protocol_engine/types/tip.py +9 -0
  133. opentrons/protocol_runner/create_simulating_orchestrator.py +29 -2
  134. opentrons/protocol_runner/run_orchestrator.py +18 -2
  135. opentrons/protocols/api_support/definitions.py +1 -1
  136. opentrons/protocols/api_support/types.py +2 -1
  137. opentrons/simulate.py +48 -15
  138. opentrons/system/camera.py +1 -1
  139. {opentrons-8.7.0a5.dist-info → opentrons-8.7.0a7.dist-info}/METADATA +4 -4
  140. {opentrons-8.7.0a5.dist-info → opentrons-8.7.0a7.dist-info}/RECORD +143 -127
  141. opentrons/protocol_engine/state/_labware_origin_math.py +0 -636
  142. {opentrons-8.7.0a5.dist-info → opentrons-8.7.0a7.dist-info}/WHEEL +0 -0
  143. {opentrons-8.7.0a5.dist-info → opentrons-8.7.0a7.dist-info}/entry_points.txt +0 -0
  144. {opentrons-8.7.0a5.dist-info → opentrons-8.7.0a7.dist-info}/licenses/LICENSE +0 -0
@@ -347,6 +347,11 @@ class Well:
347
347
  """Get the current liquid volume in a well."""
348
348
  return self._core.get_liquid_volume()
349
349
 
350
+ @requires_version(2, 27)
351
+ def has_tracked_liquid(self) -> bool:
352
+ """Get the current liquid volume in a well."""
353
+ return self._core.has_tracked_liquid()
354
+
350
355
  @requires_version(2, 24)
351
356
  def volume_from_height(self, height: LiquidTrackingType) -> LiquidTrackingType:
352
357
  """Return the volume contained in a well at any height."""
@@ -43,6 +43,7 @@ from .module_validation_and_errors import (
43
43
  )
44
44
  from .labware import Labware
45
45
  from . import validation
46
+ from . import Task
46
47
 
47
48
 
48
49
  _MAGNETIC_MODULE_HEIGHT_PARAM_REMOVED_IN = APIVersion(2, 14)
@@ -447,18 +448,28 @@ class TemperatureModuleContext(ModuleContext):
447
448
  No other protocol commands will execute while waiting for the temperature.
448
449
 
449
450
  :param celsius: A value between 4 and 95, representing the target temperature in °C.
451
+
450
452
  """
451
453
  self._core.set_target_temperature(celsius)
452
454
  self._core.wait_for_target_temperature()
453
455
 
454
456
  @publish(command=cmds.tempdeck_set_temp)
455
457
  @requires_version(2, 3)
456
- def start_set_temperature(self, celsius: float) -> None:
458
+ def start_set_temperature(self, celsius: float) -> Task:
457
459
  """Set the target temperature without waiting for the target to be hit.
458
460
 
461
+ .. versionchanged:: 2.27
462
+ Returns a task object that represents concurrent preheating.
463
+ Pass the task object to :py:meth:`ProtocolContext.wait_for_tasks` to wait for the preheat to complete.
464
+
465
+ On version 2.26 or below, this function returns ``None``.
459
466
  :param celsius: A value between 4 and 95, representing the target temperature in °C.
460
467
  """
461
- self._core.set_target_temperature(celsius)
468
+ task = self._core.set_target_temperature(celsius)
469
+ if self._api_version >= APIVersion(2, 27):
470
+ return Task(api_version=self._api_version, core=task)
471
+ else:
472
+ return cast(Task, None)
462
473
 
463
474
  @publish(command=cmds.tempdeck_await_temp)
464
475
  @requires_version(2, 3)
@@ -656,9 +667,16 @@ class ThermocyclerContext(ModuleContext):
656
667
  hold_time_minutes: Optional[float] = None,
657
668
  ramp_rate: Optional[float] = None,
658
669
  block_max_volume: Optional[float] = None,
659
- ) -> None:
670
+ ) -> Task:
660
671
  """Set the target temperature for the well block, in °C.
661
672
 
673
+ .. versionchanged::2.27
674
+ Returns a task object that represents concurrent preheating.
675
+ Pass the task object to :py:meth:`ProtocolContext.wait_for_tasks` to wait for
676
+ the preheat to complete.
677
+
678
+ On version 2.26 or below, this function returns ``None``.
679
+
662
680
  :param temperature: A value between 4 and 99, representing the target
663
681
  temperature in °C.
664
682
  :param hold_time_minutes: The number of minutes to hold, after reaching
@@ -672,6 +690,10 @@ class ThermocyclerContext(ModuleContext):
672
690
  :param block_max_volume: The greatest volume of liquid contained in any
673
691
  individual well of the loaded labware, in µL.
674
692
  If not specified, the default is 25 µL.
693
+ After API version 2.27 it will attempt to use
694
+ the liquid tracking of the labware first and
695
+ then fall back to the 25 if there is no probed
696
+ or loaded liquid.
675
697
 
676
698
  .. note::
677
699
 
@@ -682,18 +704,31 @@ class ThermocyclerContext(ModuleContext):
682
704
  seconds = validation.ensure_hold_time_seconds(
683
705
  seconds=hold_time_seconds, minutes=hold_time_minutes
684
706
  )
685
- self._core.set_target_block_temperature(
707
+ if self._api_version >= APIVersion(2, 27) and block_max_volume is None:
708
+ block_max_volume = self._get_current_labware_max_vol()
709
+ task = self._core.set_target_block_temperature(
686
710
  celsius=temperature,
687
711
  hold_time_seconds=seconds,
688
712
  block_max_volume=block_max_volume,
713
+ ramp_rate=ramp_rate,
689
714
  )
690
- self._core.wait_for_block_temperature()
715
+ if self._api_version >= APIVersion(2, 27):
716
+ return Task(api_version=self._api_version, core=task)
717
+ else:
718
+ return cast(Task, None)
691
719
 
692
720
  @publish(command=cmds.thermocycler_set_lid_temperature)
693
721
  @requires_version(2, 0)
694
- def set_lid_temperature(self, temperature: float) -> None:
722
+ def set_lid_temperature(self, temperature: float) -> Task:
695
723
  """Set the target temperature for the heated lid, in °C.
696
724
 
725
+ .. versionchanged::2.27
726
+ Returns a task object that represents concurrent preheating.
727
+ Pass the task object to :py:meth:`ProtocolContext.wait_for_tasks` to wait for
728
+ the preheat to complete.
729
+
730
+ On version 2.26 or below, this function returns ``None``.
731
+
697
732
  :param temperature: A value between 37 and 110, representing the target
698
733
  temperature in °C.
699
734
 
@@ -703,8 +738,11 @@ class ThermocyclerContext(ModuleContext):
703
738
  ``temperature`` is reached.
704
739
 
705
740
  """
706
- self._core.set_target_lid_temperature(celsius=temperature)
707
- self._core.wait_for_lid_temperature()
741
+ task = self._core.set_target_lid_temperature(celsius=temperature)
742
+ if self._api_version >= APIVersion(2, 27):
743
+ return Task(api_version=self._api_version, core=task)
744
+ else:
745
+ return cast(Task, None)
708
746
 
709
747
  @publish(command=cmds.thermocycler_execute_profile)
710
748
  @requires_version(2, 0)
@@ -739,6 +777,39 @@ class ThermocyclerContext(ModuleContext):
739
777
  block_max_volume=block_max_volume,
740
778
  )
741
779
 
780
+ @publish(command=cmds.thermocycler_start_execute_profile)
781
+ @requires_version(2, 27)
782
+ def start_execute_profile(
783
+ self,
784
+ steps: List[ThermocyclerStep],
785
+ repetitions: int,
786
+ block_max_volume: Optional[float] = None,
787
+ ) -> Task:
788
+ """Start a Thermocycler profile and return a :py:class:`Task` representing its execution.
789
+ Profile is defined as a cycle of ``steps``, for a given number of ``repetitions``.
790
+
791
+ Returns a task object that represents concurrent execution of the profile.
792
+ Pass the task object to :py:meth:`ProtocolContext.wait_for_tasks` to wait for the preheat to complete.
793
+
794
+ :param steps: List of steps that make up a single cycle.
795
+ Each list item should be a dictionary that maps to the parameters
796
+ of the :py:meth:`set_block_temperature` method. The dictionary's
797
+ keys must be ``temperature`` and one or both of
798
+ ``hold_time_seconds`` and ``hold_time_minutes``.
799
+ :param repetitions: The number of times to repeat the cycled steps.
800
+ :param block_max_volume: The greatest volume of liquid contained in any
801
+ individual well of the loaded labware, in µL.
802
+ If not specified, the default is 25 µL.
803
+ """
804
+ repetitions = validation.ensure_thermocycler_repetition_count(repetitions)
805
+ validated_steps = validation.ensure_thermocycler_profile_steps(steps)
806
+ task = self._core.start_execute_profile(
807
+ steps=validated_steps,
808
+ repetitions=repetitions,
809
+ block_max_volume=block_max_volume,
810
+ )
811
+ return Task(api_version=self._api_version, core=task)
812
+
742
813
  @publish(command=cmds.thermocycler_deactivate_lid)
743
814
  @requires_version(2, 0)
744
815
  def deactivate_lid(self) -> None:
@@ -860,6 +931,19 @@ class ThermocyclerContext(ModuleContext):
860
931
  """Index of the current step within the current cycle"""
861
932
  return self._core.get_current_step_index()
862
933
 
934
+ def _get_current_labware_max_vol(self) -> Optional[float]:
935
+ max_vol: Optional[float] = None
936
+ if self.labware is not None:
937
+ for well in self.labware.wells():
938
+ if well.has_tracked_liquid():
939
+ # make sure that max vol is a float first if we have liquid
940
+ max_vol = 0.0 if max_vol is None else max_vol
941
+ well_vol = well.current_liquid_volume()
942
+ # ignore simulated probe results
943
+ if isinstance(well_vol, float):
944
+ max_vol = max(max_vol, well_vol)
945
+ return max_vol
946
+
863
947
 
864
948
  class HeaterShakerContext(ModuleContext):
865
949
  """An object representing a connected Heater-Shaker Module.
@@ -973,18 +1057,21 @@ class HeaterShakerContext(ModuleContext):
973
1057
 
974
1058
  @requires_version(2, 13)
975
1059
  @publish(command=cmds.heater_shaker_set_target_temperature)
976
- def set_target_temperature(self, celsius: float) -> None:
1060
+ def set_target_temperature(self, celsius: float) -> Task:
977
1061
  """Set target temperature and return immediately.
978
1062
 
979
1063
  Sets the Heater-Shaker's target temperature and returns immediately without
980
1064
  waiting for the target to be reached. Does not delay the protocol until
981
1065
  target temperature has reached.
982
1066
  Use :py:meth:`~.HeaterShakerContext.wait_for_temperature` to delay
983
- protocol execution.
1067
+ protocol execution for api levels below 2.27.
984
1068
 
985
1069
  .. versionchanged:: 2.25
986
1070
  Removed the minimum temperature limit of 37 °C. Note that temperatures under ambient are
987
1071
  not achievable.
1072
+ .. versionchanged:: 2.27
1073
+ Returns a task object that represents concurrent preheating.
1074
+ Pass the task object to :py:meth:`ProtocolContext.wait_for_tasks` to wait for the preheat to complete.
988
1075
 
989
1076
  :param celsius: A value under 95, representing the target temperature in °C.
990
1077
  Values are automatically truncated to two decimal places,
@@ -993,7 +1080,11 @@ class HeaterShakerContext(ModuleContext):
993
1080
  validated_temp = validate_heater_shaker_temperature(
994
1081
  celsius=celsius, api_version=self.api_version
995
1082
  )
996
- self._core.set_target_temperature(celsius=validated_temp)
1083
+ task = self._core.set_target_temperature(celsius=validated_temp)
1084
+ if self._api_version >= APIVersion(2, 27):
1085
+ return Task(api_version=self._api_version, core=task)
1086
+ else:
1087
+ return cast(Task, None)
997
1088
 
998
1089
  @requires_version(2, 13)
999
1090
  @publish(command=cmds.heater_shaker_wait_for_temperature)
@@ -1021,6 +1112,21 @@ class HeaterShakerContext(ModuleContext):
1021
1112
  validated_speed = validate_heater_shaker_speed(rpm=rpm)
1022
1113
  self._core.set_and_wait_for_shake_speed(rpm=validated_speed)
1023
1114
 
1115
+ @requires_version(2, 27)
1116
+ @publish(command=cmds.heater_shaker_set_shake_speed)
1117
+ def set_shake_speed(self, rpm: int) -> Task:
1118
+ """Set a shake speed in rpm to run in the background.
1119
+
1120
+ .. note::
1121
+
1122
+ Before shaking, this command will retract the pipettes upward if they are parked adjacent to the Heater-Shaker.
1123
+
1124
+ :param rpm: A value between 200 and 3000, representing the target shake speed in revolutions per minute.
1125
+ """
1126
+ validated_speed = validate_heater_shaker_speed(rpm=rpm)
1127
+ task = self._core.set_shake_speed(rpm=validated_speed)
1128
+ return Task(api_version=self._api_version, core=task)
1129
+
1024
1130
  @requires_version(2, 13)
1025
1131
  @publish(command=cmds.heater_shaker_open_labware_latch)
1026
1132
  def open_labware_latch(self) -> None:
@@ -89,6 +89,7 @@ from .module_contexts import (
89
89
  FlexStackerContext,
90
90
  ModuleContext,
91
91
  )
92
+ from .tasks import Task
92
93
  from ._parameters import Parameters
93
94
 
94
95
 
@@ -234,10 +235,7 @@ class ProtocolContext(CommandPublisher):
234
235
  @property
235
236
  @requires_version(2, 22)
236
237
  def robot(self) -> RobotContext:
237
- """The :py:class:`.RobotContext` for the protocol.
238
-
239
- :meta private:
240
- """
238
+ """The :py:class:`.RobotContext` for the protocol."""
241
239
  if self._core.robot_type != "OT-3 Standard" or not self._robot:
242
240
  raise RobotTypeError("The RobotContext is only available on Flex robots.")
243
241
  return self._robot
@@ -1289,6 +1287,30 @@ class ProtocolContext(CommandPublisher):
1289
1287
  delay_time = seconds + minutes * 60
1290
1288
  self._core.delay(seconds=delay_time, msg=msg)
1291
1289
 
1290
+ @publish(command=cmds.wait_for_tasks)
1291
+ @requires_version(2, 27)
1292
+ def wait_for_tasks(self, tasks: list[Task]) -> None:
1293
+ """Wait for a list of tasks to complete before executing subsequent commands.
1294
+
1295
+ :param list Task: tasks: A list of Task objects to wait for.
1296
+
1297
+ Task objects can be commands that are allowed to run concurrently.
1298
+ """
1299
+ task_cores = [task._core for task in tasks]
1300
+ self._core.wait_for_tasks(task_cores)
1301
+
1302
+ @publish(command=cmds.create_timer)
1303
+ @requires_version(2, 27)
1304
+ def create_timer(self, seconds: float) -> Task:
1305
+ """Create a timer task that runs in the background.
1306
+
1307
+ :param float seconds: The time to delay in seconds.
1308
+
1309
+ This timer will continue to run until it is complete and will not block subsequent commands.
1310
+ """
1311
+ task_core = self._core.create_timer(seconds=seconds)
1312
+ return Task(core=task_core, api_version=self._api_version)
1313
+
1292
1314
  @requires_version(2, 0)
1293
1315
  def home(self) -> None:
1294
1316
  """Home the movement system of the robot."""
@@ -46,7 +46,7 @@ class RobotContext(publisher.CommandPublisher):
46
46
  Objects in this class should not be instantiated directly. Instead, instances are
47
47
  returned by :py:meth:`ProtocolContext.robot`.
48
48
 
49
- .. versionadded:: 2.20
49
+ .. versionadded:: 2.22
50
50
 
51
51
  """
52
52
 
@@ -83,15 +83,19 @@ class RobotContext(publisher.CommandPublisher):
83
83
  speed: Optional[float] = None,
84
84
  ) -> None:
85
85
  """
86
- Move a specified mount to a destination location on the deck.
86
+ Move a specified mount to a location on the deck.
87
87
 
88
88
  :param mount: The mount of the instrument you wish to move.
89
89
  This can either be an instance of :py:class:`.types.Mount` or one
90
90
  of the strings ``"left"``, ``"right"``, ``"extension"``, ``"gripper"``. Note
91
91
  that the gripper mount can be referred to either as ``"extension"`` or ``"gripper"``.
92
92
  :type mount: types.Mount or str
93
- :param Location destination:
94
- :param speed:
93
+ :param destination: Any location on the deck, specified as:
94
+
95
+ - a slot, like ``"A1"``
96
+ - a defined location, like labware in a deck slot
97
+ - an absolute location, like a point {x=10 , y=10, z=10} or a deck location and point ("A1" + point {x=10 , y=10, z=10})
98
+ :param speed: The absolute speed in mm/s.
95
99
  """
96
100
  mount = validation.ensure_instrument_mount(mount)
97
101
  with publisher.publish_context(
@@ -116,10 +120,9 @@ class RobotContext(publisher.CommandPublisher):
116
120
  Move a set of axes to an absolute position on the deck.
117
121
 
118
122
  :param axis_map: A dictionary mapping axes to an absolute position on the deck in mm.
119
- :param critical_point: The critical point to move the axes with. It should only
120
- specify the gantry axes (i.e. `x`, `y`, `z`).
121
- :param float speed: The maximum speed with which you want to move all the axes
122
- in the axis map.
123
+ :param critical_point: The critical point, or specific point on the object being moved, to move the axes with. It should only specify the gantry axes (i.e. `x`, `y`, `z`). When you specify a critical point, you're specifying the object on the gantry to be moved. If not specified, the critical point defaults to the center of the carriage attached to the gantry.
124
+ :param float speed: The maximum speed with which to move all axes in mm/s.
125
+
123
126
  """
124
127
  instrument_on_left = self._core.get_pipette_type_from_engine(Mount.LEFT)
125
128
  is_96_channel = instrument_on_left == PipetteNameType.P1000_96
@@ -154,11 +157,9 @@ class RobotContext(publisher.CommandPublisher):
154
157
  """
155
158
  Move a set of axes to a relative position on the deck.
156
159
 
157
- :param axis_map: A dictionary mapping axes to relative movements in mm.
158
- :type mount: types.Mount or str
160
+ :param axis_map: A dictionary mapping axes to relative movements from the current position in mm.
159
161
 
160
- :param float speed: The maximum speed with which you want to move all the axes
161
- in the axis map.
162
+ :param float speed: The maximum speed with which to move all axes in mm/s.
162
163
  """
163
164
  instrument_on_left = self._core.get_pipette_type_from_engine(Mount.LEFT)
164
165
  is_96_channel = instrument_on_left == PipetteNameType.P1000_96
@@ -177,7 +178,10 @@ class RobotContext(publisher.CommandPublisher):
177
178
  self._core.move_axes_relative(axis_map, speed)
178
179
 
179
180
  def close_gripper_jaw(self, force: Optional[float] = None) -> None:
180
- """Command the gripper closed with some force."""
181
+ """Closes the Flex Gripper jaws with a specified force.
182
+
183
+ :param force: Force with which to close the gripper jaws in newtons.
184
+ """
181
185
  with publisher.publish_context(
182
186
  broker=self.broker,
183
187
  command=cmds.close_gripper(
@@ -187,7 +191,10 @@ class RobotContext(publisher.CommandPublisher):
187
191
  self._core.close_gripper(force)
188
192
 
189
193
  def open_gripper_jaw(self) -> None:
190
- """Command the gripper open."""
194
+ """Opens the Flex Gripper jaws with a specified force.
195
+
196
+ :param force: Force with which to open the gripper jaws in newtons.
197
+ """
191
198
  with publisher.publish_context(
192
199
  broker=self.broker,
193
200
  command=cmds.open_gripper(),
@@ -200,9 +207,9 @@ class RobotContext(publisher.CommandPublisher):
200
207
  location: Union[Location, ModuleContext, DeckLocation],
201
208
  ) -> AxisMapType:
202
209
  """
203
- Build a :py:class:`.types.AxisMapType` from a location to be compatible with
210
+ Build an axis map from a location to provide to
204
211
  either :py:meth:`.RobotContext.move_axes_to` or :py:meth:`.RobotContext.move_axes_relative`.
205
- You must provide only one of `location`, `slot`, or `module` to build
212
+ You must provide only one of either a `location`, `slot`, or `module` to build
206
213
  the axis map.
207
214
 
208
215
  :param mount: The mount of the instrument you wish create an axis map for.
@@ -210,7 +217,10 @@ class RobotContext(publisher.CommandPublisher):
210
217
  of the strings ``"left"``, ``"right"``, ``"extension"``, ``"gripper"``. Note
211
218
  that the gripper mount can be referred to either as ``"extension"`` or ``"gripper"``.
212
219
  :type mount: types.Mount or str
213
- :param location: The location to format an axis map for.
220
+ :param location: Any location on the deck, specified as:
221
+
222
+ - a deck location, like slot ``"A1"``.
223
+ - a defined location, like a module on the deck.
214
224
  :type location: `Well`, `ModuleContext`, `DeckLocation` or `OffDeckType`
215
225
  """
216
226
  mount = validation.ensure_instrument_mount(mount)
@@ -248,7 +258,11 @@ class RobotContext(publisher.CommandPublisher):
248
258
  self, mount: Union[Mount, str], volume: float, action: PipetteActionTypes
249
259
  ) -> AxisMapType:
250
260
  """
251
- Build a :py:class:`.types.AxisMapType` for a pipette plunger motor from volume.
261
+ Build an axis map to move a pipette plunger motor to complete liquid handling actions.
262
+
263
+ :mount: The left or right instrument mount the pipette is attached to.
264
+ :param volume: A volume to convert to an axis map for linear plunger displacement.
265
+ :param action: Choose to ``aspirate`` or ``dispense``.
252
266
 
253
267
  """
254
268
  pipette_name = self._core.get_pipette_type_from_engine(mount)
@@ -268,7 +282,9 @@ class RobotContext(publisher.CommandPublisher):
268
282
  self, mount: Union[Mount, str], position_name: PlungerPositionTypes
269
283
  ) -> AxisMapType:
270
284
  """
271
- Build a :py:class:`.types.AxisMapType` for a pipette plunger motor from position_name.
285
+ Build an axis map to move a pipette plunger motor to a named position.
286
+
287
+ :param position_name: A named position to move the pipette plunger to. Choose from ``top``, ``bottom``, ``blowout``, or ``drop`` plunger positions.
272
288
 
273
289
  """
274
290
  pipette_name = self._core.get_pipette_type_from_engine(mount)
@@ -284,8 +300,9 @@ class RobotContext(publisher.CommandPublisher):
284
300
  return {pipette_axis: pipette_position}
285
301
 
286
302
  def build_axis_map(self, axis_map: StringAxisMap) -> AxisMapType:
287
- """Take in a :py:class:`.types.StringAxisMap` and output a :py:class:`.types.AxisMapType`.
288
- A :py:class:`.types.StringAxisMap` is allowed to contain any of the following strings:
303
+ """Take in a :py:class:`.types.StringAxisMap` and output an axis map.
304
+
305
+ The :py:class:`.types.StringAxisMap` is allowed to contain any of the following strings:
289
306
  ``"x"``, ``"y"``, "``z_l"``, "``z_r"``, "``z_g"``, ``"q"``.
290
307
 
291
308
  An example of a valid axis map could be:
@@ -0,0 +1,48 @@
1
+ """Data for concurrent protocol tasks."""
2
+ from typing import TYPE_CHECKING
3
+ from datetime import datetime
4
+ from opentrons.protocols.api_support.util import requires_version
5
+ from opentrons.protocols.api_support.types import APIVersion
6
+
7
+ if TYPE_CHECKING:
8
+ from .core.common import TaskCore
9
+
10
+
11
+ class Task:
12
+ """A concurrent protocol task created by a protocol API function.
13
+
14
+ .. versionadded:: 2.27
15
+ """
16
+
17
+ def __init__(self, core: "TaskCore", api_version: APIVersion) -> None:
18
+ """Initialize a Task."""
19
+ self._core = core
20
+ self._api_version = api_version
21
+
22
+ @property
23
+ @requires_version(2, 27)
24
+ def created_at(self) -> datetime:
25
+ """The timestamp of when the task was created."""
26
+ return self._core.get_created_at_timestamp()
27
+
28
+ @property
29
+ @requires_version(2, 27)
30
+ def done(self) -> bool:
31
+ """Returns ``True`` if the task is done."""
32
+ return self._core.is_done()
33
+
34
+ @property
35
+ @requires_version(2, 27)
36
+ def started(self) -> bool:
37
+ """Returns ``True`` if the task has started."""
38
+ return self._core.is_started()
39
+ ...
40
+
41
+ @property
42
+ @requires_version(2, 27)
43
+ def finished_at(self) -> datetime | None:
44
+ """The timestamp of the when the task finished.
45
+
46
+ Returns ``None`` if the task hasn't finished yet.
47
+ """
48
+ return self._core.get_finished_at_timestamp()
@@ -489,6 +489,7 @@ def ensure_thermocycler_profile_steps(
489
489
  temperature = step.get("temperature")
490
490
  hold_mins = step.get("hold_time_minutes")
491
491
  hold_secs = step.get("hold_time_seconds")
492
+ ramp_rate = step.get("ramp_rate")
492
493
  if temperature is None:
493
494
  raise ValueError("temperature must be defined for each step in cycle")
494
495
  if hold_mins is None and hold_secs is None:
@@ -496,10 +497,14 @@ def ensure_thermocycler_profile_steps(
496
497
  "either hold_time_minutes or hold_time_seconds must be"
497
498
  "defined for each step in cycle"
498
499
  )
500
+ if ramp_rate is not None and ramp_rate <= 0:
501
+ raise ValueError("Ramp rate must be greater than 0.")
499
502
  validated_seconds = ensure_hold_time_seconds(hold_secs, hold_mins)
500
503
  validated_steps.append(
501
504
  ThermocyclerStep(
502
- temperature=temperature, hold_time_seconds=validated_seconds
505
+ temperature=temperature,
506
+ hold_time_seconds=validated_seconds,
507
+ ramp_rate=ramp_rate,
503
508
  )
504
509
  )
505
510
  return validated_steps
@@ -26,8 +26,9 @@ from .actions import (
26
26
  AddModuleAction,
27
27
  FinishErrorDetails,
28
28
  DoorChangeAction,
29
- ResetTipsAction,
30
29
  SetPipetteMovementSpeedAction,
30
+ StartTaskAction,
31
+ FinishTaskAction,
31
32
  )
32
33
  from .get_state_update import get_state_updates
33
34
 
@@ -55,8 +56,9 @@ __all__ = [
55
56
  "AddAddressableAreaAction",
56
57
  "AddModuleAction",
57
58
  "DoorChangeAction",
58
- "ResetTipsAction",
59
59
  "SetPipetteMovementSpeedAction",
60
+ "StartTaskAction",
61
+ "FinishTaskAction",
60
62
  # action payload values
61
63
  "PauseSource",
62
64
  "FinishErrorDetails",
@@ -3,6 +3,7 @@
3
3
  Actions can be passed to the ActionDispatcher, where they will trigger
4
4
  reactions in objects that subscribe to the pipeline, like the StateStore.
5
5
  """
6
+
6
7
  import dataclasses
7
8
  from datetime import datetime
8
9
  from enum import Enum
@@ -20,6 +21,7 @@ from ..commands import (
20
21
  CommandDefinedErrorData,
21
22
  )
22
23
  from ..error_recovery_policy import ErrorRecoveryPolicy, ErrorRecoveryType
24
+ from ..errors import ErrorOccurrence
23
25
  from ..notes.notes import CommandNote
24
26
  from ..state.update_types import StateUpdate
25
27
  from ..types import (
@@ -27,6 +29,7 @@ from ..types import (
27
29
  ModuleDefinition,
28
30
  Liquid,
29
31
  DeckConfigurationType,
32
+ Task,
30
33
  )
31
34
 
32
35
 
@@ -60,7 +63,7 @@ class PauseAction:
60
63
  class StopAction:
61
64
  """Request engine execution to stop soon."""
62
65
 
63
- from_estop: bool = False
66
+ from_asynchronous_error: bool = False
64
67
 
65
68
 
66
69
  @dataclasses.dataclass(frozen=True)
@@ -201,6 +204,22 @@ class FailCommandAction:
201
204
  """The command to fail, in its prior `running` state."""
202
205
 
203
206
 
207
+ @dataclasses.dataclass(frozen=True)
208
+ class StartTaskAction:
209
+ """Store new task in state."""
210
+
211
+ task: Task
212
+
213
+
214
+ @dataclasses.dataclass(frozen=True)
215
+ class FinishTaskAction:
216
+ """Mark task as finished in state."""
217
+
218
+ task_id: str
219
+ finished_at: datetime
220
+ error: ErrorOccurrence | None
221
+
222
+
204
223
  @dataclasses.dataclass(frozen=True)
205
224
  class AddLabwareOffsetAction:
206
225
  """Add a labware offset, to apply to subsequent `LoadLabwareCommand`s."""
@@ -253,13 +272,6 @@ class AddModuleAction:
253
272
  module_live_data: LiveData
254
273
 
255
274
 
256
- @dataclasses.dataclass(frozen=True)
257
- class ResetTipsAction:
258
- """Reset the tip tracking state of a given tip rack."""
259
-
260
- labware_id: str
261
-
262
-
263
275
  @dataclasses.dataclass(frozen=True)
264
276
  class SetPipetteMovementSpeedAction:
265
277
  """Set the speed of a pipette's X/Y/Z movements. Does not affect plunger speed.
@@ -296,7 +308,8 @@ Action = Union[
296
308
  SetDeckConfigurationAction,
297
309
  AddAddressableAreaAction,
298
310
  AddLiquidAction,
299
- ResetTipsAction,
300
311
  SetPipetteMovementSpeedAction,
301
312
  SetErrorRecoveryPolicyAction,
313
+ StartTaskAction,
314
+ FinishTaskAction,
302
315
  ]
@@ -65,6 +65,48 @@ class SyncClient:
65
65
  ) -> commands.LoadLabwareResult:
66
66
  pass
67
67
 
68
+ @overload
69
+ def execute_command_without_recovery(
70
+ self, params: commands.CreateTimerParams
71
+ ) -> commands.CreateTimerResult:
72
+ pass
73
+
74
+ @overload
75
+ def execute_command_without_recovery(
76
+ self, params: commands.temperature_module.SetTargetTemperatureParams
77
+ ) -> commands.temperature_module.SetTargetTemperatureResult:
78
+ pass
79
+
80
+ @overload
81
+ def execute_command_without_recovery(
82
+ self, params: commands.thermocycler.StartRunExtendedProfileParams
83
+ ) -> commands.thermocycler.StartRunExtendedProfileResult:
84
+ pass
85
+
86
+ @overload
87
+ def execute_command_without_recovery(
88
+ self, params: commands.heater_shaker.SetTargetTemperatureParams
89
+ ) -> commands.heater_shaker.SetTargetTemperatureResult:
90
+ pass
91
+
92
+ @overload
93
+ def execute_command_without_recovery(
94
+ self, params: commands.heater_shaker.SetShakeSpeedParams
95
+ ) -> commands.heater_shaker.SetShakeSpeedResult:
96
+ pass
97
+
98
+ @overload
99
+ def execute_command_without_recovery(
100
+ self, params: commands.thermocycler.SetTargetBlockTemperatureParams
101
+ ) -> commands.thermocycler.SetTargetBlockTemperatureResult:
102
+ pass
103
+
104
+ @overload
105
+ def execute_command_without_recovery(
106
+ self, params: commands.thermocycler.SetTargetLidTemperatureParams
107
+ ) -> commands.thermocycler.SetTargetLidTemperatureResult:
108
+ pass
109
+
68
110
  @overload
69
111
  def execute_command_without_recovery(
70
112
  self, params: commands.LoadModuleParams
@@ -149,13 +191,6 @@ class SyncClient:
149
191
  """Add a liquid to the engine."""
150
192
  return self._transport.call_method("add_liquid", name=name, color=color, description=description) # type: ignore[no-any-return]
151
193
 
152
- def reset_tips(self, labware_id: str) -> None:
153
- """Reset a labware's tip tracking state.."""
154
- self._transport.call_method(
155
- "reset_tips",
156
- labware_id=labware_id,
157
- )
158
-
159
194
  def add_labware_offset(self, request: LabwareOffsetCreate) -> None:
160
195
  """Add a labware offset."""
161
196
  self._transport.call_method("add_labware_offset", request=request)