Skip to main content

plaid - plaid looks at integrated data

plaid is a simple visualization tool intended to quickly evaluate azimuthally integrated powder diffraction data and compare to known structures, provided by the user in the form of CIF files.
The main data format is HDF5 files, inspired by the NeXus file formats.

Installation

You can install plaid using pip (PyPi). For most users, the following command is all you need:

pip install plaid-xrd

Tip:
For a cleaner Python setup, you can use a virtual environment to keep your packages organized. This is optional, but recommended if you work on multiple Python projects.

To create and activate a virtual environment (optional):

Show virtual environment instructions

Windows:

python -m venv plaid-env
plaid-env\Scripts\activate

macOS/Linux:

python3 -m venv plaid-env
source plaid-env/bin/activate

If you are unsure which Python interpreter to use, you might need to specify the full path. You can find your Python path by running:

where python   # on Windows
which python   # on macOS/Linux

Once your environment is ready, install plaid as shown above.

Start the application from a terminal with:

plaid

or you can run:

plaid -h

to see a list of available command-line arguments and options for plaid.

Using plaid to read nxazint HDF5 files

plaid is intended as a visualization tool, but the plaid.nexus module can also be used as a library of convienience functions for reading nxazint files. The plot_nxazint_demo.ipynb jupyter notebook demonstrate how the plaid.nexus module can be used to read and plot 1D and 2D diffraction data from a multi-modal nxazint file.

import h5py as h5
import plaid.nexus as pnx
import matplotlib.pyplot as plt

fname = "tests/scan-0100_multi_demo.h5" # your file name
# open the file with h5py
with h5.File(fname,'r') as f: 
    # get the nxazint1d entry (or subentry)
    azint1d = pnx.get_nx_entry(f,definition='NXazint1d')
    
    # get the axes group - radial axis (2theta or Q) is the last index
    axes_gr = pnx.get_nx_axes(azint1d)
    x = axes_gr[-1][:]
        
    # get the signal group i.e. the intensity
    signal_gr = pnx.get_nx_signal(azint1d)
    I = signal_gr[:]

# plot the first diffraction pattern
plt.figure()
plt.plot(x,I[0])
plt.show()       

Example

The main window of plaid

  • Drag/drop an .h5 file into the main window or browse from File -> Open
  • Change the pattern by moving the horizontal lines with the mouse or the arrow keys
  • Add a new moveable line by double-clicking the heatmap, remove a line by right-clicking it
  • Click the symbols in the pattern legend to show/hide the patterns
  • Drag/drop a .cif file into the main window or browse from File -> Load CIF
  • Click on a reference line to show its reflection index

File tree context menu

  • Right-click on a file in the file tree to add $I_0$ or auxiliary data
  • Right-click on two or more selected files to group them

Export patterns

  • Save the export settings in Export -> Export settings

Hotkeys

Key Action
L Toggle log scale for the heatmap
Q Toggle between q and 2θ axes
C Show/hide the auto-correlation map
M Show/hide the diffraction map
B Subtract the active pattern as background
↑ Move the active line one frame up
↓ Move the active line one frame down
← Move the active line several frames down
→ Move the active line several frames up

Example Files (Zenodo)

Example files made available by MAX IV Laboratory, can be found on Zenodo.

LaB6.h5

Minimal NXazint1d file example. PXRD data from a LaB6 sample. 10 frames, 3000 radial bins.

BTO.h5

NXazint1d file example, including I0 monitor, sample temperature (not calibrated), and time. Variable temperature PXRD data from a BaTiO3 sample. 500 frames, 3000 radial bins.

Magnet.h5

NXazint2d file example, including I0 monitor, and sample rotation. PXRD data from a ferrite fridge magnet. Omega scan -45 -> 45 deg, 1 deg omega step, (right-handed rotation). 2000 radial bins, 180 azimuthal bins.

Magnet_multi.h5

Combined NXazint1d and NXazint2d file example, including I0 monitor and sample rotation. PXRD data from a ferrite fridge magnet. Omega scan -45 -> 45 deg, 1 deg omega step, (right-handed rotation). 2000 radial bins, 180 azimuthal bins.

Magnet_low_res.h5

Small NXazint2d file example, including I0 monitor, and sample rotation. PXRD data from a ferrite fridge magnet. Omega scan 0 - 45 deg, 2 deg omega step, (right-handed rotation), 2000 radial bins, 36 azimuthal bins.

Pinapple.h5

NXazint1d mapping file example, including I0 monitor, and sample position. PXRD data from a scale of a pineapple mapped with a focused beam. 36055 diffractograms, each with 2000 radial bins.

Metadata

Release files for plaid-xrd 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plaid-xrd 1.1.0
File Size Uploaded
plaid_xrd-1.1.0.tar.gz 861.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plaid-xrd 1.1.0
File Interpreter ABI Platform
plaid_xrd-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / plaid_xrd-1.1.0.tar.gz

Download URL plaid_xrd-1.1.0.tar.gz
Size 861.1 kB
Tags Source
SHA-256 checksum
How to use checksums
250e4d9a4a2a7b1aeeaca5433ce77076b3796d4704b2cd5eb981882a5ff0899e
BLAKE2b-256 checksum
How to use checksums
30ab05b8a64813f8c25767a05c26a94774da6b0fdf457dde0df5de397dbfb059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / plaid_xrd-1.1.0-py3-none-any.whl

Download URL plaid_xrd-1.1.0-py3-none-any.whl
Size 889.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
459a56d70a0e56a0f242df9c200b9b51976b785d6273e19cbb53eee2f9746a0c
BLAKE2b-256 checksum
How to use checksums
8a93f22d32d2b19c7d658f57046e7ffd973798936d7a420aba7fa559b16724eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page