Skip to content
Snippets Groups Projects
Commit 9530787e authored by Florian Dobener's avatar Florian Dobener
Browse files

Merge branch 'fix-mpes-test' into 'develop'

Don't execute curl in mpes example

See merge request !155
parents b0f4c076 aa1e264c
No related branches found
No related tags found
1 merge request!155Don't execute curl in mpes example
Pipeline #182395 passed
......@@ -71,8 +71,8 @@ stages:
build main:
extends: .build
script:
- docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME} || true
- docker tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME} ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || true
- docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:develop || true
- docker tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:develop ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || true
- docker build -t ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} .
- docker push ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG}
timeout: 2h
......@@ -87,8 +87,8 @@ build main:
build dockerfile:
extends: .build
script:
- docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME} || true
- docker tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME} ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || true
- docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:develop || true
- docker tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:develop ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} || true
- docker build -t ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG} -f ${DOCKERFILE} .
- docker push ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${DOCKER_TAG}
resource_group: build_containers
......
%% Cell type:markdown id: tags:
# Converting Multidimensional Photoemission Spectroscopy (MPES) data into the NeXus format
%% Cell type:markdown id: tags:
This example shows how to convert x-array based h5 measurement files as generated by the [preprocessing output](https://www.nature.com/articles/s41597-020-00769-8) of the software used at the Fritz-Haber Institute into the [MPES NeXus format](https://manual.nexusformat.org/classes/contributed_definitions/NXmpes.html#nxmpes).
For an example on how to generate such a h5 measurement file please refer to the [binning example](./E2%20Binning%20of%20WSe2.ipynb).
%% Cell type:markdown id: tags:
## Download the data
Since the provided datafile is comparably large (~200MB) it is not directly provided with the example.
You can [download](https://zenodo.org/record/7573825/files/MoTe2.h5?download=1) it from zenodo. Place the file in the directory of this notebook afterwards. Under Linux, macOS and in a NORTH container you can directly use the cell below to download the file with curl.
%% Cell type:code id: tags:
%% Cell type:code id: tags:skip-execution
``` python
! curl -o MoTe2.h5 "https://zenodo.org/record/7573825/files/MoTe2.h5?download=1"
```
%% Cell type:markdown id: tags:
## Convert the file to NeXus
To convert the available files to the NeXus format we use the convert function readily supplied by pynxtools.
It uses the downloaded measurement file, a json config file and optionally an electronic lab notebook (ELN) yaml file that is used in the [binning of WSe2 example](./E2%20Binning%20of%20WSe2.ipynb).
The json config file maps specific metadata from the h5 measurement file to the nxs file, i.e. a pressure reading which automatically gets collected during measurement.
The ELN is a file which supplies additional metadata which is written into the NeXus file.
This is data which is not collected automatically, such as the person conducting the experiment.
It can be written manually or generated, e.g. by the NOMAD ELN functionality.
The convert command may also be executed in the command line with the command `dataconverter`:
```
dataconverter \
--reader mpes \
--nxdl NXmpes \
--input-file MoTe2.h5 \
--input-file config_file.json \
--output MoTe2.mpes.nxs
```
%% Cell type:code id: tags:
``` python
from pynxtools.dataconverter.convert import convert
```
%% Cell type:markdown id: tags:
The input parameters are defined as follows:
**reader**: The specific reader which gets called inside pynxtools. This is supplied in the pynxtools python code. If you create a specific reader for your measurement file it gets selecetd here. If you use the binning procedure from FHI to generate a xarray h5 file you should use the reader called `mpes`.
**nxdl**: The specific nxdl file to be used. For MPES this should always be `NXmpes` or one of its subdefinitions of the form `NXmpes_<name>`.
**output**: The output filename of the NeXus file.
%% Cell type:code id: tags:
``` python
convert(input_file=["MoTe2.h5", "config_file.json"],
reader='mpes',
nxdl='NXmpes',
output='MoTe2.mpes.nxs')
```
%% Cell type:markdown id: tags:
## View the data with H5Web
H5Web is a tool for visualizing any data in the h5 data format. Since the NeXus format builds opon h5 it can be used to view this data as well. We just import the package and call H5Web with the output filename from the convert command above. For an analysis on NeXus data files please refer to [analysis example](./E3%20pyARPES%20analysis.ipynb).
You can also view this data with the H5Viewer or other tools from your local filesystem.
%% Cell type:code id: tags:
``` python
from jupyterlab_h5web import H5Web
```
%% Cell type:code id: tags:
``` python
H5Web('MoTe2.mpes.nxs')
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment