Skip to content

Commit

Permalink
Tested parsing on IKZ and PDI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
atomprobe-tc committed Jan 13, 2024
1 parent bd4edec commit 712e384
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 69 deletions.
10 changes: 7 additions & 3 deletions debug/spctrscpy.batch.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/bash

datasource="../../../../paper_paper_paper/scidat_nomad_ebsd/bb_analysis/data/development_spctrscpy/pdi/"
datasource="../../../../../paper_paper_paper/scidat_nomad_ebsd/bb_analysis/data/development_spctrscpy/pdi/"
datasource="../../../../../paper_paper_paper/scidat_nomad_ebsd/bb_analysis/data/development_spctrscpy/ikz/"


# apex examples ikz, pdi
# examples="ikz/VInP_108_L2.h5 ikz/GeSn_13.h5 pynx/46_ES-LP_L1_brg.bcf pynx/1613_Si_HAADF_610_kx.emd pynx/EELS_map_2_ROI_1_location_4.dm3 pynx/H5OINA_examples_Specimen_1_Map_EDS_+_EBSD_Map_Data_2.h5oina"
examples="ikz/VInP_108_L2.h5"
examples="InGaN_nanowires_spectra.edaxh5"
examples="AlGaO.nxs"
examples="GeSi.nxs"
examples="VInP_108_L2.h5"
#examples="InGaN_nanowires_spectra.edaxh5"

for example in $examples; do
echo $example
Expand Down
193 changes: 179 additions & 14 deletions debug/spctrscpy.dev.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def __init__(self):
self.tmp: Dict = {}
self.tmp["source"] = None
for entry in NX_IMAGE_REAL_SPACE_SET_HDF_PATH:
if entry.endswith("-field") is True:
if entry.endswith("-field"):
self.tmp[entry[0:len(entry) - len("-field")]] = NxObject(eqv_hdf="dataset")
elif entry.endswith("-attribute") is True:
elif entry.endswith("-attribute"):
self.tmp[entry[0:len(entry) - len("-attribute")]] = NxObject(eqv_hdf="attribute")
else:
self.tmp[entry[0:len(entry) - len("-group")]] = NxObject(eqv_hdf="group")
9 changes: 4 additions & 5 deletions pynxtools/dataconverter/readers/em/concepts/nxs_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NxObject:
def __init__(self,
name: str = None,
unit: str = None,
dtype=str,
dtype=None,
value=None,
**kwargs):
if (name is not None) and (name == ""):
Expand All @@ -44,10 +44,9 @@ def __init__(self,
# use special values "unitless" for NX_UNITLESS (e.g. 1) and
# "dimensionless" for NX_DIMENSIONLESS (e.g. 1m / 1m)
self.dtype = dtype # use np.dtype if possible
if value is None or dtype is str:
if value is None or isinstance(dtype, str):
self.unit = "unitless"
if value is not None:
self.value = value
self.value = value
# value should be a numpy scalar, tensor, or string if possible
self.eqv_hdf = None
if "eqv_hdf" in kwargs:
Expand All @@ -58,4 +57,4 @@ def __init__(self,

def __repr__(self):
"""Report values."""
return f"Name: {self.name}, unit: {self.unit}, dtype: {self.dtype}, eqv_hdf: {self.eqv_hdf}"
return f"Name: {self.name}, unit: {self.unit}, dtype: {self.dtype}, value: {self.value}, eqv_hdf: {self.eqv_hdf}"
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,16 @@
"PROCESS/mode-field",
"PROCESS/PROGRAM-group",
"PROCESS/source-group",
"spectrum_zerod-group",
"spectrum_zerod/axis_energy-field",
"spectrum_zerod/axis_energy@long_name-attribute",
"spectrum_zerod/intensity-field",
"spectrum_zerod/intensity@long_name-attribute",
"spectrum_oned-group",
"spectrum_oned/axis_energy-field",
"spectrum_oned/axis_energy@long_name-attribute",
"spectrum_oned/axis_x-field",
"spectrum_oned/axis_x@long_name-attribute",
"spectrum_oned/intensity-field",
"spectrum_oned/intensity@long_name-attribute",
"spectrum_threed-group",
"spectrum_threed/axis_energy-field",
"spectrum_threed/axis_energy@long_name-attribute",
"spectrum_threed/axis_x-field",
Expand All @@ -57,7 +54,6 @@
"spectrum_threed/axis_z@long_name-attribute",
"spectrum_threed/intensity-field",
"spectrum_threed/intensity@long_name-attribute",
"spectrum_twod-group",
"spectrum_twod/axis_energy-field",
"spectrum_twod/axis_energy@long_name-attribute",
"spectrum_twod/axis_x-field",
Expand Down
16 changes: 8 additions & 8 deletions pynxtools/dataconverter/readers/em/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

from pynxtools.dataconverter.readers.base.reader import BaseReader
# from pynxtools.dataconverter.readers.em.concepts.nxs_concepts import NxEmAppDef
# 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.subparsers.nxs_imgs import NxEmImagesSubParser
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.subparsers.nxs_imgs import NxEmImagesSubParser
from pynxtools.dataconverter.readers.em.subparsers.nxs_nion import NxEmZippedNionProjectSubParser
from pynxtools.dataconverter.readers.em.utils.default_plots import NxEmDefaultPlotResolver
# from pynxtools.dataconverter.readers.em.geometry.convention_mapper import NxEmConventionMapper
Expand Down Expand Up @@ -119,18 +119,18 @@ def read(self,

# add further with resolving cases
# if file_path is an HDF5 will use hfive parser
# sub_parser = "nxs_pyxem"
# subparser = NxEmNxsPyxemSubParser(entry_id, file_paths[0])
# subparser.parse(template)
sub_parser = "nxs_pyxem"
subparser = NxEmNxsPyxemSubParser(entry_id, file_paths[0])
subparser.parse(template)
# TODO::check correct loop through!

# sub_parser = "image_tiff"
# subparser = NxEmImagesSubParser(entry_id, file_paths[0])
# subparser.parse(template)

# sub_parser = "zipped_nion_project"
subparser = NxEmZippedNionProjectSubParser(entry_id, file_paths[0])
subparser.parse(template, verbose=True)
# subparser = NxEmZippedNionProjectSubParser(entry_id, file_paths[0])
# subparser.parse(template, verbose=True)

# for dat_instance in case.dat_parser_type:
# print(f"Process pieces of information in {dat_instance} tech partner file...")
Expand Down
Loading

0 comments on commit 712e384

Please sign in to comment.