Return last liquid level

Is it possible to run the equivalent of Venus’s Get Last Liquid Level in pyhamilton?

Great question! Yes it’s possible, but the library doesn’t have an out-of-the-box function that does it yet. It can be done very easily though.

Here is the function definition for aspirate in

def aspirate(ham_int, pos_tuples, vols, **more_options):

more_options represents optional keyword arguments found in the aspiration entry of Two of the options are for liquid level detection:

        'capacitiveLLD':0, # (integer) 0=Off, 1=Max, 2=High, 3=Mid, 4=Low, 5=From labware definition
        'pressureLLD':0, # (integer) 0=Off, 1=Max, 2=High, 3=Mid, 4=Low, 5=From liquid class definition

So you can run aspirate(…, pressureLLD = 5) for example.

However, the function definition for aspirate doesn’t collect that data yet or return anything. That will have to be modified to bring the data to the user level. Here’s how to do it.

Change this

def aspirate(...):

to this

def aspirate(...):
 response = ham_int.wait_on_response(ham_int.send_command(ASPIRATE,...)
 return response

the return value of aspirate will be a dictionary that contains the liquid level detection height in one of the keys stepReturn2 and stepReturn3 for mm and mL respectively.

You’re welcome to make these changes yourself and make a PR to the repo if you want to become an official contributor or I can do this but it will take a day or two.

Thanks very much. I’ve cloned the repo and made the changes you indicate. Happy to push them back but as this is my first time dabbling with pyhamilton (and contribution to an open source project woohoo!) it will likely be a few days before I am able to test

1 Like

Ok cool! Great job! See these instructions for initiating the merge of your new contributions into the main repo: