pylabrobot.centrifuge.highres.microspin_backend.MicroSpinBackend.spin#

async MicroSpinBackend.spin(g: float, duration: float, acceleration: float = 0.5, deceleration: float = 0.5) None#

Start a spin cycle on the MicroSpin.

Parameters:
  • g (float) – Relative centrifugal force in ×g. Must be in [1, 3000] (3000 ×g is the spec maximum per manual §11).

  • duration (float) – Time at speed in seconds. Must be >= 1.

  • acceleration (float) – Acceleration ramp as a fraction of the machine maximum, in (0, 1]. Internally converted to the integer percent the firmware expects.

  • deceleration (float) – Deceleration ramp as a fraction of the machine maximum, in (0, 1]. The MicroSpin firmware uses a fast decel curve above CENTRIFUGE_DECEL_THRESHOLD_G (default 300 ×g) and a slow one below, so the effective decel rate may vary across the run.

Raises:
  • ValueError – If any argument is out of range.

  • MicroSpinError – If the device rejects the spin (e.g. door not closed, device not homed, imbalance trip).

Warns:
  • UserWarning – If g is below LOW_G_WARNING_THRESHOLD (30 ×g by default). At very low G-forces the spindle’s “stopped” sensor sometimes fails to latch at the end of the spin, so the firmware never emits the final OK! completion line. From the client’s point of view the command appears to hang indefinitely; subsequent commands will time out because the firmware still considers a spin in progress. If you hit this, the recovery path is abort() followed by clear_button_abort() (and possibly a power-cycle).

  • UserWarning – If deceleration is below STUCK_DECEL_WARNING_THRESHOLD (0.20 = 20 % of max). Very low decel rates have empirically failed to ever report spin-down in real-world testing (spin 1000 100 10 10 ran for >30 min with no completion). The recovery path is the same as for the low-G hang above.

  • UserWarning – If deceleration is below SLOW_DECEL_WARNING_THRESHOLD (0.40 = 40 % of max) but at or above the stuck threshold. Spin-down completes correctly here but is slow: tested spin 1000 100 20 10 (decel = 0.20) took ~7 minutes. Make sure your wait_for_spindle_stopped() budget (default 30 min) and any application-level timeouts allow for this. Only one decel warning is emitted per call; if both thresholds are crossed, the stuck-decel warning takes precedence.

Return type:

None

Safety:

See the module-level docstring for the pre-spin checklist. This method does NOT verify physical conditions; it only validates argument ranges.