Skip to content

Commit 18a8743

Browse files
author
David Erb
committed
swap echo_coordinate for confirmed_microns
1 parent 1027f1e commit 18a8743

File tree

4 files changed

+20
-76
lines changed

4 files changed

+20
-76
lines changed

src/echolocator_lib/composers/html.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def compose_image_list(self, models: List[CrystalWellNeedingDroplocationModel]):
5454
{"text": "well centroid x,y", "class": "T_well_centroid_x_y"},
5555
{"text": "auto x,y", "class": "T_auto_target_x_y"},
5656
{"text": "confirmed x,y", "class": "T_confirmed_target_x_y"},
57-
{"text": "echo coordinate x,y", "class": "T_echo_coordinate_x_y"},
57+
{"text": "echo coordinate x,y", "class": "T_confirmed_microns_x_y"},
5858
{"text": "use", "class": "T_is_usable"},
5959
{"text": "error", "class": "T_error"},
6060
]
@@ -146,11 +146,11 @@ def compose_image_list(self, models: List[CrystalWellNeedingDroplocationModel]):
146146
t = f"{model.confirmed_target_x}, {model.confirmed_target_y}"
147147
html_lines.append("<td class='T_confirmed_target_x_y'>" + t + "</td>")
148148

149-
if model.echo_coordinate_x is None or model.echo_coordinate_y is None:
149+
if model.confirmed_microns_x is None or model.confirmed_microns_y is None:
150150
t = "-"
151151
else:
152-
t = f"{model.echo_coordinate_x}, {model.echo_coordinate_y}"
153-
html_lines.append("<td class='T_echo_coordinate_x_y'>" + t + "</td>")
152+
t = f"{model.confirmed_microns_x}, {model.confirmed_microns_y}"
153+
html_lines.append("<td class='T_confirmed_microns_x_y'>" + t + "</td>")
154154

155155
t = model.is_usable
156156
if t is None:

src/echolocator_lib/guis/aiohttp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ async def _export(self, opaque, request_dict):
479479
for m in crystal_well_models:
480480
row = []
481481
row.append(m.position)
482-
row.append(m.echo_coordinate_x or "")
483-
row.append(m.echo_coordinate_y or "")
482+
row.append(m.confirmed_microns_x or "")
483+
row.append(m.confirmed_microns_y or "")
484484
writer.writerow(row)
485485

486486
response = {
@@ -494,8 +494,8 @@ async def _export(self, opaque, request_dict):
494494
LabVisit=visit,
495495
CrystalPlate=crystal_plate_model.rockminer_collected_stem,
496496
CrystalWell=m.position,
497-
EchoX=m.echo_coordinate_x,
498-
EchoY=m.echo_coordinate_y,
497+
EchoX=m.confirmed_microns_x,
498+
EchoY=m.confirmed_microns_y,
499499
)
500500
)
501501

tests/base.py

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

99
# Configurator.
1010
from dls_multiconf_lib.multiconfs import Multiconfs, multiconfs_set_default
11+
12+
# Types which the CrystalPlateObjects factory can use to build an instance.
13+
from xchembku_api.crystal_plate_objects.constants import (
14+
ThingTypes as CrystalPlateObjectThingTypes,
15+
)
1116
from xchembku_api.models.crystal_plate_model import CrystalPlateModel
1217
from xchembku_api.models.crystal_well_autolocation_model import (
1318
CrystalWellAutolocationModel,
@@ -100,6 +105,7 @@ async def inject_plate(self, xchembku):
100105
barcode=self.barcode,
101106
rockminer_collected_stem=self.rockminer_collected_stem,
102107
visit=self.visit,
108+
thing_type=CrystalPlateObjectThingTypes.SWISS3,
103109
)
104110

105111
await xchembku.upsert_crystal_plates([crystal_plate_model])

