Getting Started with PyHamilton

Hello! Since I have been learning PyHamilton mostly through trial and error, I thought it would be applicable to make a bit of a repository regarding some stumbling blocks that I ran into as a novice. I thought about making a new thread, but I think that this thread seems like an appropriate place to put them. Stefan, please feel free to correct anything if what I say is not 100% correct - I am still figuring this out after all!

Documentation and Example Protocols
The developers have put ample time and effort into developing this platform! This includes the online documentation that can be found here. I highly suggest you read it as it can answer a lot of your questions as to how things work. Also worth noting is the fact that Stefan has detailed some example protocols at the top of this forum post as well as here and here. Check them out, as they’re a great way to learn the syntax :slight_smile:

The “Waste” sequence.

  • While PyHamilton does not require sequences to perform liquid handling, Stefan has taught me that a sequence called “Waste” is a requirement for PyHamilton to function. This is a default sequence created with any new .layfile, but if you, like me, delete the sequence without thinking twice about then just create a new one. Eject tips to waste by passing the argument useDefaultWaste=1.

Length Padding

  • Arguments to the aspirate, dispense, tip_pick_up and tip_eject commands do not strictly have to be of length 8. This means that your position-tuples (arg: pos_tuples) and volumes (arg: vols) do not necessarily need to be padded to a length of 8 with None, thought it is probably “poor form” not to do so!

assert_parallel_nones: lists must have parallel None entries

  • This generally happens in an aspirate or dispense command where your position-tuples and your volumes list do not have the same structure.

  • At first I thought that this meant that all Nones within each list had to be sitting next to each other, such as [10, 10, 10, 10, 10, 10, None, None]. This is not the case. Your None values within any one list are allowed to sit wherever you would like. This is great as it means you can freely turn channels on and off as you please.

  • What the assert_parralel_nones error is really referring to is the fact that the two arguments, pos_tuples and vols, must have None at the same indexes. Again, the arguments do not have to have a length of 8, provided they have the same structure.

ResourceUnavailableError: No unassigned resource of type XXX available.

  • This generally happens when initializing labware using resource_list_with_prefix.

  • To have PyHamilton recognise the labware you would like to interact with, it is essential to give the labware a name, as this name will be the identifier used to locate the labware. Less obvious, however, is that your labware names need to have a prefix and a suffix and have to be of the form “prefix_suffix”.

  • Generally, the prefix will be something descriptive, like “plate” or “EppiCarrier”, while the suffix is generally an ordinal character such as 1/2/3 or a/b/c.

  • Note that this notation is enforced even if you only have a single piece of the labware! If I had a single plate on deck then it is required to be e.g. “plate_1”, as just calling it “plate” would throw the ResourceUnavailableError.

  • I have not been able to find locate the source code for resource_list_with_prefix, but I am almost certain that there is a .split(’_’) being performed on the labware IDs, hence the required name structure.

I will continue to keep a personal log of learnings such as those above, if others find them useful then I will post them every now and then!

2 Likes