Skip to content

Commit

Permalink
Fixes NOMAD APM example
Browse files Browse the repository at this point in the history
  • Loading branch information
atomprobe-tc committed Feb 1, 2025
1 parent 1a2182f commit 12bd21b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/cameca/091.0.638c14a699bce8644b1df4690c86b5f0d2fdc60fc4cbfdeb8bc89def735193b6.rhit.CRunHeader.dat.Parsed.cameca",
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/cameca/091.0.68466f6cc6a751a23126c82f8a5a04c9c91f1c7e03bb44e6d2c2c9375e07a624.root.CAnalysis.dat.Parsed.cameca",
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/cameca/008.1.1f7a63e5a16239bcaebe71c8ac2812b5f6cdb1175f1a4618db7c9435c3ead06c.rhit.CRunHeader.dat.Parsed.cameca",
"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/cameca/088.44.1444afcbc8114aa6832716877ea9dc3360968458ce1ce74bb4c9ea21f4fe8678.rhit.CRunHeader.dat.Parsed.cameca",
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/cameca/088.44.1444afcbc8114aa6832716877ea9dc3360968458ce1ce74bb4c9ea21f4fe8678.rhit.CRunHeader.dat.Parsed.cameca",
"examples/apm.oasis.specific.yaml",
"examples/eln_data.yaml",
"examples/Si.apt",
"examples/Si.RRNG",
"--reader",
"apm",
"--nxdl",
"NXapm",
"--output=tests/prod/usa_idaho_boise.088.44.nxs"]
"--output=Si.nxs"],
//"--output=tests/prod/usa_idaho_boise.088.44.nxs"]
//"--output=tests/prod/usa_portland_grimm.091.0.nxs"]
//"--output=tests/prod/out_recon.nxs"]
//"--output=tests/prod/out_range.nxs"]
Expand Down
2 changes: 1 addition & 1 deletion src/pynxtools_apm/concepts/mapping_functors_pint.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def map_functor(
# both of these cases can be avoided in an implementation when the
# src quantity is already a pint quantity instead of some
# pure python or numpy value or array respectively
raise ValueError(
raise NotImplementedError(
f"Hitting unimplemented case_four, instead refactor implementation such"
f"that values on the src side are pint.Quantities already!"
)
Expand Down
4 changes: 2 additions & 2 deletions src/pynxtools_apm/configurations/eln_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"chamber_pressure/unit",
),
(
"stage_lab/base_temperature",
"stage/specimen_temperature",
ureg.kelvin,
"base_temperature/value",
"base_temperature/unit",
Expand Down Expand Up @@ -191,7 +191,7 @@
("programID[program1]/program/@version", "program_version"),
],
"map_to_f8": [
("field_of_view", ureg.centimeter, "field_of_view/value", "field_of_view/unit")
("field_of_view", ureg.nanometer, "field_of_view/value", "field_of_view/unit")
],
}

Expand Down
2 changes: 1 addition & 1 deletion src/pynxtools_apm/utils/generate_synthetic_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def composition_to_ranging_definitions(self, template: dict) -> dict:
template[f"{path}name"] = nuclide_hash_to_human_readable_name(ivec, tpl[1])
ion_id += 1

trg = f"/ENTRY[entry{self.entry_id}]/atom_probe/ranging/"
trg = f"/ENTRY[entry{self.entry_id}]/atom_probe/ranging/peak_identification/"
template[f"{trg}number_of_ion_types"] = np.uint32(ion_id)
template[f"{trg}maximum_number_of_atoms_per_molecular_ion"] = np.uint32(32)