tests/test_fetch_images.py

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
# Things xchembku provides.
1414
from xchembku_api.datafaces.context import Context as XchembkuDatafaceClientContext
1515
from xchembku_api.datafaces.datafaces import xchembku_datafaces_get_default
16-
from xchembku_api.models.crystal_plate_model import CrystalPlateModel
17-
from xchembku_api.models.crystal_well_autolocation_model import (
18-
CrystalWellAutolocationModel,
19-
)
20-
from xchembku_api.models.crystal_well_droplocation_model import (
21-
CrystalWellDroplocationModel,
22-
)
23-
from xchembku_api.models.crystal_well_model import CrystalWellModel
2416

2517
# Client context creator.
2618
from echolocator_api.guis.context import Context as GuiClientContext
@@ -108,26 +100,15 @@ async def __run_part1(self, constants, output_directory):
108100

109101
await self.__request_initial()
110102

111-
# Make the plate on which the wells reside.
112-
visit = "cm00001-1"
113-
crystal_plate_model = CrystalPlateModel(
114-
formulatrix__plate__id=10,
115-
barcode="98ab",
116-
visit=visit,
117-
)
118-
119-
await xchembku.upsert_crystal_plates([crystal_plate_model])
120-
self.__crystal_plate_uuid = crystal_plate_model.uuid
121-
122103
crystal_wells = []
123104

124105
# Inject some wells.
125-
crystal_wells.append(await self.__inject(xchembku, False, False))
126-
crystal_wells.append(await self.__inject(xchembku, True, True))
127-
crystal_wells.append(await self.__inject(xchembku, True, False))
128-
crystal_wells.append(await self.__inject(xchembku, True, True))
129-
crystal_wells.append(await self.__inject(xchembku, True, True))
130-
crystal_wells.append(await self.__inject(xchembku, True, False))
106+
crystal_wells.append(await self.inject(xchembku, False, False))
107+
crystal_wells.append(await self.inject(xchembku, True, True))
108+
crystal_wells.append(await self.inject(xchembku, True, False))
109+
crystal_wells.append(await self.inject(xchembku, True, True))
110+
crystal_wells.append(await self.inject(xchembku, True, True))
111+
crystal_wells.append(await self.inject(xchembku, True, False))
131112

132113
await self.__request_all(crystal_wells)
133114

@@ -200,46 +181,3 @@ async def __request_all(self, crystal_wells):
200181
columns = row.find_all(class_="T_filename")
201182
assert len(columns) == 1
202183
assert columns[0].get_text() == Path(crystal_wells[5].filename).stem
203-
204-
# ----------------------------------------------------------------------------------------
205-
206-
async def __inject(self, xchembku, autolocation: bool, droplocation: bool):
207-
""" """
208-
if not hasattr(self, "injected_count"):
209-
self.injected_count = 0
210-
211-
filename = "/tmp/aaaa_%03d_1.jpg" % (self.injected_count)
212-
213-
# Write well record.
214-
m = CrystalWellModel(
215-
position="01A_1",
216-
filename=filename,
217-
crystal_plate_uuid=self.__crystal_plate_uuid,
218-
)
219-
220-
await xchembku.upsert_crystal_wells([m])
221-
222-
if autolocation:
223-
# Add a crystal well autolocation.
224-
t = CrystalWellAutolocationModel(
225-
crystal_well_uuid=m.uuid,
226-
number_of_crystals=self.injected_count,
227-
auto_target_x=self.injected_count * 10 + 1,
228-
auto_target_y=self.injected_count * 10 + 2,
229-
)
230-
231-
await xchembku.originate_crystal_well_autolocations([t])
232-
233-
if droplocation:
234-
# Add a crystal well droplocation.
235-
t = CrystalWellDroplocationModel(
236-
crystal_well_uuid=m.uuid,
237-
confirmed_target_x=self.injected_count * 10 + 3,
238-
confirmed_target_y=self.injected_count * 10 + 4,
239-
)
240-
241-
await xchembku.originate_crystal_well_droplocations([t])
242-
243-
self.injected_count += 1
244-
245-
return m

0 commit comments

Comments
 (0)