Skip to content

Commit

Permalink
Apm sprint20 fixes spotted when connecting to Nomad (#10)
Browse files Browse the repository at this point in the history
* Adding fixes discussed on nomad-FAIR  05b34e6916b3429630289bf8f1fecd46f859037c

* ORCID is persistent

* jupyter deps

---------

Co-authored-by: mkuehbach <[email protected]>
  • Loading branch information
mkuehbach and atomprobe-tc authored May 10, 2024
1 parent 16b3f51 commit 3387238
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ A detailed summary is available in the [reference section of the documentation](

# Getting started
[A getting started tutorial](https://github.com/FAIRmat-NFDI/pynxtools-apm/tree/main/examples) is offered that guides you
how to use the apm reader for converting your data to NeXus from a Jupyter notebook. Note that not every combination of
supported file formats and input for the parser allows to fill required and recommended fields and attributes of the NXapm
application definition. Therefore, you may need to provide an ELN file that contains the missing values in order for the
how to use the apm reader for converting your data to NeXus using a Jupyter notebook. That notebook details also the commands how to convert data via command line calls. Note that not every combination of input from a supported file format and other, typically electronic lab notebook, input for the parser allows filling the required and recommended fields and attributes of the NXapm application definition.
Therefore, you may need to provide an ELN file that contains the missing values in order for the
validation step of the APM reader to pass.

# Contributing
Expand All @@ -49,7 +48,7 @@ git clone https://github.com/FAIRmat-NFDI/pynxtools-apm.git --branch main --recu
cd pynxtools_apm
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install -e ".[dev]"
python -m pip install -e ".[dev,docs]"
```

<!---There is also a [pre-commit hook](https://pre-commit.com/#intro) available
Expand All @@ -71,4 +70,4 @@ python -m pytest -sv tests
```

## Contact person in FAIRmat for this reader
Markus Kühbach
[Markus Kühbach](https://www.fairmat-nfdi.eu/fairmat/about-fairmat/team-fairmat)
9 changes: 7 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ jsonschema[format-nongpl]==4.21.1
jsonschema-specifications==2023.12.1
# via jsonschema
jupyter==1.0.0
# via ifes-apt-tc-data-modeling
# via
# ifes-apt-tc-data-modeling
# pynxtools-apm (pyproject.toml)
jupyter-client==8.6.1
# via
# ipykernel
Expand Down Expand Up @@ -186,8 +188,11 @@ jupyterlab==4.1.7
# via
# ifes-apt-tc-data-modeling
# notebook
# pynxtools-apm (pyproject.toml)
jupyterlab-h5web==12.1.0
# via ifes-apt-tc-data-modeling
# via
# ifes-apt-tc-data-modeling
# pynxtools-apm (pyproject.toml)
jupyterlab-pygments==0.3.0
# via nbconvert
jupyterlab-server==2.27.1
Expand Down
4 changes: 2 additions & 2 deletions examples/HowToUseTutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"* **apm.oasis.specific.yaml** frequently used metadata that are often the same for many datasets to avoid having to<br>\n",
" type it every time in ELN templates. This file can be considered a configuration file whereby e.g. coordinate system<br>\n",
" conventions can be injected or details about the atom probe instrument communicated if that is part of frequently used<br>\n",
" lab equipment. The benefit of such an approach is that eventual all relevant metadata to an instrument can be read from\n",
" lab equipment. The benefit of such an approach is that eventual all relevant metadata to an instrument can be read from<br>\n",
" this configuration file via guiding the user e.g. through the ELN with an option to select the instrument.<br>\n",
"* **reconstructed ion positions** in community, technology partner format with<br>\n",
" the ion positions and mass-to-charge state ratio values for the tomographic reconstruction.<br>\n",
Expand Down Expand Up @@ -238,7 +238,7 @@
"metadata": {},
"source": [
"### Contact person for pynxtools-apm and related examples in FAIRmat:\n",
"Dr.-Ing. Markus Kühbach, 2024/04/18<br>\n",
"Dr.-Ing. Markus Kühbach, 2024/05/10<br>\n",
"\n",
"### Funding\n",
"<a href=\"https://www.fairmat-nfdi.eu/fairmat\">FAIRmat</a> is a consortium on research data management which is part of the German NFDI.<br>\n",
Expand Down
6 changes: 3 additions & 3 deletions pynxtools_apm/config/eln_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

APM_INSTRUMENT_STATIC_TO_NEXUS = {
"prefix_trg": "/ENTRY[entry*]/measurement/instrument",
"prefix_src": "atom_probe/",
"prefix_src": "instrument/",
"map": [("analysis_chamber/flight_path", "nominal_flight_path/value")],
"map_to_str": [
"status",
Expand All @@ -105,7 +105,7 @@

APM_INSTRUMENT_DYNAMIC_TO_NEXUS = {
"prefix_trg": "/ENTRY[entry*]/measurement/event_data_apm_set/EVENT_DATA_APM[event_data_apm]/instrument",
"prefix_src": "atom_probe/",
"prefix_src": "instrument/",
"use": [("control/target_detection_rate/@units", "ions/pulse")],
"map": [
("control/target_detection_rate", "target_detection_rate"),
Expand Down Expand Up @@ -180,7 +180,7 @@
APM_IDENTIFIER_TO_NEXUS = {
"prefix_trg": "/ENTRY[entry*]/USER[user*]",
"use": [
("IDENTIFIER[identifier]/is_persistent", False),
("IDENTIFIER[identifier]/is_persistent", True),
("IDENTIFIER[identifier]/service", "orcid"),
],
"map_to_str": [
Expand Down
4 changes: 2 additions & 2 deletions pynxtools_apm/utils/create_nx_default_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def create_default_plot_reconstruction(template: dict, entry_id: int) -> dict:
axes = []
for dim in dims:
axes.append(f"axis_{dim}")
template[f"{trg}@AXISNAME_indices[axis_{dim}]"] = np.uint32(col)
template[f"{trg}@AXISNAME_indices[axis_{dim}_indices]"] = np.uint32(col)
col += 1
template[f"{trg}@axes"] = axes

Expand Down Expand Up @@ -169,7 +169,7 @@ def create_default_plot_mass_spectrum(template: dict, entry_id: int) -> dict:
)
template[f"{trg}@signal"] = "intensity"
template[f"{trg}@axes"] = "axis_mass_to_charge"
template[f"{trg}@AXISNAME_indices[axis_mass_to_charge]"] = np.uint32(0)
template[f"{trg}@AXISNAME_indices[axis_mass_to_charge_indices]"] = np.uint32(0)
template[f"{trg}DATA[intensity]"] = {
"compress": np.asarray(hist1d[0], np.uint32),
"strength": 1,
Expand Down
6 changes: 3 additions & 3 deletions pynxtools_apm/utils/oasis_eln_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ def parse_instrument_dynamic(self, template: dict) -> dict:
def parse_pulser_source(self, template: dict) -> dict:
"""Copy data into the (laser)/source section of the pulser."""
# additional laser-specific details only relevant when the laser was used
if "atom_probe/pulser/pulse_mode" in self.yml:
if self.yml["atom_probe/pulser/pulse_mode"] == "voltage":
if "instrument/pulser/pulse_mode" in self.yml:
if self.yml["instrument/pulser/pulse_mode"] == "voltage":
return template

src = "atom_probe/pulser/laser_source"
src = "instrument/pulser/laser_source"
if src in self.yml.keys():
if isinstance(self.yml[src], list):
if all(isinstance(entry, dict) for entry in self.yml[src]) is True:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ dev = [
"pytest",
"types-pyyaml",
"pip-tools",
"jupyter",
"jupyterlab",
"jupyterlab-h5web"
]

[project.entry-points."pynxtools.reader"]
Expand Down

0 comments on commit 3387238

Please sign in to comment.