|
5 | 5 | from threading import RLock |
6 | 6 | from typing import Callable, Dict, List, OrderedDict |
7 | 7 |
|
8 | | -import xmltodict |
9 | | - |
10 | 8 | import murfey.util.eer |
11 | 9 | from murfey.client.context import Context, ProcessingParameter, ensure_dcg_exists |
12 | 10 | from murfey.client.instance_environment import ( |
@@ -84,7 +82,7 @@ def __init__( |
84 | 82 | machine_config: dict, |
85 | 83 | token: str, |
86 | 84 | ): |
87 | | - super().__init__("Tomography", acquisition_software, token) |
| 85 | + super().__init__("TomographyContext", acquisition_software, token) |
88 | 86 | self._basepath = basepath |
89 | 87 | self._machine_config = machine_config |
90 | 88 | self._tilt_series: Dict[str, List[Path]] = {} |
@@ -550,46 +548,14 @@ def post_first_transfer( |
550 | 548 | def gather_metadata( |
551 | 549 | self, metadata_file: Path, environment: MurfeyInstanceEnvironment | None = None |
552 | 550 | ) -> OrderedDict: |
553 | | - if metadata_file.suffix not in (".mdoc", ".xml"): |
| 551 | + if metadata_file.suffix != ".mdoc": |
554 | 552 | raise ValueError( |
555 | 553 | f"Tomography gather_metadata method expected xml or mdoc file not {metadata_file.name}" |
556 | 554 | ) |
557 | 555 | try: |
558 | 556 | if not metadata_file.is_file(): |
559 | 557 | logger.debug(f"Metadata file {metadata_file} not found") |
560 | 558 | return OrderedDict({}) |
561 | | - if metadata_file.suffix == ".xml": |
562 | | - with open(metadata_file, "r") as xml: |
563 | | - try: |
564 | | - for_parsing = xml.read() |
565 | | - except Exception: |
566 | | - logger.warning( |
567 | | - f"Failed to parse file {metadata_file}", exc_info=True |
568 | | - ) |
569 | | - return OrderedDict({}) |
570 | | - data = xmltodict.parse(for_parsing) |
571 | | - try: |
572 | | - metadata: OrderedDict = OrderedDict({}) |
573 | | - metadata["experiment_type"] = "tomography" |
574 | | - metadata["voltage"] = 300 |
575 | | - metadata["image_size_x"] = data["Acquisition"]["Info"]["ImageSize"][ |
576 | | - "Width" |
577 | | - ] |
578 | | - metadata["image_size_y"] = data["Acquisition"]["Info"]["ImageSize"][ |
579 | | - "Height" |
580 | | - ] |
581 | | - metadata["pixel_size_on_image"] = float( |
582 | | - data["Acquisition"]["Info"]["SensorPixelSize"]["Height"] |
583 | | - ) |
584 | | - metadata["motion_corr_binning"] = 1 |
585 | | - metadata["gain_ref"] = None |
586 | | - metadata["dose_per_frame"] = ( |
587 | | - environment.dose_per_frame if environment else None |
588 | | - ) |
589 | | - metadata["source"] = str(self._basepath) |
590 | | - except KeyError: |
591 | | - return OrderedDict({}) |
592 | | - return metadata |
593 | 559 | with open(metadata_file, "r") as md: |
594 | 560 | mdoc_data = get_global_data(md) |
595 | 561 | num_blocks = get_num_blocks(md) |
|
0 commit comments