Tutorial: Your First PDF Workflow#
This tutorial mirrors the command-line guide but takes a more narrative approach aimed at new users.
You will execute the demo workflow against a small input file and inspect the outputs.
1. Set up the environment#
python -m venv .venv
source .venv/bin/activate
pip install ewoks ewokspdf diffpy.pdfgetx
Replace the last command with the wheel path of
diffpy.pdfgetxwhen working offline.
2. Acquire sample data#
Download or generate an integrated XRPD dataset as an HDF5 file that contains an NXdata group.
Copy the provided
examples/pdfgetx.cfg(or your beamline template) alongside the dataset.
For quick experiments you can adapt a BLISS dataset—only the NXdata signal and configuration are required.
3. Launch the workflow from Python#
You can run the same sequence manually without the Ewoks runner:
from ewokspdf.tasks.average import PdfGetXAverage
from ewokspdf.tasks.config import PdfGetXConfig
from ewokspdf.tasks.processor import PdfGetXProcessor
from ewokspdf.tasks.save_ascii import PdfGetXSaveAscii
from ewokspdf.tasks.save_nexus import PdfGetXSaveNexus
average = PdfGetXAverage()
average(nxdata_url="silx:///data/integrated.h5::/entry/scan/data", average_every="all")
config = PdfGetXConfig()
config(filename="/data/pdfgetx.cfg")
processor = PdfGetXProcessor()
processor(radial=average.outputs.radial,
intensity=average.outputs.intensity,
info=average.outputs.info,
pdfgetx_options=config.outputs.pdfgetx_options)
save_ascii = PdfGetXSaveAscii()
save_ascii(filename="/tmp/pdf/results.h5",
results=processor.outputs.results,
info=processor.outputs.info)
save_nexus = PdfGetXSaveNexus()
save_nexus(nxdata_url="silx:///tmp/pdf/results.h5::/entry/1.1/",
results=processor.outputs.results,
pdfgetx_options=processor.outputs.pdfgetx_options,
info=processor.outputs.info)
This mirrors exactly what the Ewoks workflow does and is convenient for notebook-based prototyping.
4. Explore the results#
Open the ASCII files with your favorite plotting tool to inspect
F(Q)orG(r).Launch
silx view /tmp/pdf/results.h5to look at the NeXus output structure.
5. Iterate#
Try changing
average.average_everyto2to compare stacked PDFs.Override parameters such as
qmaxby adding them toconfig.pdfgetx_options_dict.Experiment with different datasets to familiarise yourself with the workflow behaviour.
Once comfortable, adapt the JSON or replicate the pipeline in a graphical Ewoks workspace.