-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bring-in-examples' of github.com:FAIRmat-NFDI/pynxtools…
…-mpes into bring-in-examples
- Loading branch information
Showing
11 changed files
with
136 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
prune * | ||
exclude * | ||
recursive-include pynxtools_mpes *.py | ||
include pyproject.toml README.md dev-requirements.txt | ||
recursive-include src/pynxtools_mpes *.py | ||
include pyproject.toml README.md dev-requirements.txt | ||
recursive-include src/pynxtools_mpes/nomad/examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Copyright The NOMAD Authors. | ||
# | ||
# This file is part of NOMAD. See https://nomad-lab.eu for further info. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
"""Entry points for mpes examples.""" | ||
|
||
try: | ||
from nomad.config.models.plugins import ExampleUploadEntryPoint | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Could not import nomad package. Please install the package 'nomad-lab'." | ||
) from exc | ||
|
||
mpes_example = ExampleUploadEntryPoint( | ||
title="Multidimensional photoemission spectroscopy (MPES)", | ||
category="FAIRmat examples", | ||
description=""" | ||
This example presents the capabilities of the NOMAD platform to store and standardize multidimensional photoemission spectroscopy (MPES) experimental data. It contains three major examples: | ||
- Taking a pre-binned file, here stored in a h5 file, and converting it into the standardized MPES NeXus format. | ||
There exists a [NeXus application definition for MPES](https://manual.nexusformat.org/classes/contributed_definitions/NXmpes.html#nxmpes) which details the internal structure of such a file. | ||
- Binning of raw data (see [here](https://www.nature.com/articles/s41597-020-00769-8) for additional resources) into a h5 file and consecutively generating a NeXus file from it. | ||
- An analysis example using data in the NeXus format and employing the [pyARPES](https://github.com/chstan/arpes) analysis tool to reproduce the main findings of [this paper](https://arxiv.org/pdf/2107.07158.pdf). | ||
""", | ||
path="nomad/examples", | ||
local_path="examples/data/uploads/mpes.zip", | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# Copyright The NOMAD Authors. | ||
# | ||
# This file is part of NOMAD. See https://nomad-lab.eu for further info. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
"""Test for NOMAD examples in reader plugins.""" | ||
|
||
import pytest | ||
|
||
try: | ||
from nomad.parsing.parser import ArchiveParser | ||
from nomad.datamodel import EntryArchive, Context | ||
except ImportError: | ||
pytest.skip( | ||
"Skipping NOMAD example tests because nomad is not installed", | ||
allow_module_level=True, | ||
) | ||
|
||
from pynxtools.testing.nomad_example import get_file_parameter, test_nomad_example | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mainfile", get_file_parameter("../src/pynxtools_mpes/nomad/examples") | ||
) | ||
def test_nomad_examples(mainfile, no_warn): | ||
"""Test if NOMAD examples work.""" | ||
test_nomad_example(mainfile) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"config, expected_local_path", | ||
[ | ||
pytest.param( | ||
{ | ||
"title": "mpes_example", | ||
"description": "mpes_example", | ||
"category": "test", | ||
"path": "nomad/examples", | ||
}, | ||
f"examples/data/uploads/mpes.zip", | ||
id="mpes_example", | ||
), | ||
], | ||
) | ||
def test_nomad_example_upload_entry_point_valid(config, expected_local_path): | ||
test_example_upload_entry_point_valid( | ||
plugin_package="pynxtools-mpes", | ||
config=config, | ||
expected_local_path=expected_local_path, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters