|
127 | 127 | target_position_from_absolute,
|
128 | 128 | target_position_from_relative,
|
129 | 129 | target_position_from_plunger,
|
| 130 | + target_positions_from_plunger_tracking, |
130 | 131 | offset_for_mount,
|
131 | 132 | deck_from_machine,
|
132 | 133 | machine_from_deck,
|
@@ -2994,6 +2995,102 @@ async def capacitive_sweep(
|
2994 | 2995 |
|
2995 | 2996 | AMKey = TypeVar("AMKey")
|
2996 | 2997 |
|
| 2998 | + async def aspirate_while_tracking( |
| 2999 | + self, |
| 3000 | + mount: Union[top_types.Mount, OT3Mount], |
| 3001 | + z_distance: float, |
| 3002 | + volume: float, |
| 3003 | + flow_rate: float = 1.0, |
| 3004 | + ) -> None: |
| 3005 | + """ |
| 3006 | + Aspirate a volume of liquid (in microliters/uL) while moving the z axis synchronously. |
| 3007 | +
|
| 3008 | + :param mount: A robot mount that the instrument is on. |
| 3009 | + :param z_distance: The distance the z axis will move during apsiration. |
| 3010 | + :param volume: The volume of liquid to be aspirated. |
| 3011 | + :param flow_rate: The flow rate to aspirate with. |
| 3012 | + """ |
| 3013 | + realmount = OT3Mount.from_mount(mount) |
| 3014 | + aspirate_spec = self._pipette_handler.plan_check_aspirate( |
| 3015 | + realmount, volume, flow_rate |
| 3016 | + ) |
| 3017 | + if not aspirate_spec: |
| 3018 | + return |
| 3019 | + target_pos = target_positions_from_plunger_tracking( |
| 3020 | + realmount, |
| 3021 | + aspirate_spec.plunger_distance, |
| 3022 | + z_distance, |
| 3023 | + self._current_position, |
| 3024 | + ) |
| 3025 | + try: |
| 3026 | + await self._backend.set_active_current( |
| 3027 | + {aspirate_spec.axis: aspirate_spec.current} |
| 3028 | + ) |
| 3029 | + async with self.restore_system_constrants(): |
| 3030 | + await self.set_system_constraints_for_plunger_acceleration( |
| 3031 | + realmount, aspirate_spec.acceleration |
| 3032 | + ) |
| 3033 | + await self._move( |
| 3034 | + target_pos, |
| 3035 | + speed=aspirate_spec.speed, |
| 3036 | + home_flagged_axes=False, |
| 3037 | + ) |
| 3038 | + except Exception: |
| 3039 | + self._log.exception("Aspirate failed") |
| 3040 | + aspirate_spec.instr.set_current_volume(0) |
| 3041 | + raise |
| 3042 | + else: |
| 3043 | + aspirate_spec.instr.add_current_volume(aspirate_spec.volume) |
| 3044 | + |
| 3045 | + async def dispense_while_tracking( |
| 3046 | + self, |
| 3047 | + mount: Union[top_types.Mount, OT3Mount], |
| 3048 | + z_distance: float, |
| 3049 | + volume: float, |
| 3050 | + push_out: Optional[float], |
| 3051 | + flow_rate: float = 1.0, |
| 3052 | + ) -> None: |
| 3053 | + """ |
| 3054 | + Dispense a volume of liquid (in microliters/uL) while moving the z axis synchronously. |
| 3055 | +
|
| 3056 | + :param mount: A robot mount that the instrument is on. |
| 3057 | + :param z_distance: The distance the z axis will move during dispensing. |
| 3058 | + :param volume: The volume of liquid to be dispensed. |
| 3059 | + :param flow_rate: The flow rate to dispense with. |
| 3060 | + """ |
| 3061 | + realmount = OT3Mount.from_mount(mount) |
| 3062 | + dispense_spec = self._pipette_handler.plan_check_dispense( |
| 3063 | + realmount, volume, flow_rate, push_out |
| 3064 | + ) |
| 3065 | + if not dispense_spec: |
| 3066 | + return |
| 3067 | + target_pos = target_positions_from_plunger_tracking( |
| 3068 | + realmount, |
| 3069 | + dispense_spec.plunger_distance, |
| 3070 | + z_distance, |
| 3071 | + self._current_position, |
| 3072 | + ) |
| 3073 | + |
| 3074 | + try: |
| 3075 | + await self._backend.set_active_current( |
| 3076 | + {dispense_spec.axis: dispense_spec.current} |
| 3077 | + ) |
| 3078 | + async with self.restore_system_constrants(): |
| 3079 | + await self.set_system_constraints_for_plunger_acceleration( |
| 3080 | + realmount, dispense_spec.acceleration |
| 3081 | + ) |
| 3082 | + await self._move( |
| 3083 | + target_pos, |
| 3084 | + speed=dispense_spec.speed, |
| 3085 | + home_flagged_axes=False, |
| 3086 | + ) |
| 3087 | + except Exception: |
| 3088 | + self._log.exception("dispense failed") |
| 3089 | + dispense_spec.instr.set_current_volume(0) |
| 3090 | + raise |
| 3091 | + else: |
| 3092 | + dispense_spec.instr.remove_current_volume(dispense_spec.volume) |
| 3093 | + |
2997 | 3094 | @property
|
2998 | 3095 | def attached_subsystems(self) -> Dict[SubSystem, SubSystemState]:
|
2999 | 3096 | """Get a view of the state of the currently-attached subsystems."""
|
|
0 commit comments