Expand Down
18 changes: 8 additions & 10 deletions src/pynxtools_apm/utils/load_ranging.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def add_standardize_molecular_ions(
template[f"{path}shortest_half_life/@units"] = "s"
ion_id += 1

trg = f"/ENTRY[entry{entry_id}]/atom_probe/ranging/"
trg = f"/ENTRY[entry{entry_id}]/atom_probe/ranging/peak_identification/"
template[f"{trg}number_of_ion_types"] = np.uint32(ion_id)
return template

Expand Down Expand Up @@ -265,7 +265,7 @@ def __init__(self, file_path: str, entry_id: int):
def update_atom_types_ranging_definitions_based(self, template: dict) -> dict:
"""Update the atom_types list in the specimen based on ranging defs."""
number_of_ion_types = 1
prefix = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/"
prefix = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/peak_identification/"
if f"{prefix}number_of_ion_types" in template:
number_of_ion_types = template[f"{prefix}number_of_ion_types"]
print(
Expand Down Expand Up @@ -306,19 +306,17 @@ def parse(self, template: dict) -> dict:
with the application definition.
"""
# resolve the next two program references more informatively
trg = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/"
trg = (
f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/"
f"ranging/peak_identification/"
)
template[f"{trg}maximum_number_of_atoms_per_molecular_ion"] = np.uint32(
MAX_NUMBER_OF_ATOMS_PER_ION
)

# mass_to_charge_distribution will be filled by default plot
# background_quantification data are not available in RNG/RRNG files
# peak_search_and_deconvolution data are not available in RNG/RRNG files

trg = (
f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/"
f"ranging/peak_identification/"
)
template[f"{trg}programID[program1]/program"] = NX_APM_EXEC_NAME
template[f"{trg}programID[program1]/program/@version"] = NX_APM_EXEC_VERSION

Expand Down Expand Up @@ -350,10 +348,10 @@ def parse(self, template: dict) -> dict:
self.meta["file_path"], template, self.meta["entry_id"]
)
else:
trg = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/"
trg = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/peak_identification/"
template[f"{trg}number_of_ion_types"] = 1
else:
trg = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/"
trg = f"/ENTRY[entry{self.meta['entry_id']}]/atom_probe/ranging/peak_identification/"
template[f"{trg}number_of_ion_types"] = 1

self.update_atom_types_ranging_definitions_based(template)
Expand Down
23 changes: 10 additions & 13 deletions src/pynxtools_apm/utils/oasis_eln_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,22 @@ def parse_pulser_source(self, template: dict) -> dict:
# custom schema delivers a list of dictionaries...
for ldct in self.yml[src]:
trg_sta = (
f"/ENTRY[entry{self.entry_id}]/measurement/"
f"events/eventID[event1]/instrument/"
f"/ENTRY[entry{self.entry_id}]/measurement/instrument/"
f"pulser/sourceID[source{laser_id}]"
)
if "name" in ldct:
template[f"{trg_sta}/name"] = ldct["name"]
qnt = "wavelength"
if qnt in ldct:
if "value" in ldct[qnt] and "unit" in ldct[qnt]:
template[f"{trg_sta}/{qnt}"] = ldct[qnt]["value"]
template[f"{trg_sta}/{qnt}/@units"] = ldct[qnt]["unit"]

trg_dyn = (
f"/ENTRY[entry{self.entry_id}]/measurement/"
f"events/eventID[event1]/instrument/"
f"pulser/sourceID[source{laser_id}]"
)
quantities = ["power", "pulse_energy"]
for qnt in quantities:
if "name" in ldct:
template[f"{trg_sta}/name"] = ldct["name"]
# qnt = "wavelength"
# if qnt in ldct:
# if "value" in ldct[qnt] and "unit" in ldct[qnt]:
# template[f"{trg_sta}/{qnt}"] = ldct[qnt]["value"]
# template[f"{trg_sta}/{qnt}/@units"] = ldct[qnt]["unit"]
for qnt in ["power", "pulse_energy", "wavelength"]:
if isinstance(ldct[qnt], dict):
if ("value" in ldct[qnt]) and ("unit" in ldct[qnt]):
template[f"{trg_dyn}/{qnt}"] = ldct[qnt]["value"]
Expand All @@ -196,7 +193,7 @@ def parse(self, template: dict) -> dict:
self.parse_sample_composition(template)
self.parse_user(template)
self.parse_pulser_source(template)
identifier = [self.entry_id]
identifier = [self.entry_id, 1]
for cfg in [
APM_ENTRY_TO_NEXUS,
APM_SAMPLE_TO_NEXUS,
Expand Down

0 comments on commit 12bd21b

Please sign in to comment.