Skip to content

ePSIC-DLS/mib2x-crt

Repository files navigation

Container for MIB conversion

This repository contains scripts to build a container for MIB conversion at ePSIC by using Podman and/or Buildah. You can use podman --version and buildah --version to see if they are installed.

Build with Podman and Buildah

By using the build.sh script, it uses Podman to first build the required packages and then uses Buildah to copy only the necessary packages from the builder image to a very small image, which does not contain a package manager. This requires the host to have dnf installed, the package manager.

It is recommended to use this approach as it produces (almost) the smallest image possible:

buildah unshare ./build.sh

Build with Podman only

You can also use Podman only to build the container. The image will be slightly larger as the final base image has the package manager installed. This uses the Dockerfile to build the image:

podman build --format docker -t mib2x .

Launch the container

You can find the container by

podman images

To have an interactive shell of the container, you can do

podman run --rm -it localhost/mib2x:latest sh

Perform MIB conversion

To perform the MIB conversion, you can do

podman run --rm -v <VISIT>:<VISIT> localhost/mib2x python mib_convert.py
"$(cat request.json)"

The -v flag mounts the visit on the container. For example if you want to convert .mib file in /dls/e02/data/2024/cm37231-4/:

podman run --rm -v /dls/e02/data/2024/cm37231-4/:/dls/e02/data/2024/cm37231-4/
localhost/mib2x python mib_convert.py "$(cat request.json)"

If you want to run in debug mode, you can set the environment variable M2X_DEBUG to 1 by using -e 'M2X_DEBUG=1' when you use podman run. This will save the output file under <VISIT>/processing/debug/ instead of <VISIT>/processing.

The script mib_convert.py takes a single argument which is a json blob with all the necessary information. The above request.json file could look like:

{
  "mib_path": "/dls/e02/data/2024/cm37231-4/Merlin/WS2_n_fred_40um/20240821_150039/20240821_150035_data.mib",
  "no_reshaping": 0,
  "use_fly_back": 1,
  "known_shape": 0,
  "Scan_X": 256,
  "Scan_Y": 256,
  "iBF": 1,
  "bin_sig_flag": 1,
  "bin_sig_factor": 4,
  "bin_nav_flag": 1,
  "bin_nav_factor": 4,
  "create_json": 1,
  "ptycho_config": "",
  "ptycho_template": ""
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published