|
1 | 1 | import logging |
2 | 2 | from pathlib import Path |
3 | | -from typing import Dict, NamedTuple, Optional |
| 3 | +from typing import Dict, Optional |
4 | 4 |
|
5 | 5 | import requests |
6 | 6 | import xmltodict |
7 | 7 |
|
8 | 8 | from murfey.client.context import Context |
9 | | -from murfey.client.contexts.spa import _get_grid_square_atlas_positions, _get_source |
| 9 | +from murfey.client.contexts.spa import ( |
| 10 | + FoilHole, |
| 11 | + _get_grid_square_atlas_positions, |
| 12 | + _get_source, |
| 13 | +) |
10 | 14 | from murfey.client.instance_environment import MurfeyInstanceEnvironment, SampleInfo |
11 | 15 | from murfey.util import authorised_requests, capture_post, get_machine_config_client |
12 | 16 |
|
|
15 | 19 | requests.get, requests.post, requests.put, requests.delete = authorised_requests() |
16 | 20 |
|
17 | 21 |
|
18 | | -class FoilHole(NamedTuple): |
19 | | - x_location: int |
20 | | - y_location: int |
21 | | - diameter: int |
22 | | - x_stage_position: Optional[float] = None |
23 | | - y_stage_position: Optional[float] = None |
24 | | - readout_area_x: Optional[int] = None |
25 | | - readout_area_y: Optional[int] = None |
26 | | - thumbnail_size_x: Optional[int] = None |
27 | | - thumbnail_size_y: Optional[int] = None |
28 | | - pixel_size: Optional[float] = None |
29 | | - image: str = "" |
30 | | - |
31 | | - |
32 | 22 | def _foil_hole_positions(xml_path: Path, grid_square: int) -> Dict[str, FoilHole]: |
33 | 23 | with open(xml_path, "r") as xml: |
34 | 24 | for_parsing = xml.read() |
@@ -65,6 +55,8 @@ def _foil_hole_positions(xml_path: Path, grid_square: int) -> Dict[str, FoilHole |
65 | 55 | stage = fh_block["b:value"]["StagePosition"] |
66 | 56 | diameter = fh_block["b:value"]["PixelWidthHeight"]["c:width"] |
67 | 57 | foil_holes[fh_block["b:key"]] = FoilHole( |
| 58 | + id=int(fh_block["b:key"]), |
| 59 | + grid_square_id=grid_square, |
68 | 60 | x_location=int(float(stage["c:x"])), |
69 | 61 | y_location=int(float(stage["c:y"])), |
70 | 62 | x_stage_position=float(stage["c:X"]), |
|
0 commit comments