Skip to main content

plaid is a simple visualization tool intended to quickly evaluate azimuthally integrated powder diffraction data

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plaid_xrd-0.0.13.tar.gz (852.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plaid_xrd-0.0.13-py3-none-any.whl (880.8 kB view details)

Uploaded Python 3

File details

Details for the file plaid_xrd-0.0.13.tar.gz.

File metadata

  • Download URL: plaid_xrd-0.0.13.tar.gz
  • Upload date:
  • Size: 852.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plaid_xrd-0.0.13.tar.gz
Algorithm Hash digest
SHA256 454e3d9a3fbc8257587b48cc1bd5212368b2b5a77f911507d5647ec46a67e38f
MD5 f6f9a372a76da04cc1c378361c727460
BLAKE2b-256 28f40b3ce3a502ca5ef808417da62f3b973e7238d57fd5685fe174c7a6bfda08

See more details on using hashes here.

File details

Details for the file plaid_xrd-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: plaid_xrd-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 880.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plaid_xrd-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 30310c095c420cb5aa07fa438b2c70f86cb17c6694e6f4ede76360f35f76369a
MD5 f27f55fd58d3fa89cf56cd8068c6dcea
BLAKE2b-256 17d7f232685497c0543d26331acbb7dd78d785193c1eda3b2e4a6069a5ea2d21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page