Hi everyone,
I was wondering whether someone is aware of a more elegant solution:
Task: Generate a PLR definition for a heater-cooler adapter similar to this…
My current solution:
def Hamilton_24_adapter_2ml_Eppis(name: str, with_lid: bool = False) -> Plate:
""" Hamilton cat. no.: 188181
Tube rack adapter for HHC and TCC, predefined for 2ml Eppendorf tubes.
Requires assignment at Coordinate(x=, y=, z=) relative to its HHC parent.
"""
new_plate = Plate(
name=name,
size_x=110.0,
size_y=83.0,
size_z=48.0,
ordered_items={},
lid=None,
model="HHC_adapter_24_2ml_Eppis",
)
dx=12
dy=2
dz=2 # adapter_tube_hole_bottom_thickness
item_dx=15.0
num_items_x=6
for idx_x in range(num_items_x):
for idx, idx_y in enumerate([68.5, 41.5, 26.5, 0.0]):
location = Coordinate(x=dx+item_dx*idx_x, y=dy+idx_y, z=dz)
new_well = Well(
name=f"HHC_adapter_24_2ml_Eppis_{idx_x}_{idx}",
size_x=11,
size_y=11,
size_z=32.5+11,
bottom_type=WellBottomType.V,
cross_section_type=CrossSectionType.CIRCLE,
material_z_thickness=.0.5,
compute_volume_from_height=_compute_volume_from_height_HHC_adapter_24_2ml_Eppis,
compute_height_from_volume=_compute_height_from_volume_HHC_adapter_24_2ml_Eppis
)
new_plate.assign_child_resource(new_well, location=location)
return new_plate
This worked very well until some recent changes in the implementation of ordered_items
.
It still generates the correct geometry but not having defined ordered_items
means that the Plate
does not have identifiers for the Well
s it contains, i.e. Hamilton_24_adapter_2ml_Eppis(name="test_plate")["A1"]
will raise an error.
I am searching for a quick way to add identifiers back to this plate.