Discrepancy between lld_mode type between aspirate & dispense

Hi everyone,

Is there are a discrepancy between the lh.aspirate() and lh.dispense() methods in regards to what type their respective lld_mode has to be?

Possible liquid handling factors & their levels:

  • lld_mode_types = [int, LLDMode]
  • methods = [lh.aspirate(), lh.dispense()]

When using aspirate → only lld_mode_types = [LLDMode] works and when using an integer it doesn’t:

await lh.aspirate(
        [source_well],
        vols=[5],
        swap_speed = [50],
        homogenization_speed = [20],
        lld_mode = [1],
        use_channels = [0],
    )

…throws up error:

File ~/pylabrobot/pylabrobot/liquid_handling/backends/hamilton/STAR.py:81, in _fill_in_defaults(val, default)
     79 # if the val is a list of the correct length, the values must be of the right type.
     80 if not all(isinstance(v, t) for v in val):
---> 81   raise ValueError(f"Value must be a list of {t}, but is {val}")
     82 # the value is ready to be used.
     83 return val

ValueError: Value must be a list of <enum 'LLDMode'>, but is [1]

And when using dispense → only lld_mode_types = [int] works and when using LLDMode it doesn’t:

await lh.dispense(
        [dest_well],
        vols=[5],
        swap_speed = [50],
        lld_mode = [lh.backend.LLDMode(1)],
        use_channels = [0],
        flow_rates = 50,
        mix_speed = 30)

…throws up error:

File ~/pylabrobot/pylabrobot/liquid_handling/backends/hamilton/STAR.py:81, in _fill_in_defaults(val, default)
     79 # if the val is a list of the correct length, the values must be of the right type.
     80 if not all(isinstance(v, t) for v in val):
---> 81   raise ValueError(f"Value must be a list of {t}, but is {val}")
     82 # the value is ready to be used.
     83 return val

ValueError: Value must be a list of <class 'int'>, but is [<LLDMode.GAMMA: 1>]

This is a bit confusing. Can we standardise the lld_mode-type to be used between aspirate & dispense?

I don’t think it matters too much which one as long as it is the same.

You’re right, good catch. Should I switch it over to LLDMode?

Yes, I think LLDMode is the best, removing potential ambiguity of “what does this integer mean”.

Once people see LLDMode they should know to look up the different LLDModes (0 - no LLD & bottom of well aspiration/dispensation, 1 - cLLD, 2 - pLLD, 3 - combined cLLC + pLLD, 4 - “crash” channel… gently).

Thank you for the fast response, @rickwierenga.

1 Like

hyg make LLDMode consistent · PyLabRobot/pylabrobot@92ea726 · GitHub

1 Like