-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
add absorbance reader command to protocol engine 1
1 parent
a96add8
commit ced2175
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
api/src/opentrons/protocol_engine/commands/absorbance_reader/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Command models for Absorbance Reader commands.""" |
68 changes: 68 additions & 0 deletions
68
api/src/opentrons/protocol_engine/commands/absorbance_reader/run_profile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"""Command models to execute a Thermocycler profile.""" | ||
from __future__ import annotations | ||
from typing import List, Optional, TYPE_CHECKING | ||
from typing_extensions import Literal, Type | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from opentrons.hardware_control.modules.types import ThermocyclerStep | ||
|
||
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate | ||
|
||
if TYPE_CHECKING: | ||
from opentrons.protocol_engine.state import StateView | ||
from opentrons.protocol_engine.execution import EquipmentHandler | ||
|
||
|
||
RunProfileCommandType = Literal["thermocycler/runProfile"] | ||
|
||
|
||
class AbsorbanceReadParams(BaseModel): | ||
"""Input parameters for a single absorbance reading.""" | ||
|
||
moduleId: str = Field(..., description="Unique ID of the Thermocycler.") | ||
sampleWavelength: float = Field(..., description="Sample wavelength in nm.") | ||
|
||
|
||
class AbsorbanceReadResult(BaseModel): | ||
"""Result data from running an aborbance reading.""" | ||
|
||
data: List[float] = Field(..., description="Absorbance data points.") | ||
|
||
|
||
class AbsorbanceReadImpl(AbstractCommandImpl[AbsorbanceReadParams, AbsorbanceReadResult]): | ||
"""Execution implementation of a Thermocycler's run profile command.""" | ||
|
||
def __init__( | ||
self, | ||
state_view: StateView, | ||
equipment: EquipmentHandler, | ||
**unused_dependencies: object, | ||
) -> None: | ||
self._state_view = state_view | ||
self._equipment = equipment | ||
|
||
async def execute(self, params: AbsorbanceReadParams) -> AbsorbanceReadResult: | ||
"""Initiate a single absorbance measurement.""" | ||
# TODO: Implement this | ||
return AbsorbanceReadResult(data=[]) | ||
|
||
|
||
class AbsorbanceRead(BaseCommand[AbsorbanceReadParams, AbsorbanceReadResult]): | ||
"""A command to execute a Thermocycler profile run.""" | ||
|
||
# TODO: fix this | ||
commandType: AbsorbanceReadCommandType = "absorbanceReader/measure" | ||
params: AbsorbanceReadParams | ||
result: Optional[AbsorbanceReadResult] | ||
|
||
_ImplementationCls: Type[AbsorbanceReadImpl] = AbsorbanceReadImpl | ||
|
||
|
||
class RunProfileCreate(BaseCommandCreate[AbsorbanceReadParams]): | ||
"""A request to execute a Thermocycler profile run.""" | ||
|
||
commandType: AbsorbanceReadCommandType = "absorbanceReader/measure" | ||
params: AbsorbanceReadParams | ||
|
||
_CommandCls: Type[AbsorbanceRead] = AbsorbanceRead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
api/src/opentrons/protocol_engine/state/module_substates/absorbance_reader_substate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Heater-Shaker Module sub-state.""" | ||
from dataclasses import dataclass | ||
from typing import NewType, List | ||
|
||
from opentrons.protocol_engine.types import ( | ||
TemperatureRange, | ||
SpeedRange, | ||
HeaterShakerLatchStatus, | ||
) | ||
|
||
AbsorbanceReaderId = NewType("AbsorbanceReaderId", str) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class AbsorbanceReaderSubState: | ||
"""Absorbance-Plate-Reader-specific state.""" | ||
|
||
module_id: AbsorbanceReaderId | ||
is_lid_open: bool | ||
is_loaded: bool | ||
sample_wavelength: int | ||
supported_wavelengths: List[int] |