65
65
GripDirection ,
66
66
MultiHeadAspirationContainer ,
67
67
MultiHeadAspirationPlate ,
68
- MultiHeadDispenseContainr ,
68
+ MultiHeadDispenseContainer ,
69
69
MultiHeadDispensePlate ,
70
70
Pickup ,
71
71
PickupTipRack ,
@@ -1568,6 +1568,7 @@ async def aspirate96(
1568
1568
flow_rate = float (flow_rate ) if flow_rate is not None else None
1569
1569
blow_out_air_volume = float (blow_out_air_volume ) if blow_out_air_volume is not None else None
1570
1570
1571
+ containers : Sequence [Container ]
1571
1572
if isinstance (resource , Container ):
1572
1573
if (
1573
1574
resource .get_absolute_size_x () < 108.0 or resource .get_absolute_size_y () < 70.0
@@ -1598,24 +1599,26 @@ async def aspirate96(
1598
1599
blow_out_air_volume = blow_out_air_volume ,
1599
1600
liquids = cast (List [List [Tuple [Optional [Liquid ], float ]]], all_liquids ), # stupid
1600
1601
)
1602
+
1603
+ containers = [resource ]
1601
1604
else :
1602
1605
if isinstance (resource , Plate ):
1603
1606
if resource .has_lid ():
1604
1607
raise ValueError ("Aspirating from plate with lid" )
1605
- wells = resource .get_all_items ()
1608
+ containers = resource .get_all_items ()
1606
1609
else :
1607
- wells = resource
1610
+ containers = resource
1608
1611
1609
1612
# ensure that wells are all in the same plate
1610
- plate = wells [0 ].parent
1611
- for well in wells :
1613
+ plate = containers [0 ].parent
1614
+ for well in containers :
1612
1615
if well .parent != plate :
1613
1616
raise ValueError ("All wells must be in the same plate" )
1614
1617
1615
- if not len (wells ) == 96 :
1616
- raise ValueError (f"aspirate96 expects 96 wells, got { len (wells )} " )
1618
+ if not len (containers ) == 96 :
1619
+ raise ValueError (f"aspirate96 expects 96 wells, got { len (containers )} " )
1617
1620
1618
- for well , channel in zip (wells , self .head96 .values ()):
1621
+ for well , channel in zip (containers , self .head96 .values ()):
1619
1622
# superfluous to have append in two places but the type checker is very angry and does not
1620
1623
# understand that Optional[Liquid] (remove_liquid) is the same as None from the first case
1621
1624
if well .tracker .is_disabled or not does_volume_tracking ():
@@ -1629,7 +1632,7 @@ async def aspirate96(
1629
1632
channel .get_tip ().tracker .add_liquid (liquid = liquid , volume = vol )
1630
1633
1631
1634
aspiration = MultiHeadAspirationPlate (
1632
- wells = wells ,
1635
+ wells = cast ( List [ Well ], containers ) ,
1633
1636
volume = volume ,
1634
1637
offset = offset ,
1635
1638
flow_rate = flow_rate ,
@@ -1642,9 +1645,9 @@ async def aspirate96(
1642
1645
try :
1643
1646
await self .backend .aspirate96 (aspiration = aspiration , ** backend_kwargs )
1644
1647
except Exception as error :
1645
- for channel , well in zip (self .head96 .values (), wells ):
1646
- if does_volume_tracking () and not well .tracker .is_disabled :
1647
- well .tracker .rollback ()
1648
+ for channel , container in zip (self .head96 .values (), containers ):
1649
+ if does_volume_tracking () and not container .tracker .is_disabled :
1650
+ container .tracker .rollback ()
1648
1651
channel .get_tip ().tracker .rollback ()
1649
1652
self ._trigger_callback (
1650
1653
"aspirate96" ,
@@ -1654,10 +1657,11 @@ async def aspirate96(
1654
1657
** backend_kwargs ,
1655
1658
)
1656
1659
else :
1657
- for channel , well in zip (self .head96 .values (), wells ):
1658
- if does_volume_tracking () and not well .tracker .is_disabled :
1659
- well .tracker .commit ()
1660
- channel .get_tip ().tracker .commit ()
1660
+ for channel , container in zip (self .head96 .values (), containers ):
1661
+ if does_volume_tracking () and not container .tracker .is_disabled :
1662
+ container .tracker .commit ()
1663
+ channel .get_tip ().tracker .commit ()
1664
+
1661
1665
self ._trigger_callback (
1662
1666
"aspirate96" ,
1663
1667
liquid_handler = self ,
@@ -1708,13 +1712,14 @@ async def dispense96(
1708
1712
1709
1713
tips = [channel .get_tip () for channel in self .head96 .values ()]
1710
1714
all_liquids : List [List [Tuple [Optional [Liquid ], float ]]] = []
1711
- dispense : Union [MultiHeadDispensePlate , MultiHeadDispenseContainr ]
1715
+ dispense : Union [MultiHeadDispensePlate , MultiHeadDispenseContainer ]
1712
1716
1713
1717
# Convert everything to floats to handle exotic number types
1714
1718
volume = float (volume )
1715
1719
flow_rate = float (flow_rate ) if flow_rate is not None else None
1716
1720
blow_out_air_volume = float (blow_out_air_volume ) if blow_out_air_volume is not None else None
1717
1721
1722
+ containers : Sequence [Container ]
1718
1723
if isinstance (resource , Container ):
1719
1724
if (
1720
1725
resource .get_absolute_size_x () < 108.0 or resource .get_absolute_size_y () < 70.0
@@ -1735,7 +1740,7 @@ async def dispense96(
1735
1740
for liquid , vol in reversed (reversed_liquids ):
1736
1741
channel .get_tip ().tracker .add_liquid (liquid = liquid , volume = vol )
1737
1742
1738
- dispense = MultiHeadDispenseContainr (
1743
+ dispense = MultiHeadDispenseContainer (
1739
1744
container = resource ,
1740
1745
volume = volume ,
1741
1746
offset = offset ,
@@ -1745,24 +1750,26 @@ async def dispense96(
1745
1750
blow_out_air_volume = blow_out_air_volume ,
1746
1751
liquids = cast (List [List [Tuple [Optional [Liquid ], float ]]], all_liquids ), # stupid
1747
1752
)
1753
+
1754
+ containers = [resource ]
1748
1755
else :
1749
1756
if isinstance (resource , Plate ):
1750
1757
if resource .has_lid ():
1751
1758
raise ValueError ("Aspirating from plate with lid" )
1752
- wells = resource .get_all_items ()
1753
- else :
1754
- wells = resource
1759
+ containers = resource .get_all_items ()
1760
+ else : # List[Well]
1761
+ containers = resource
1755
1762
1756
1763
# ensure that wells are all in the same plate
1757
- plate = wells [0 ].parent
1758
- for well in wells :
1764
+ plate = containers [0 ].parent
1765
+ for well in containers :
1759
1766
if well .parent != plate :
1760
1767
raise ValueError ("All wells must be in the same plate" )
1761
1768
1762
- if not len (wells ) == 96 :
1763
- raise ValueError (f"dispense96 expects 96 wells, got { len (wells )} " )
1769
+ if not len (containers ) == 96 :
1770
+ raise ValueError (f"dispense96 expects 96 wells, got { len (containers )} " )
1764
1771
1765
- for channel , well in zip (self .head96 .values (), wells ):
1772
+ for channel , well in zip (self .head96 .values (), containers ):
1766
1773
# even if the volume tracker is disabled, a liquid (None, volume) is added to the list
1767
1774
# during the aspiration command
1768
1775
liquids = channel .get_tip ().tracker .remove_liquid (volume = volume )
@@ -1773,7 +1780,7 @@ async def dispense96(
1773
1780
well .tracker .add_liquid (liquid = liquid , volume = vol )
1774
1781
1775
1782
dispense = MultiHeadDispensePlate (
1776
- wells = wells ,
1783
+ wells = cast ( List [ Well ], containers ) ,
1777
1784
volume = volume ,
1778
1785
offset = offset ,
1779
1786
flow_rate = flow_rate ,
@@ -1786,9 +1793,9 @@ async def dispense96(
1786
1793
try :
1787
1794
await self .backend .dispense96 (dispense = dispense , ** backend_kwargs )
1788
1795
except Exception as error :
1789
- for channel , well in zip (self .head96 .values (), wells ):
1796
+ for channel , container in zip (self .head96 .values (), containers ):
1790
1797
if does_volume_tracking () and not well .tracker .is_disabled :
1791
- well .tracker .rollback ()
1798
+ container .tracker .rollback ()
1792
1799
channel .get_tip ().tracker .rollback ()
1793
1800
1794
1801
self ._trigger_callback (
@@ -1799,9 +1806,9 @@ async def dispense96(
1799
1806
** backend_kwargs ,
1800
1807
)
1801
1808
else :
1802
- for channel , well in zip (self .head96 .values (), wells ):
1809
+ for channel , container in zip (self .head96 .values (), containers ):
1803
1810
if does_volume_tracking () and not well .tracker .is_disabled :
1804
- well .tracker .commit ()
1811
+ container .tracker .commit ()
1805
1812
channel .get_tip ().tracker .commit ()
1806
1813
1807
1814
self ._trigger_callback (
0 commit comments