Skip to content

Commit e2b8fbd

Browse files
authored
fix(step-generation): fix correction volume curve passing (#19065)
Rather than interpolating a single point and passing that as a custom liquid class property, we should pass the entire correctionByVolume array from the liquid class's definition (for aspirate, singleDispense, and multiDispense)
1 parent 1db9035 commit e2b8fbd

File tree

9 files changed

+115
-78
lines changed

9 files changed

+115
-78
lines changed

app/src/organisms/ODD/QuickTransferFlow/__tests__/utils/quickTransferStepCommands.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ pipette.transfer_with_liquid_class(
243243
"position_reference": "well-bottom",
244244
},
245245
"flow_rate_by_volume": [(0, 80)],
246-
"correction_by_volume": [(0, 0)],
247246
"delay": {"enabled": False},
248247
"submerge": {
249248
"delay": {"enabled": False},
@@ -262,6 +261,7 @@ pipette.transfer_with_liquid_class(
262261
"touch_tip": {"enabled": False},
263262
"blowout": {"enabled": True, "location": "source", "flow_rate": 50},
264263
},
264+
"correction_by_volume": [(0, 0)],
265265
"push_out_by_volume": [(0, 0)],
266266
"mix": {"enabled": False},
267267
},
@@ -396,7 +396,6 @@ pipette.consolidate_with_liquid_class(
396396
"position_reference": "well-bottom",
397397
},
398398
"flow_rate_by_volume": [(0, 80)],
399-
"correction_by_volume": [(0, 0)],
400399
"delay": {"enabled": False},
401400
"submerge": {
402401
"delay": {"enabled": False},
@@ -415,6 +414,7 @@ pipette.consolidate_with_liquid_class(
415414
"touch_tip": {"enabled": False},
416415
"blowout": {"enabled": True, "location": "trash", "flow_rate": 50},
417416
},
417+
"correction_by_volume": [(0, 0)],
418418
"push_out_by_volume": [(0, 0)],
419419
"mix": {"enabled": False},
420420
},
@@ -550,7 +550,6 @@ pipette.distribute_with_liquid_class(
550550
"position_reference": "well-bottom",
551551
},
552552
"flow_rate_by_volume": [(0, 80)],
553-
"correction_by_volume": [(0, 0)],
554553
"delay": {"enabled": False},
555554
"submerge": {
556555
"delay": {"enabled": False},
@@ -569,6 +568,7 @@ pipette.distribute_with_liquid_class(
569568
"touch_tip": {"enabled": False},
570569
"blowout": {"enabled": True, "location": "source", "flow_rate": 50},
571570
},
571+
"correction_by_volume": [(0, 0)],
572572
"push_out_by_volume": [(0, 0)],
573573
"mix": {"enabled": False},
574574
},
@@ -578,7 +578,6 @@ pipette.distribute_with_liquid_class(
578578
"position_reference": "well-bottom",
579579
},
580580
"flow_rate_by_volume": [(0, 80)],
581-
"correction_by_volume": [(0, 0)],
582581
"delay": {"enabled": False},
583582
"submerge": {
584583
"delay": {"enabled": False},
@@ -597,6 +596,7 @@ pipette.distribute_with_liquid_class(
597596
"touch_tip": {"enabled": False},
598597
"blowout": {"enabled": True, "location": "source", "flow_rate": 50},
599598
},
599+
"correction_by_volume": [(0, 0)],
600600
"conditioning_by_volume": [(0, 0)],
601601
"disposal_by_volume": [(0, 0)],
602602
},

step-generation/src/__tests__/consolidate.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ mock_pipette.consolidate_with_liquid_class(
153153
"dispense": {
154154
"dispense_position": {"offset": {"x": 0, "y": 0}},
155155
"flow_rate_by_volume": [(0, 2.2)],
156-
"correction_by_volume": [(0, 0)],
157156
"delay": {"enabled": False},
158157
"submerge": {
159158
"delay": {"enabled": False},
@@ -166,6 +165,7 @@ mock_pipette.consolidate_with_liquid_class(
166165
"touch_tip": {"enabled": False},
167166
"blowout": {"enabled": False},
168167
},
168+
"correction_by_volume": [(0, 0)],
169169
"push_out_by_volume": [(0, 0)],
170170
"mix": {"enabled": False},
171171
},
@@ -246,7 +246,6 @@ mock_pipette.consolidate_with_liquid_class(
246246
"dispense": {
247247
"dispense_position": {"offset": {"x": 0, "y": 0}},
248248
"flow_rate_by_volume": [(0, 2.2)],
249-
"correction_by_volume": [(0, 0)],
250249
"delay": {"enabled": True, "duration": 12},
251250
"submerge": {
252251
"delay": {"enabled": False},
@@ -259,6 +258,7 @@ mock_pipette.consolidate_with_liquid_class(
259258
"touch_tip": {"enabled": True, "z_offset": -3.4},
260259
"blowout": {"enabled": True, "location": "destination", "flow_rate": 2.3},
261260
},
261+
"correction_by_volume": [(0, 0)],
262262
"push_out_by_volume": [(0, 0)],
263263
"mix": {"enabled": True, "repetitions": 1, "volume": 36},
264264
},
@@ -313,7 +313,6 @@ mock_pipette.consolidate_with_liquid_class(
313313
"dispense": {
314314
"dispense_position": {"offset": {"x": 0, "y": 0}},
315315
"flow_rate_by_volume": [(0, 2.2)],
316-
"correction_by_volume": [(0, 0)],
317316
"delay": {"enabled": False},
318317
"submerge": {
319318
"delay": {"enabled": False},
@@ -326,6 +325,7 @@ mock_pipette.consolidate_with_liquid_class(
326325
"touch_tip": {"enabled": False},
327326
"blowout": {"enabled": False},
328327
},
328+
"correction_by_volume": [(0, 0)],
329329
"push_out_by_volume": [(0, 0)],
330330
"mix": {"enabled": False},
331331
},

step-generation/src/__tests__/distribute.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ mock_pipette.distribute_with_liquid_class(
189189
"dispense": {
190190
"dispense_position": {"offset": {"x": 0, "y": 0, "z": 0}},
191191
"flow_rate_by_volume": [(0, 2.2)],
192-
"correction_by_volume": [(0, 0)],
193192
"delay": {"enabled": False},
194193
"submerge": {
195194
"delay": {"enabled": False},
@@ -202,13 +201,13 @@ mock_pipette.distribute_with_liquid_class(
202201
"touch_tip": {"enabled": False},
203202
"blowout": {"enabled": True, "location": "trash", "flow_rate": 2.3},
204203
},
204+
"correction_by_volume": [(0, 0)],
205205
"push_out_by_volume": [(0, 0)],
206206
"mix": {"enabled": False},
207207
},
208208
"multi_dispense": {
209209
"dispense_position": {"offset": {"x": 0, "y": 0, "z": 0}},
210210
"flow_rate_by_volume": [(0, 2.2)],
211-
"correction_by_volume": [(0, 0)],
212211
"delay": {"enabled": False},
213212
"submerge": {
214213
"delay": {"enabled": False},
@@ -221,6 +220,7 @@ mock_pipette.distribute_with_liquid_class(
221220
"touch_tip": {"enabled": False},
222221
"blowout": {"enabled": True, "location": "trash", "flow_rate": 2.3},
223222
},
223+
"correction_by_volume": [(0, 0)],
224224
"conditioning_by_volume": [(0, 0)],
225225
"disposal_by_volume": [(0, 60)],
226226
},
@@ -1058,7 +1058,6 @@ mock_pipette.distribute_with_liquid_class(
10581058
"dispense": {
10591059
"dispense_position": {"offset": {"x": 0, "y": 0, "z": 0}},
10601060
"flow_rate_by_volume": [(0, 2.2)],
1061-
"correction_by_volume": [(0, 0)],
10621061
"delay": {"enabled": True, "duration": 12},
10631062
"submerge": {
10641063
"delay": {"enabled": False},
@@ -1071,13 +1070,13 @@ mock_pipette.distribute_with_liquid_class(
10711070
"touch_tip": {"enabled": True, "z_offset": -3.4},
10721071
"blowout": {"enabled": True, "location": "trash", "flow_rate": 2.3},
10731072
},
1073+
"correction_by_volume": [(0, 0)],
10741074
"push_out_by_volume": [(0, 0)],
10751075
"mix": {"enabled": False},
10761076
},
10771077
"multi_dispense": {
10781078
"dispense_position": {"offset": {"x": 0, "y": 0, "z": 0}},
10791079
"flow_rate_by_volume": [(0, 2.2)],
1080-
"correction_by_volume": [(0, 0)],
10811080
"delay": {"enabled": True, "duration": 12},
10821081
"submerge": {
10831082
"delay": {"enabled": False},
@@ -1090,6 +1089,7 @@ mock_pipette.distribute_with_liquid_class(
10901089
"touch_tip": {"enabled": True, "z_offset": -3.4},
10911090
"blowout": {"enabled": True, "location": "trash", "flow_rate": 2.3},
10921091
},
1092+
"correction_by_volume": [(0, 0)],
10931093
"conditioning_by_volume": [(0, 10)],
10941094
"disposal_by_volume": [(0, 60)],
10951095
},

step-generation/src/__tests__/liquidClassUtils.test.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import {
1818
import { SOURCE_WELL_BLOWOUT_DESTINATION } from '../utils'
1919
import { getCustomLiquidClassProperties } from '../utils/liquidClassUtils'
2020

21-
import type { LabwareDefinition2 } from '@opentrons/shared-data'
21+
import type {
22+
ByTipTypeSetting,
23+
LabwareDefinition2,
24+
} from '@opentrons/shared-data'
2225

2326
describe('getCustomLiquidClassProperties', () => {
2427
it('returns all args populated for transfer', () => {
@@ -91,8 +94,18 @@ describe('getCustomLiquidClassProperties', () => {
9194
},
9295
pipetteName: 'p20_single_gen2',
9396
tiprackUri: 'opentrons/opentrons_96_tiprack_20ul/1',
94-
aspirateCorrectionVolume: 5,
95-
dispenseCorrectionVolume: 5,
97+
liquidClassValuesForTip: {
98+
aspirate: {
99+
correctionByVolume: [[0, 5]],
100+
},
101+
singleDispense: {
102+
correctionByVolume: [
103+
[0, 5],
104+
[100, 10],
105+
],
106+
},
107+
tiprack: 'opentrons/opentrons_96_tiprack_20ul/1',
108+
} as ByTipTypeSetting,
96109
})
97110
).toEqual(
98111
`
@@ -137,7 +150,6 @@ describe('getCustomLiquidClassProperties', () => {
137150
"position_reference": "well-bottom",
138151
},
139152
"flow_rate_by_volume": [(0, 2.2)],
140-
"correction_by_volume": [(0, 5)],
141153
"delay": {"enabled": True, "duration": 20},
142154
"submerge": {
143155
"delay": {"enabled": True, "duration": 50},
@@ -163,6 +175,7 @@ describe('getCustomLiquidClassProperties', () => {
163175
},
164176
"blowout": {"enabled": True, "location": "source", "flow_rate": 2.3},
165177
},
178+
"correction_by_volume": [(0, 5), (100, 10)],
166179
"push_out_by_volume": [(0, 0)],
167180
"mix": {"enabled": True, "repetitions": 3, "volume": 10},
168181
},
@@ -241,8 +254,23 @@ describe('getCustomLiquidClassProperties', () => {
241254
},
242255
pipetteName: 'p20_single_gen2',
243256
tiprackUri: 'opentrons/opentrons_96_tiprack_20ul/1',
244-
aspirateCorrectionVolume: 5,
245-
dispenseCorrectionVolume: 5,
257+
liquidClassValuesForTip: {
258+
aspirate: {
259+
correctionByVolume: [[0, 5]],
260+
},
261+
singleDispense: {
262+
correctionByVolume: [
263+
[0, 5],
264+
[100, 10],
265+
],
266+
},
267+
multiDispense: {
268+
correctionByVolume: [
269+
[0, 5],
270+
[200, 20],
271+
],
272+
},
273+
} as ByTipTypeSetting,
246274
})
247275
).toEqual(
248276
`
@@ -287,7 +315,6 @@ describe('getCustomLiquidClassProperties', () => {
287315
"position_reference": "well-bottom",
288316
},
289317
"flow_rate_by_volume": [(0, 2.2)],
290-
"correction_by_volume": [(0, 5)],
291318
"delay": {"enabled": True, "duration": 20},
292319
"submerge": {
293320
"delay": {"enabled": True, "duration": 50},
@@ -313,6 +340,7 @@ describe('getCustomLiquidClassProperties', () => {
313340
},
314341
"blowout": {"enabled": True, "location": "source", "flow_rate": 2.3},
315342
},
343+
"correction_by_volume": [(0, 5), (100, 10)],
316344
"push_out_by_volume": [(0, 0)],
317345
"mix": {"enabled": False},
318346
},
@@ -322,7 +350,6 @@ describe('getCustomLiquidClassProperties', () => {
322350
"position_reference": "well-bottom",
323351
},
324352
"flow_rate_by_volume": [(0, 2.2)],
325-
"correction_by_volume": [(0, 5)],
326353
"delay": {"enabled": True, "duration": 20},
327354
"submerge": {
328355
"delay": {"enabled": True, "duration": 50},
@@ -348,6 +375,7 @@ describe('getCustomLiquidClassProperties', () => {
348375
},
349376
"blowout": {"enabled": True, "location": "source", "flow_rate": 2.3},
350377
},
378+
"correction_by_volume": [(0, 5), (200, 20)],
351379
"conditioning_by_volume": [(0, 5)],
352380
"disposal_by_volume": [(0, 5)],
353381
},

step-generation/src/__tests__/transfer.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ mock_pipette.transfer_with_liquid_class(
207207
"position_reference": "well-bottom",
208208
},
209209
"flow_rate_by_volume": [(0, 12)],
210-
"correction_by_volume": [(0, 0)],
211210
"delay": {"enabled": False},
212211
"submerge": {
213212
"delay": {"enabled": False},
@@ -228,6 +227,7 @@ mock_pipette.transfer_with_liquid_class(
228227
"touch_tip": {"enabled": False},
229228
"blowout": {"enabled": False},
230229
},
230+
"correction_by_volume": [(0, 0)],
231231
"push_out_by_volume": [(0, 0)],
232232
"mix": {"enabled": False},
233233
},
@@ -398,7 +398,6 @@ mock_pipette.transfer_with_liquid_class(
398398
"position_reference": "well-bottom",
399399
},
400400
"flow_rate_by_volume": [(0, 12)],
401-
"correction_by_volume": [(0, 0)],
402401
"delay": {"enabled": False},
403402
"submerge": {
404403
"delay": {"enabled": False},
@@ -419,6 +418,7 @@ mock_pipette.transfer_with_liquid_class(
419418
"touch_tip": {"enabled": False},
420419
"blowout": {"enabled": False},
421420
},
421+
"correction_by_volume": [(0, 0)],
422422
"push_out_by_volume": [(0, 0)],
423423
"mix": {"enabled": False},
424424
},
@@ -651,7 +651,6 @@ mock_pipette.transfer_with_liquid_class(
651651
"position_reference": "well-bottom",
652652
},
653653
"flow_rate_by_volume": [(0, 12)],
654-
"correction_by_volume": [(0, 0)],
655654
"delay": {"enabled": False},
656655
"submerge": {
657656
"delay": {"enabled": False},
@@ -672,6 +671,7 @@ mock_pipette.transfer_with_liquid_class(
672671
"touch_tip": {"enabled": False},
673672
"blowout": {"enabled": False},
674673
},
674+
"correction_by_volume": [(0, 0)],
675675
"push_out_by_volume": [(0, 0)],
676676
"mix": {"enabled": False},
677677
},
@@ -5552,7 +5552,6 @@ mock_pipette.transfer_with_liquid_class(
55525552
"position_reference": "well-bottom",
55535553
},
55545554
"flow_rate_by_volume": [(0, 12)],
5555-
"correction_by_volume": [(0, 0)],
55565555
"delay": {"enabled": True, "duration": 12},
55575556
"submerge": {
55585557
"delay": {"enabled": False},
@@ -5573,6 +5572,7 @@ mock_pipette.transfer_with_liquid_class(
55735572
"touch_tip": {"enabled": True, "z_offset": -3.4},
55745573
"blowout": {"enabled": True, "location": "trash", "flow_rate": 2.3},
55755574
},
5575+
"correction_by_volume": [(0, 0)],
55765576
"push_out_by_volume": [(0, 0)],
55775577
"mix": {"enabled": True, "repetitions": 1, "volume": 36},
55785578
},

step-generation/src/commandCreators/compound/consolidate.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,17 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
219219
name: pipetteName,
220220
pythonName: pythonPipetteName,
221221
} = pipetteEntities[pipette]
222-
const liquidClassValuesForTip = getAllLiquidClassDefs()
223-
[
224-
liquidClass === NONE_LIQUID_CLASS_NAME || liquidClass == null
225-
? WATER_LIQUID_CLASS_NAME
226-
: liquidClass
227-
].byPipette?.find(
228-
({ pipetteModel }) => (pipetteModel = getFlexNameConversion(pipetteSpecs))
229-
)
230-
?.byTipType.find(({ tiprack }) => tiprack === tiprackDefUri)
222+
const liquidClassValuesForTip =
223+
getAllLiquidClassDefs()
224+
[
225+
liquidClass === NONE_LIQUID_CLASS_NAME || liquidClass == null
226+
? WATER_LIQUID_CLASS_NAME
227+
: liquidClass
228+
].byPipette?.find(
229+
({ pipetteModel }) =>
230+
pipetteModel === getFlexNameConversion(pipetteSpecs)
231+
)
232+
?.byTipType.find(({ tiprack }) => tiprack === tiprackDefUri) ?? null
231233
const { aspirate } = liquidClassValuesForTip ?? {}
232234
const { multiWellHandling } = getTransferPlanAndReferenceVolumes({
233235
pipetteSpecs,
@@ -323,16 +325,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
323325
byVolumeProperty: 'correctionByVolume',
324326
defaultValue: 0,
325327
}) ?? 0
326-
const dispenseCorrectionForTotalDispense =
327-
getByVolumeValue({
328-
liquidClass,
329-
pipetteSpecs,
330-
tiprackDefUri: tipRack,
331-
targetVolume: volume,
332-
liquidHandlingAction: 'singleDispense',
333-
byVolumeProperty: 'correctionByVolume',
334-
defaultValue: 0,
335-
}) ?? 0
328+
336329
/** needed for python generation! > */
337330
const destTrashPipetteName =
338331
trashBinEntities[destLabware]?.pythonName ??
@@ -361,8 +354,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
361354
? getFlexNameConversion(pipetteSpecs)
362355
: pipetteName,
363356
tiprackUri: tipRack,
364-
aspirateCorrectionVolume: aspirateCorrectionVolumeForSampleAspiration,
365-
dispenseCorrectionVolume: dispenseCorrectionForTotalDispense,
357+
liquidClassValuesForTip,
366358
})}`,
367359
]
368360
const customLiquidClass = `${PROTOCOL_CONTEXT_NAME}.define_liquid_class(\n${indentPyLines(

0 commit comments

Comments
 (0)