I plan on implementing this since in v1 it’s a good suggestion. The type for backend_params should just be Serializable, the backends will deal with the rest.
This is nice, but how will this work with PLR’s current move from this existing feature-first (liquid handler) to the new device-first (STAR) architecture?
basically when using autoreload, the isinstance(backend_params, XParams) will fail if it has reloaded because the class the user passes is not the same as the class it checks against. This is a known issue in autoreload, but I feel like in PLR we do a lot of notebook/auto reload based development, so I added a BackendParams class that overrides __instancecheck__ to be robust against auto reload. Quite hacky, but I feel like things breaking in the background is worse.
@dataclass(frozen=True)
class Mix:
volume: float
repetitions: int
flow_rate: float
but some backends like the STAR take in more mixing parameters than the general case, like mix_position_from_liquid_surface. in v0 it’s passed through backend kwargs. in the current v1 it’s passed through BackendParams.
I really like the idea of including backend arguments into the Mix class because its lack of including the surface_following_distance_during_mix argument (which I use for every mix action) for the STAR has been very confusing and annoying.
But I’d say adding an additional requirement for a backend-specific subclass(?) looks very awkward too and increases verbosity.
How about we just add backend-arguments directly to the Mix class?
Which would then submit all information anyway to the backend for (1) verification of value acceptance, and (2) firmware payload generation.
Note: This very specific example cannot refer to the STAR(let) because, if I’m not mistaken, that backend’s dispense command’s mixing after dispensing does not work based on a firmware issue (see post from Jan-2024).
Most liquid handlers move along Z axis during mixing, so we really should be able to populate all the required firmware arguments in Mix, including surface_following_distance_during_mix, but also whatever the equivalent is for other liquid handlers. I think the OT2 is the only LH that does not have simultaneous z and dispenser control.