Skip to content

Commit

Permalink
feat(api, shared-data): add correctionByVolume to liquid class schema…
Browse files Browse the repository at this point in the history
… and definitions (#16972)

Adds a correctionByVolume field to liquid class definitions in the schema, pydantic models and PAPI classes for liquid class properties.
  • Loading branch information
jbleon95 authored Dec 2, 2024
1 parent 5009d3c commit 4c7a409
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/src/opentrons/protocol_api/_liquid_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class BaseLiquidHandlingProperties:
_position_reference: PositionReference
_offset: Coordinate
_flow_rate_by_volume: LiquidHandlingPropertyByVolume
_correction_by_volume: LiquidHandlingPropertyByVolume
_delay: DelayProperties

@property
Expand Down Expand Up @@ -341,6 +342,10 @@ def offset(self, new_offset: Sequence[float]) -> None:
def flow_rate_by_volume(self) -> LiquidHandlingPropertyByVolume:
return self._flow_rate_by_volume

@property
def correction_by_volume(self) -> LiquidHandlingPropertyByVolume:
return self._correction_by_volume

@property
def delay(self) -> DelayProperties:
return self._delay
Expand Down Expand Up @@ -543,6 +548,9 @@ def build_aspirate_properties(
_flow_rate_by_volume=LiquidHandlingPropertyByVolume(
aspirate_properties.flowRateByVolume
),
_correction_by_volume=LiquidHandlingPropertyByVolume(
aspirate_properties.correctionByVolume
),
_pre_wet=aspirate_properties.preWet,
_mix=_build_mix_properties(aspirate_properties.mix),
_delay=_build_delay_properties(aspirate_properties.delay),
Expand All @@ -560,6 +568,9 @@ def build_single_dispense_properties(
_flow_rate_by_volume=LiquidHandlingPropertyByVolume(
single_dispense_properties.flowRateByVolume
),
_correction_by_volume=LiquidHandlingPropertyByVolume(
single_dispense_properties.correctionByVolume
),
_mix=_build_mix_properties(single_dispense_properties.mix),
_push_out_by_volume=LiquidHandlingPropertyByVolume(
single_dispense_properties.pushOutByVolume
Expand All @@ -581,6 +592,9 @@ def build_multi_dispense_properties(
_flow_rate_by_volume=LiquidHandlingPropertyByVolume(
multi_dispense_properties.flowRateByVolume
),
_correction_by_volume=LiquidHandlingPropertyByVolume(
multi_dispense_properties.correctionByVolume
),
_conditioning_by_volume=LiquidHandlingPropertyByVolume(
multi_dispense_properties.conditioningByVolume
),
Expand Down
2 changes: 2 additions & 0 deletions api/tests/opentrons/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,7 @@ def minimal_liquid_class_def2() -> LiquidClassSchemaV1:
positionReference=PositionReference.WELL_BOTTOM,
offset=Coordinate(x=0, y=0, z=-5),
flowRateByVolume=[(10.0, 40.0), (20.0, 30.0)],
correctionByVolume=[(15.0, 1.5), (30.0, -5.0)],
preWet=True,
mix=MixProperties(enable=False),
delay=DelayProperties(
Expand All @@ -853,6 +854,7 @@ def minimal_liquid_class_def2() -> LiquidClassSchemaV1:
positionReference=PositionReference.WELL_BOTTOM,
offset=Coordinate(x=0, y=0, z=-5),
flowRateByVolume=[(10.0, 40.0), (20.0, 30.0)],
correctionByVolume=[(15.0, -1.5), (30.0, 5.0)],
mix=MixProperties(enable=False),
pushOutByVolume=[(10.0, 7.0), (20.0, 10.0)],
delay=DelayProperties(enable=False),
Expand Down
12 changes: 12 additions & 0 deletions api/tests/opentrons/protocol_api/test_liquid_class_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def test_build_aspirate_settings() -> None:
assert aspirate_properties.position_reference.value == "well-bottom"
assert aspirate_properties.offset == Coordinate(x=0, y=0, z=-5)
assert aspirate_properties.flow_rate_by_volume.as_dict() == {10: 50.0}
assert aspirate_properties.correction_by_volume.as_dict() == {
1.0: -2.5,
10.0: 3,
}
assert aspirate_properties.pre_wet is True
assert aspirate_properties.mix.enabled is True
assert aspirate_properties.mix.repetitions == 3
Expand Down Expand Up @@ -94,6 +98,10 @@ def test_build_single_dispense_settings() -> None:
10.0: 40.0,
20.0: 30.0,
}
assert single_dispense_properties.correction_by_volume.as_dict() == {
2.0: -1.5,
20.0: 2,
}
assert single_dispense_properties.mix.enabled is True
assert single_dispense_properties.mix.repetitions == 3
assert single_dispense_properties.mix.volume == 15
Expand Down Expand Up @@ -146,6 +154,10 @@ def test_build_multi_dispense_settings() -> None:
10.0: 40.0,
20.0: 30.0,
}
assert multi_dispense_properties.correction_by_volume.as_dict() == {
3.0: -0.5,
30.0: 1,
}
assert multi_dispense_properties.conditioning_by_volume.as_dict() == {
5.0: 5.0,
}
Expand Down
105 changes: 105 additions & 0 deletions shared-data/command/schemas/11.json
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,40 @@
]
}
},
"correctionByVolume": {
"title": "Correctionbyvolume",
"description": "Settings for volume correction keyed by by target aspiration volume, representing additional volume the plunger should move to accurately hit target volume.",
"type": "array",
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "number",
"minimum": 0.0
}
]
},
{
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
}
]
}
},
"preWet": {
"title": "Prewet",
"description": "Whether to perform a pre-wet action.",
Expand Down Expand Up @@ -2163,6 +2197,7 @@
"positionReference",
"offset",
"flowRateByVolume",
"correctionByVolume",
"preWet",
"mix",
"delay"
Expand Down Expand Up @@ -2411,6 +2446,40 @@
]
}
},
"correctionByVolume": {
"title": "Correctionbyvolume",
"description": "Settings for volume correction keyed by by target dispense volume, representing additional volume the plunger should move to accurately hit target volume.",
"type": "array",
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "number",
"minimum": 0.0
}
]
},
{
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
}
]
}
},
"mix": {
"title": "Mix",
"description": "Mixing settings for after a dispense",
Expand Down Expand Up @@ -2472,6 +2541,7 @@
"positionReference",
"offset",
"flowRateByVolume",
"correctionByVolume",
"mix",
"pushOutByVolume",
"delay"
Expand Down Expand Up @@ -2553,6 +2623,40 @@
]
}
},
"correctionByVolume": {
"title": "Correctionbyvolume",
"description": "Settings for volume correction keyed by by target dispense volume, representing additional volume the plunger should move to accurately hit target volume.",
"type": "array",
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "number",
"minimum": 0.0
}
]
},
{
"anyOf": [
{
"type": "integer"
},
{
"type": "number"
}
]
}
]
}
},
"conditioningByVolume": {
"title": "Conditioningbyvolume",
"description": "Settings for conditioning volume keyed by target dispense volume.",
Expand Down Expand Up @@ -2641,6 +2745,7 @@
"positionReference",
"offset",
"flowRateByVolume",
"correctionByVolume",
"conditioningByVolume",
"disposalByVolume",
"delay"
Expand Down
Loading

0 comments on commit 4c7a409

Please sign in to comment.