From ff5cfa055f089dfd030beb9b307953c447745502 Mon Sep 17 00:00:00 2001 From: mkuehbach Date: Thu, 7 Dec 2023 13:09:16 +0100 Subject: [PATCH] pylinting, mypy, removal of unnecessary imports --- pynxtools/dataconverter/readers/em/reader.py | 38 +++++++-------- .../readers/em/subparsers/hfive_apex.py | 18 ++----- .../readers/em/subparsers/hfive_base.py | 30 +++++------- .../readers/em/subparsers/hfive_bruker.py | 23 ++------- .../readers/em/subparsers/hfive_concept.py | 8 ++-- .../em/subparsers/hfive_dreamthreed.py | 25 +++------- .../readers/em/subparsers/hfive_ebsd.py | 20 ++------ .../readers/em/subparsers/hfive_edax.py | 19 ++------ .../readers/em/subparsers/hfive_emsoft.py | 20 ++------ .../readers/em/subparsers/hfive_oxford.py | 21 ++------ .../readers/em/subparsers/nxs_mtex.py | 5 +- .../readers/em/subparsers/nxs_pyxem.py | 48 +++++++------------ .../readers/em/utils/hfive_utils.py | 5 +- tests/dataconverter/test_readers.py | 3 +- 14 files changed, 85 insertions(+), 198 deletions(-) diff --git a/pynxtools/dataconverter/readers/em/reader.py b/pynxtools/dataconverter/readers/em/reader.py index 75fad265d..a8aff8d4b 100644 --- a/pynxtools/dataconverter/readers/em/reader.py +++ b/pynxtools/dataconverter/readers/em/reader.py @@ -25,33 +25,27 @@ from pynxtools.dataconverter.readers.em.concepts.nexus_concepts import NxEmAppDef -from pynxtools.dataconverter.readers.em.subparsers.nxs_mtex import NxEmNxsMTexSubParser +# from pynxtools.dataconverter.readers.em.subparsers.nxs_mtex import NxEmNxsMTexSubParser from pynxtools.dataconverter.readers.em.subparsers.nxs_pyxem import NxEmNxsPyxemSubParser from pynxtools.dataconverter.readers.em.utils.default_plots import NxEmDefaultPlotResolver -from pynxtools.dataconverter.readers.em.geometry.convention_mapper \ - import NxEmConventionMapper +# from pynxtools.dataconverter.readers.em.geometry.convention_mapper import NxEmConventionMapper -""" -from pynxtools.dataconverter.readers.em_om.utils.generic_eln_io \ - import NxEmOmGenericElnSchemaParser - -from pynxtools.dataconverter.readers.em_om.utils.orix_ebsd_parser \ - import NxEmOmOrixEbsdParser - -from pynxtools.dataconverter.readers.em_om.utils.mtex_ebsd_parser \ - import NxEmOmMtexEbsdParser - -from pynxtools.dataconverter.readers.em_om.utils.zip_ebsd_parser \ - import NxEmOmZipEbsdParser - -from pynxtools.dataconverter.readers.em_om.utils.dream3d_ebsd_parser \ - import NxEmOmDreamThreedEbsdParser - -from pynxtools.dataconverter.readers.em_om.utils.em_nexus_plots \ - import em_om_default_plot_generator""" +# remaining subparsers to be implemented and merged into this one +# from pynxtools.dataconverter.readers.em_om.utils.generic_eln_io \ +# import NxEmOmGenericElnSchemaParser +# from pynxtools.dataconverter.readers.em_om.utils.orix_ebsd_parser \ +# import NxEmOmOrixEbsdParser +# from pynxtools.dataconverter.readers.em_om.utils.mtex_ebsd_parser \ +# import NxEmOmMtexEbsdParser +# from pynxtools.dataconverter.readers.em_om.utils.zip_ebsd_parser \ +# import NxEmOmZipEbsdParser +# from pynxtools.dataconverter.readers.em_om.utils.dream3d_ebsd_parser \ +# import NxEmOmDreamThreedEbsdParser +# from pynxtools.dataconverter.readers.em_om.utils.em_nexus_plots \ +# import em_om_default_plot_generator class EmReader(BaseReader): @@ -127,7 +121,7 @@ def read(self, # add further with resolving cases # if file_path is an HDF5 will use hfive parser - sub_parser = "nxs_pyxem" + # sub_parser = "nxs_pyxem" subparser = NxEmNxsPyxemSubParser(entry_id, file_paths[0]) subparser.parse(template) # exit(1) diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_apex.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_apex.py index 1f2076394..e487c5287 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_apex.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_apex.py @@ -19,19 +19,9 @@ import numpy as np import h5py -from itertools import groupby -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix +from typing import Dict from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation, Orientation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt +from orix.quaternion import Orientation from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import \ @@ -48,8 +38,8 @@ def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None self.tmp = {} - self.supported_version = {} - self.version = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_base.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_base.py index a84be5897..eeebb88d8 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_base.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_base.py @@ -17,17 +17,9 @@ # """(Sub-)parser mapping concepts and content from EDAX/AMETEK *.edaxh5 (APEX) files on NXem.""" -import os -import glob -import re -import sys -from typing import Dict, Any, List import numpy as np import h5py -import yaml -import json -# import imageio.v3 as iio -from PIL import Image as pil +from typing import Dict, List from pynxtools.dataconverter.readers.em.subparsers.hfive_concept import \ IS_GROUP, IS_REGULAR_DATASET, IS_COMPOUND_DATASET, IS_ATTRIBUTE, \ @@ -64,24 +56,24 @@ def __init__(self, file_path: str = ""): # an instance of a file whose schema belongs to the H5OINA family of HDF5 container formats # specifically using version 5 self.prfx = None - self.tmp = {} + self.tmp: Dict = {} self.source = None self.file_path = None # collection of instance path - self.groups = {} - self.datasets = {} - self.attributes = {} - self.instances = {} + self.groups: Dict = {} + self.datasets: Dict = {} + self.attributes: Dict = {} + self.instances: Dict = {} # collection of template - self.template_groups = [] - self.template_datasets = [] - self.template_attributes = [] - self.templates = {} + self.template_groups: List = [] + self.template_datasets: List = [] + self.template_attributes: List = [] + self.templates: Dict = {} self.h5r = None if file_path is not None and file_path != "": self.file_path = file_path else: - raise ValueError(f"{__class__.__name__} needs proper instantiation !") + raise ValueError(f"{__name__} needs proper instantiation !") def init_named_cache(self, ckey: str): """Init a new cache for normalized EBSD data if not existent.""" diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_bruker.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_bruker.py index 3e6594c75..2c8f5a8b3 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_bruker.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_bruker.py @@ -17,29 +17,16 @@ # """(Sub-)parser mapping concepts and content from Bruker *.h5 files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -from itertools import groupby -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix +from typing import Dict from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import \ EBSD_MAP_SPACEGROUP, read_strings_from_dataset, all_equal, format_euler_parameterization from pynxtools.dataconverter.readers.em.examples.ebsd_database import \ - ASSUME_PHASE_NAME_TO_SPACE_GROUP, HEXAGONAL_GRID, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN + ASSUME_PHASE_NAME_TO_SPACE_GROUP, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN # HEXAGONAL_GRID from pynxtools.dataconverter.readers.em.utils.get_scan_points import \ get_scan_point_coords @@ -49,9 +36,9 @@ class HdfFiveBrukerEspritReader(HdfFiveBaseParser): def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None - self.tmp = {} - self.supported_version = {} - self.version = {} + self.tmp: Dict = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_concept.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_concept.py index 55e8714c0..b7262974c 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_concept.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_concept.py @@ -17,14 +17,16 @@ # """Constants and utilities used when parsing concepts from HDF5 files.""" +from typing import Dict + IS_GROUP = 0 IS_REGULAR_DATASET = 1 IS_COMPOUND_DATASET = 2 IS_FIELD_IN_COMPOUND_DATASET = 3 IS_ATTRIBUTE = 4 -VERSION_MANAGEMENT = {"tech_partner": [], - "schema_name": [], "schema_version": [], - "writer_name": [], "writer_version": []} +VERSION_MANAGEMENT: Dict = {"tech_partner": [], + "schema_name": [], "schema_version": [], + "writer_name": [], "writer_version": []} class Concept(): diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_dreamthreed.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_dreamthreed.py index 009508ed2..0502c6519 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_dreamthreed.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_dreamthreed.py @@ -17,28 +17,15 @@ # """(Sub-)parser mapping concepts and content from community *.dream3d files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix -from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt +from typing import Dict from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import \ - EBSD_MAP_SPACEGROUP, read_strings_from_dataset, all_equal, format_euler_parameterization + read_strings_from_dataset # EBSD_MAP_SPACEGROUP from pynxtools.dataconverter.readers.em.examples.ebsd_database import \ - ASSUME_PHASE_NAME_TO_SPACE_GROUP, HEXAGONAL_GRID, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN + SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN # ASSUME_PHASE_NAME_TO_SPACE_GROUP, HEXAGONAL_GRID # DREAM3D implements essentially a data analysis workflow with individual steps # in the DREAM3D jargon each step is referred to as a filter, filters have well-defined @@ -97,9 +84,9 @@ def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None self.tmp = {} - self.path_registry = {} - self.supported_version = {} - self.version = {} + self.path_registry: Dict = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_ebsd.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_ebsd.py index ffd8bf73c..0de0c79d7 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_ebsd.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_ebsd.py @@ -17,28 +17,16 @@ # """(Sub-)parser mapping concepts and content from community *.h5/*.h5ebsd files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix +from typing import Dict from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import \ EBSD_MAP_SPACEGROUP, read_strings_from_dataset, all_equal, format_euler_parameterization from pynxtools.dataconverter.readers.em.examples.ebsd_database import \ - ASSUME_PHASE_NAME_TO_SPACE_GROUP, HEXAGONAL_GRID, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN + ASSUME_PHASE_NAME_TO_SPACE_GROUP, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN # HEXAGONAL_GRID from pynxtools.dataconverter.readers.em.utils.get_scan_points import \ get_scan_point_coords @@ -49,8 +37,8 @@ def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None self.tmp = {} - self.supported_version = {} - self.version = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_edax.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_edax.py index 7e756776f..157b8ce75 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_edax.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_edax.py @@ -17,23 +17,10 @@ # """(Sub-)parser mapping concepts and content from EDAX/AMETEK *.oh5/*.h5 (OIM Analysis) files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -from itertools import groupby -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix +from typing import Dict from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import EULER_SPACE_SYMMETRY, \ @@ -48,8 +35,8 @@ def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None self.tmp = {} - self.supported_version = {} - self.version = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_emsoft.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_emsoft.py index 5aa5e8f0c..49405197b 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_emsoft.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_emsoft.py @@ -17,23 +17,9 @@ # """(Sub-)parser mapping concepts and content from Marc deGraeff's EMsoft *.h5 files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -from itertools import groupby -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix -from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt +from typing import Dict from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import read_strings_from_dataset @@ -45,8 +31,8 @@ def __init__(self, file_path: str = ""): super().__init__(file_path) self.prfx = None self.tmp = {} - self.supported_version = {} - self.version = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/hfive_oxford.py b/pynxtools/dataconverter/readers/em/subparsers/hfive_oxford.py index e64929e4d..04db7b896 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/hfive_oxford.py +++ b/pynxtools/dataconverter/readers/em/subparsers/hfive_oxford.py @@ -17,29 +17,16 @@ # """(Sub-)parser mapping concepts and content from Oxford Instruments *.h5oina files on NXem.""" -import os -from typing import Dict, Any, List import numpy as np import h5py -from itertools import groupby -# import imageio.v3 as iio -from PIL import Image as pil - -import diffsims -import orix +from typing import Dict from diffpy.structure import Lattice, Structure -from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList -from orix.quaternion import Rotation -from orix.vector import Vector3d - -import matplotlib.pyplot as plt from pynxtools.dataconverter.readers.em.subparsers.hfive_base import HdfFiveBaseParser from pynxtools.dataconverter.readers.em.utils.hfive_utils import \ read_strings_from_dataset, format_euler_parameterization from pynxtools.dataconverter.readers.em.examples.ebsd_database import \ - HEXAGONAL_GRID, SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN + SQUARE_GRID, REGULAR_TILING, FLIGHT_PLAN # HEXAGONAL_GRID class HdfFiveOxfordReader(HdfFiveBaseParser): @@ -53,8 +40,8 @@ def __init__(self, file_path: str = ""): # which perform plotting and data processing functionalities # this design effectively avoids that different specialized hfive readers need to # duplicate the code of the base hfive parser for generating NeXus default plots - self.supported_version = {} - self.version = {} + self.supported_version: Dict = {} + self.version: Dict = {} self.init_support() self.supported = False self.check_if_supported() diff --git a/pynxtools/dataconverter/readers/em/subparsers/nxs_mtex.py b/pynxtools/dataconverter/readers/em/subparsers/nxs_mtex.py index 48f6dffc1..834c6f268 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/nxs_mtex.py +++ b/pynxtools/dataconverter/readers/em/subparsers/nxs_mtex.py @@ -18,10 +18,9 @@ """(Sub-)parser mapping concepts and content from *.nxs.mtex files on NXem.""" import re -from typing import Any -from typing_extensions import SupportsIndex import h5py - +# from typing_extensions import SupportsIndex +# from typing import Any from ase.data import chemical_symbols from pynxtools.dataconverter.readers.em.examples.ebsd_database import \ diff --git a/pynxtools/dataconverter/readers/em/subparsers/nxs_pyxem.py b/pynxtools/dataconverter/readers/em/subparsers/nxs_pyxem.py index c226478a2..90e417c0f 100644 --- a/pynxtools/dataconverter/readers/em/subparsers/nxs_pyxem.py +++ b/pynxtools/dataconverter/readers/em/subparsers/nxs_pyxem.py @@ -33,28 +33,14 @@ # towards more interoperability between the different tools in the community import os -import glob -import re -import sys -from typing import Dict, Any, List import numpy as np -import h5py -import yaml -import json -# import imageio.v3 as iio +# from typing import Dict, Any, List from PIL import Image as pil - -import diffsims -import orix -from diffpy.structure import Lattice, Structure from orix import plot -from orix.crystal_map import create_coordinate_arrays, CrystalMap, PhaseList from orix.quaternion import Rotation from orix.quaternion.symmetry import get_point_group from orix.vector import Vector3d -import matplotlib.pyplot as plt - from pynxtools.dataconverter.readers.em.utils.hfive_utils import read_strings_from_dataset from pynxtools.dataconverter.readers.em.utils.hfive_web_constants \ import HFIVE_WEB_MAXIMUM_ROI, HFIVE_WEB_MAXIMUM_RGB @@ -64,7 +50,7 @@ from pynxtools.dataconverter.readers.em.utils.get_sqr_grid import \ get_scan_points_with_mark_data_discretized_on_sqr_grid from pynxtools.dataconverter.readers.em.utils.get_scan_points import \ - get_scan_point_axis_values, get_scan_point_coords, square_grid, hexagonal_grid, threed + square_grid, hexagonal_grid, threed, get_scan_point_axis_values, get_scan_point_coords from pynxtools.dataconverter.readers.em.subparsers.hfive_oxford import HdfFiveOxfordReader from pynxtools.dataconverter.readers.em.subparsers.hfive_bruker import HdfFiveBrukerEspritReader @@ -472,17 +458,17 @@ def process_roi_phase_ipfs_twod(self, template[f"{lgd}/data"] = {"compress": img, "strength": 1} hfive_web_decorate_nxdata(f"{lgd}/data", template) - dims = [("x", 1), ("y", 0)] - for dim in dims: - template[f"{lgd}/AXISNAME[axis_{dim[0]}]"] \ + dims_idxs = {"x": 1, "y": 0} + for dim, idx in dims_idxs.items(): + template[f"{lgd}/AXISNAME[axis_{dim}]"] \ = {"compress": np.asarray(np.linspace(0, - np.shape(img)[dim[1]] - 1, - num=np.shape(img)[dim[1]], + np.shape(img)[idx] - 1, + num=np.shape(img)[idx], endpoint=True), np.uint32), "strength": 1} - template[f"{lgd}/AXISNAME[axis_{dim[0]}]/@long_name"] \ + template[f"{lgd}/AXISNAME[axis_{dim}]/@long_name"] \ = f"Pixel along {dim[0]}-axis" - template[f"{lgd}/AXISNAME[axis_{dim[0]}]/@units"] = "px" + template[f"{lgd}/AXISNAME[axis_{dim}]/@units"] = "px" return template def onthefly_process_roi_ipfs_phases_threed(self, @@ -625,15 +611,15 @@ def process_roi_phase_ipfs_threed(self, template[f"{lgd}/data"] = {"compress": img, "strength": 1} hfive_web_decorate_nxdata(f"{lgd}/data", template) - dims = [("x", 1), ("y", 0)] - for dim in dims: - template[f"{lgd}/AXISNAME[axis_{dim[0]}]"] \ + dims_idxs = {"x": 1, "y": 0} + for dim, idx in dims_idxs.items(): + template[f"{lgd}/AXISNAME[axis_{dim}]"] \ = {"compress": np.asarray(np.linspace(0, - np.shape(img)[dim[1]] - 1, - num=np.shape(img)[dim[1]], + np.shape(img)[idx] - 1, + num=np.shape(img)[idx], endpoint=True), np.uint32), "strength": 1} - template[f"{lgd}/AXISNAME[axis_{dim[0]}]/@long_name"] \ - = f"Pixel along {dim[0]}-axis" - template[f"{lgd}/AXISNAME[axis_{dim[0]}]/@units"] = "px" + template[f"{lgd}/AXISNAME[axis_{dim}]/@long_name"] \ + = f"Pixel along {dim}-axis" + template[f"{lgd}/AXISNAME[axis_{dim}]/@units"] = "px" return template diff --git a/pynxtools/dataconverter/readers/em/utils/hfive_utils.py b/pynxtools/dataconverter/readers/em/utils/hfive_utils.py index 29e36f25e..685306bc8 100644 --- a/pynxtools/dataconverter/readers/em/utils/hfive_utils.py +++ b/pynxtools/dataconverter/readers/em/utils/hfive_utils.py @@ -26,6 +26,7 @@ import json import numpy as np from itertools import groupby +from typing import List, Dict EBSD_MAP_SPACEGROUP = {"P 6#sub3mc": 186, @@ -38,8 +39,8 @@ "I m#ovl3m": 229} # see here for typical examples http://img.chem.ucl.ac.uk/sgp/large/186az1.htm -DIRTY_FIX_SPACEGROUP = {} -EULER_SPACE_SYMMETRY = [2. * np.pi, np.pi, 2. * np.pi] +DIRTY_FIX_SPACEGROUP: Dict = {} +EULER_SPACE_SYMMETRY: List = [2. * np.pi, np.pi, 2. * np.pi] def format_euler_parameterization(triplet_set): diff --git a/tests/dataconverter/test_readers.py b/tests/dataconverter/test_readers.py index 0ef32320f..9d8d5093a 100644 --- a/tests/dataconverter/test_readers.py +++ b/tests/dataconverter/test_readers.py @@ -53,7 +53,8 @@ def get_all_readers() -> List[ParameterSet]: # Explicitly removing ApmReader and EmNionReader because we need to add test data for reader in [get_reader(x) for x in get_names_of_all_readers()]: - if reader.__name__ in ("ApmReader", "EmReader", "EmOmReader", "EmSpctrscpyReader", "EmNionReader"): + if reader.__name__ in ("ApmReader", + "EmReader", "EmOmReader", "EmSpctrscpyReader", "EmNionReader"): readers.append(pytest.param(reader, marks=pytest.mark.skip(reason="Missing test data.") ))