Fixing LLD_mode in Visualizer

Hi everyone,

Does anyone know how to enable the use of lld_mode in the visualizer?

Reproduction code:

from pylabrobot.liquid_handling import LiquidHandler
from pylabrobot.resources.hamilton import STARLetDeck
from pylabrobot.liquid_handling.backends import ChatterBoxBackend
from pylabrobot.resources import (
    TIP_CAR_480_A00, PLT_CAR_L5AC_A00,
    STF_L, HTF_L,
    Cos_96_DW_1mL
)

backend = ChatterBoxBackend()

lh = LiquidHandler(backend=backend, deck=STARLetDeck())

await lh.setup()

tip_car = TIP_CAR_480_A00(name="tip_carrier")
tip_car[0] = tiprack_300ul = STF_L(name="tip_rack_01")
tip_car[3] = tiprack_1000ul = HTF_L(name="tip_rack_04")

plt_car = PLT_CAR_L5AC_A00(name="plate carrier")
plt_car[0] = plate_1 = Cos_96_DW_1mL(name="aspiration plate")

lh.deck.assign_child_resource(tip_car, rails=1)
lh.deck.assign_child_resource(plt_car, rails=21)

await lh.pick_up_tips(tip_spots=[tiprack_300ul.children[0]], use_channels=[0])

await lh.aspirate(
        [tiprack_300ul.children[0]],
        use_channels = [0],
        vols=[100],
        lld_mode=[lh.backend.LLDMode.OFF]*no_channels,
        )

returns error…

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 32
     24 lh.deck.assign_child_resource(plt_car, rails=21)
     26 await lh.pick_up_tips(tip_spots=[tiprack_300ul.children[0]], use_channels=[0])
     28 await lh.aspirate(
     29         [tiprack_300ul.children[0]],
     30         use_channels = [0],
     31         vols=[100],
---> 32         lld_mode=[lh.backend.LLDMode.OFF]*no_channels,
     33         )

AttributeError: 'ChatterBoxBackend' object has no attribute 'LLDMode'

At the moment we have to comment this line out whenever we want to test the same code we also want to use on the machine.
Is there a simple way to make the visualiser (/lh.backend==ChatterBoxBackend) tolerate all surplus attributes from different machines?

This is actually a “problem” with the ChatterBoxBackend, not with the Visualizer. LLDMode is an attribute of STAR only.

Some options:

  1. define a testing backend that has LLDMode defined, for example by subclassing STAR and overriding send_command to do nothing/print
  2. use lld_mode=[lh.backend.LLDMode.OFF]*no_channels, if isinstance(lh.backend, STAR) else [None]*no_channels
1 Like