Skip to content

Commit bdbbed0

Browse files
author
David Erb
committed
use crystal plate object to get well count
1 parent bfb8e79 commit bdbbed0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/rockingester_lib/collectors/direct_poll.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# Crystal well pydantic model.
2222
from xchembku_api.models.crystal_well_model import CrystalWellModel
2323

24+
# Crystal plate objects factory.
25+
from xchembku_lib.crystal_plate_objects.crystal_plate_objects import CrystalPlateObjects
26+
2427
# Base class for collector instances.
2528
from rockingester_lib.collectors.base import Base as CollectorBase
2629

@@ -289,8 +292,13 @@ async def scrape_plate_directory_when_complete(
289292
entry.name for entry in os.scandir(plate_directory) if entry.is_file()
290293
]
291294

295+
# Make an object corresponding to the crystal plate model's type.
296+
crystal_plate_object = CrystalPlateObjects().build_object(
297+
{"type": crystal_plate_model.thing_type}
298+
)
299+
292300
# Don't handle the plate directory until all images have arrived.
293-
if len(well_names) < 288:
301+
if len(well_names) < crystal_plate_object.get_well_count():
294302
return
295303

296304
# Sort wells by name so that tests are deterministic.

tests/test_collector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
from dls_utilpack.visit import get_xchem_subdirectory
77

8+
# Types which the CrystalPlateObjects factory can use to build an instance.
9+
from xchembku_api.crystal_plate_objects.constants import (
10+
ThingTypes as CrystalPlateObjectThingTypes,
11+
)
12+
813
# Things xchembku provides.
914
from xchembku_api.datafaces.context import Context as XchembkuDatafaceClientContext
1015
from xchembku_api.datafaces.datafaces import xchembku_datafaces_get_default
@@ -141,6 +146,7 @@ async def __run_part1(self, scrapable_image_count, constants, output_directory):
141146
formulatrix__plate__id=10,
142147
barcode="98ab",
143148
visit=visit,
149+
thing_type=CrystalPlateObjectThingTypes.SWISS3,
144150
)
145151
)
146152

0 commit comments

Comments
 (0)