Skip to content

Commit

Permalink
Reflecting update of nxdefs
Browse files Browse the repository at this point in the history
  • Loading branch information
atomprobe-tc committed Aug 30, 2024
1 parent ff129be commit ca065a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 43 deletions.
8 changes: 5 additions & 3 deletions src/pynxtools_em/methods/ebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def ebsd_roi_overview(inp: EbsdPointCloud, id_mgn: dict, template: dict) -> dict
if not trg_grid.descr_type:
return template

trg = f"/ENTRY[entry{id_mgn['entry_id']}]/ROI[roi{id_mgn['roi_id']}]/ebsd/indexing/roi"
trg = f"/ENTRY[entry{id_mgn['entry_id']}]/roiID[roi{id_mgn['roi_id']}]/ebsd/indexing/roi"
template[f"{trg}/descriptor"] = trg_grid.descr_type
template[f"{trg}/title"] = (
f"Region-of-interest overview image ({trg_grid.descr_type})"
Expand Down Expand Up @@ -365,7 +365,9 @@ def ebsd_roi_overview(inp: EbsdPointCloud, id_mgn: dict, template: dict) -> dict
def ebsd_roi_phase_ipf(inp: EbsdPointCloud, id_mgn: dict, template: dict) -> dict:
"""Create for each phase three inverse pole figures (IPF) maps projected along X, Y using for each map only the respective scan points that were indexed for this phase."""
nxem_phase_id = 0
prfx = f"/ENTRY[entry{id_mgn['entry_id']}]/ROI[roi{id_mgn['roi_id']}]/ebsd/indexing"
prfx = (
f"/ENTRY[entry{id_mgn['entry_id']}]/roiID[roi{id_mgn['roi_id']}]/ebsd/indexing"
)
# bookkeeping for how many scan points solutions were found is always for src_grid
# because the eventual discretization for h5web is solely
# for the purpose of showing users a readily consumable default plot
Expand Down Expand Up @@ -479,7 +481,7 @@ def process_roi_phase_ipf(
# 2D, 0 > y, 1 > x
# 1D, 0 > x
trg = (
f"/ENTRY[entry{id_mgn['entry_id']}]/ROI[roi{id_mgn['roi_id']}]/ebsd/indexing"
f"/ENTRY[entry{id_mgn['entry_id']}]/roiID[roi{id_mgn['roi_id']}]/ebsd/indexing"
f"/phaseID[phase{nxem_phase_id}]/ipfID[ipf{idx + 1}]"
)
template[f"{trg}/projection_direction"] = np.asarray(
Expand Down
45 changes: 5 additions & 40 deletions src/pynxtools_em/methods/eds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,10 @@
import numpy as np
from pynxtools_em.concepts.nxs_image_set import NxImageRealSpaceSet

# process_roi_eds_spectra(inp, template)
# process_roi_eds_maps(inp, template)
# if ckey.startswith("eds_roi") and inp[ckey] != {}:
# self.process_roi_overview_eds_based(inp[ckey], template)
# TODO::all functions here are work in progress


def process_roi_overview_eds_based(self, inp, template: dict) -> dict:
trg = (
f"/ENTRY[entry{self.entry_id}]/measurement/event_data_em_set/"
f"EVENT_DATA_EM[event_data_em{self.id_mgn['event']}]/"
f"IMAGE_SET[image_set{self.id_mgn['event_img']}]/image_2d"
)
template[f"{trg}/description"] = inp.tmp["source"]
template[f"{trg}/title"] = f"Region-of-interest overview image"
template[f"{trg}/@signal"] = "real"
dims = [("i", 0), ("j", 1)]
template[f"{trg}/@axes"] = []
for dim in dims[::-1]:
template[f"{trg}/@axes"].append(f"axis_{dim[0]}")
template[f"{trg}/real"] = {
"compress": inp.tmp["image_2d/real"].value,
"strength": 1,
}
template[f"{trg}/real/@long_name"] = f"Signal"
for dim in dims:
template[f"{trg}/@AXISNAME_indices[axis_{dim[0]}_indices]"] = np.uint32(dim[1])
template[f"{trg}/AXISNAME[axis_{dim[0]}]"] = {
"compress": inp.tmp[f"image_2d/axis_{dim[0]}"].value,
"strength": 1,
}
template[f"{trg}/AXISNAME[axis_{dim[0]}]/@long_name"] = inp.tmp[
f"image_2d/axis_{dim[0]}@long_name"
].value
self.id_mgn["event_img"] += 1
self.id_mgn["event"] += 1
return template


def process_roi_eds_spectra(self, inp: dict, template: dict) -> dict:
def eds_roi_summary(self, inp: dict, template: dict) -> dict:
for ckey in inp.keys():
if ckey.startswith("eds_spc") and inp[ckey] != {}:
trg = (
Expand Down Expand Up @@ -90,19 +55,19 @@ def process_roi_eds_spectra(self, inp: dict, template: dict) -> dict:
return template


def process_roi_eds_maps(self, inp: dict, template: dict) -> dict:
def eds_roi_eds_map(self, inp: dict, template: dict) -> dict:
for ckey in inp.keys():
if ckey.startswith("eds_map") and inp[ckey] != {}:
trg = (
f"/ENTRY[entry{self.entry_id}]/ROI[roi{self.id_mgn['roi']}]/"
f"/ENTRY[entry{self.entry_id}]/roiID[roi{self.id_mgn['roi']}]/"
f"eds/indexing"
)
template[f"{trg}/source"] = inp[ckey].tmp["source"]
for img in inp[ckey].tmp["IMAGE_SET"]:
if not isinstance(img, NxImageRealSpaceSet):
continue
trg = (
f"/ENTRY[entry{self.entry_id}]/ROI[roi{self.id_mgn['roi']}]/eds/"
f"/ENTRY[entry{self.entry_id}]/roiID[roi{self.id_mgn['roi']}]/eds/"
f"indexing/IMAGE_SET[image_set{self.id_mgn['eds_img']}]"
)
template[f"{trg}/source"] = img.tmp["source"]
Expand Down

0 comments on commit ca065a5

Please sign in to comment.