Skip to content

Commit

Permalink
Bugfixes, mainly type conversions for apm_app
Browse files Browse the repository at this point in the history
  • Loading branch information
atomprobe-tc committed Jan 28, 2025
1 parent f088889 commit f72395c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"cwd": "${workspaceFolder}",
"program": "../../.py3.11.11/bin/dataconverter",
"args": [//workflow files str.str, hits.hits, root.root should be created via touch str.str ...
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/001.0.c4b1b412f46833ef7b72164858f3fa2daea60de212b2a62cd7121c07a92d5837.rhit.CRunHeader.dat.Parsed.cameca",
"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/019.0.8d12016f3d152ce8a02194b126bd6c896f517928dada673864e93e4dfc418738.root.CAnalysis.dat.Parsed.cameca",
"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/001.0.c4b1b412f46833ef7b72164858f3fa2daea60de212b2a62cd7121c07a92d5837.rhit.CRunHeader.dat.Parsed.cameca",
//"../../../../paper_paper_paper/scidat_nomad_apt/bb_analysis/analysis/harvest_examples/data/production/019.0.8d12016f3d152ce8a02194b126bd6c896f517928dada673864e93e4dfc418738.root.CAnalysis.dat.Parsed.cameca",
"--reader",
"apm",
"--nxdl",
"NXapm",
//"--output=tests/prod/out_recon.nxs"]
"--output=tests/prod/out_range.nxs"]
"--output=tests/prod/out_recon.nxs"]
//"--output=tests/prod/out_range.nxs"]
}
]
}
5 changes: 4 additions & 1 deletion src/pynxtools_apm/concepts/mapping_functors_pint.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"i8": np.int64,
"f8": np.float64,
"bool": bool,
"str": str,
}

# general conversion workflow
Expand Down Expand Up @@ -201,7 +202,9 @@ def set_value(template: dict, trg: str, src_val: Any, trg_dtype: str = "") -> di
)
else: # do an explicit type conversion
# e.g. in cases when tech partner writes float32 but e.g. NeXus assumes float64
if isinstance(src_val, (str, bool)):
if isinstance(src_val, str):
template[f"{trg}"] = f"{src_val}"
if isinstance(src_val, bool):
template[f"{trg}"] = try_interpret_as_boolean(src_val)
elif isinstance(src_val, ureg.Quantity):
if isinstance(src_val.magnitude, (np.ndarray, np.generic)):
Expand Down
6 changes: 5 additions & 1 deletion src/pynxtools_apm/configurations/cameca_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@
ureg.millimeter,
"fMaximumFlightPathMm",
),
("measurement/stage/specimen_temperature", ureg.kelvin, "fSpecimenTemperature"),
(
"measurement/instrument/stage/specimen_temperature",
ureg.kelvin,
"fSpecimenTemperature",
),
(
"atom_probe/voltage_and_bowl/tof_zero_estimate",
ureg.nanosecond,
Expand Down
4 changes: 3 additions & 1 deletion src/pynxtools_apm/utils/oasis_apsuite_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def parse_ranging_definitions(self, template: dict) -> dict:
template[f"{trg}nuclide_list"] = ion.nuclide_list.values
template[f"{trg}name"] = ion.name.values

"""
if ion.charge_state_model["n_cand"] > 0:
path = f"{trg}charge_state_analysis/"
template[f"{path}nuclides"] = np.asarray(
Expand Down Expand Up @@ -263,8 +264,9 @@ def parse_ranging_definitions(self, template: dict) -> dict:
"strength": 1,
}
template[f"{path}shortest_half_life/@units"] = "s"
"""

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(
MAX_NUMBER_OF_ATOMS_PER_ION
Expand Down

0 comments on commit f72395c

Please sign in to comment.