Skip to content

Commit

Permalink
default the filename arg of absorbance read command to None
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Oct 24, 2024
1 parent 39fb23c commit ddc24cb
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_api/core/engine/module_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def initialize(
)
self._initialized_value = wavelengths

def read(self, filename: Optional[str]) -> Dict[int, Dict[str, float]]:
def read(self, filename: Optional[str] = None) -> Dict[int, Dict[str, float]]:
"""Initiate a read on the Absorbance Reader, and return the results. During Analysis, this will return a measurement of zero for all wells."""
wavelengths = self._engine_client.state.modules.get_absorbance_reader_substate(
self.module_id
Expand Down
35 changes: 20 additions & 15 deletions api/src/opentrons/protocol_api/core/engine/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,10 @@ def load_module(

# When the protocol engine is created, we add Module Lids as part of the deck fixed labware
# If a valid module exists in the deck config. For analysis, we add the labware here since
# deck fixed labware is not created under the same conditions.
if self._engine_client.state.config.use_virtual_modules:
self._load_virtual_module_lid(module_core)
# deck fixed labware is not created under the same conditions. We also need to inject the Module
# lids when the module isnt already on the deck config, like when adding a new
# module during a protocol setup.
self._load_virtual_module_lid(module_core)

self._module_cores_by_id[module_core.module_id] = module_core

Expand All @@ -461,20 +462,24 @@ def _load_virtual_module_lid(
self, module_core: Union[ModuleCore, NonConnectedModuleCore]
) -> None:
if isinstance(module_core, AbsorbanceReaderCore):
lid = self._engine_client.execute_command_without_recovery(
cmd.LoadLabwareParams(
loadName="opentrons_flex_lid_absorbance_plate_reader_module",
location=ModuleLocation(moduleId=module_core.module_id),
namespace="opentrons",
version=1,
displayName="Absorbance Reader Lid",
)
substate = self._engine_client.state.modules.get_absorbance_reader_substate(
module_core.module_id
)
if substate.lid_id is None:
lid = self._engine_client.execute_command_without_recovery(
cmd.LoadLabwareParams(
loadName="opentrons_flex_lid_absorbance_plate_reader_module",
location=ModuleLocation(moduleId=module_core.module_id),
namespace="opentrons",
version=1,
displayName="Absorbance Reader Lid",
)
)

self._engine_client.add_absorbance_reader_lid(
module_id=module_core.module_id,
lid_id=lid.labwareId,
)
self._engine_client.add_absorbance_reader_lid(
module_id=module_core.module_id,
lid_id=lid.labwareId,
)

def _create_non_connected_module_core(
self, load_module_result: LoadModuleResult
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_api/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def initialize(
"""Initialize the Absorbance Reader by taking zero reading."""

@abstractmethod
def read(self, filename: Optional[str]) -> Dict[int, Dict[str, float]]:
def read(self, filename: Optional[str] = None) -> Dict[int, Dict[str, float]]:
"""Get an absorbance reading from the Absorbance Reader."""

@abstractmethod
Expand Down
4 changes: 3 additions & 1 deletion api/src/opentrons/protocol_api/module_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,9 @@ def initialize(
)

@requires_version(2, 21)
def read(self, export_filename: Optional[str]) -> Dict[int, Dict[str, float]]:
def read(
self, export_filename: Optional[str] = None
) -> Dict[int, Dict[str, float]]:
"""Initiate read on the Absorbance Reader.
Returns a dictionary of wavelengths to dictionary of values ordered by well name.
Expand Down
4 changes: 3 additions & 1 deletion robot-server/robot_server/runs/router/base_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ async def get_run_commands_error(
status.HTTP_409_CONFLICT: {"model": ErrorBody[RunStopped]},
},
)
async def get_current_state(
async def get_current_state( # noqa: C901
runId: str,
run_data_manager: Annotated[RunDataManager, Depends(get_run_data_manager)],
hardware: Annotated[HardwareControlAPI, Depends(get_hardware)],
Expand All @@ -586,6 +586,8 @@ async def get_current_state(
Arguments:
runId: Run ID pulled from URL.
run_data_manager: Run data retrieval interface.
hardware: Hardware control interface.
robot_type: The type of robot.
"""
try:
run = run_data_manager.get(run_id=runId)
Expand Down
17 changes: 8 additions & 9 deletions robot-server/tests/runs/router/test_base_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
from robot_server.runs.run_models import RunNotFoundError
from robot_server.runs.router.base_router import (
AllRunsLinks,
PlaceLabwareState,
create_run,
get_run_data_from_url,
get_run,
Expand Down Expand Up @@ -885,17 +884,17 @@ async def test_get_current_state_success(
mock_nozzle_maps
)
command_pointer = CommandPointer(
command_id="command-id",
command_key="command-key",
created_at=datetime(year=2024, month=4, day=4),
index=101,
)
command_id="command-id",
command_key="command-key",
created_at=datetime(year=2024, month=4, day=4),
index=101,
)
decoy.when(
mock_run_data_manager.get_last_completed_command(run_id=run_id)
).then_return(command_pointer)
decoy.when(
mock_run_data_manager.get_current_command(run_id=run_id)
).then_return(command_pointer)
decoy.when(mock_run_data_manager.get_current_command(run_id=run_id)).then_return(
command_pointer
)

result = await get_current_state(
runId=run_id,
Expand Down

0 comments on commit ddc24cb

Please sign in to comment.