A Streamlit web application that provides an interactive interface to preprocess and analyze .chi files using PDFgetX3. The app enables file upload, parameter customization, plotting, and visualization of processed outputs such as S(q), F(q), and G(r).
- Upload
.chidata and background files - Select and preview uploaded files
- Customize preprocessing parameters:
- Data format, wavelength, Q-range, R-range, etc.
- Interactive Q vs I plot
- Automatically generate
pdfgetx3.cfg - Run
pdfgetx3via the app backend - Visualize and download processed outputs:
.fq,.sq, and.grplots
- One-click cleanup for uploaded data
Make sure you have the following installed:
- Python ≥ 3.7
- PDFgetX3
- Required Python packages:
pip install streamlit plotly numpyYou must also ensure pdfgetx3 is available in your system’s $PATH or installed via conda:
conda install -c diffpy pdfgetx3pdf_processor_app/
│
├── pdfapp.py # Streamlit app
├── pdfgetx3.cfg # Template config file (will be modified per run)
├── pdfgetx3_temp/ # Temporary directory for processing (created automatically)
├── data_chi_files/ # Stores uploaded data files (created automatically)
├── LICENSE # Details on MIT license
└── README.md # You're reading it!
streamlit run pdfapp.py- Upload multiple data files (
.chi) and a background file (.chi). - Select one of the data files from the dropdown.
- Optionally, upload a json configuration file to set parameters from a previous run.
- Input material composition (e.g.,
C8N2H22PbI4) - Choose:
- Data format:
twotheta,QA, orQnm - Wavelength
- Q-range and R-range
- rstep, rpoly, qmaxinst
- Data format:
The app runs automatically.
Expand the tabs to
- modify background subtraction
- Display:
- Q vs I plot
- F(q), S(q), G(r) plots
- Downloadable output files
Click "Clear uploaded data files" to clean up temporary files and reset the session.
The app generates:
.fq→ Fourier transformed function F(Q).sq→ Structure factor S(Q).gr→ Real-space pair distribution function G(r).json→ Configuration file with parameters used for processing
The PDF output files can be visualized directly within the app and downloaded.
st.file_uploader()– Upload and store data/background filespdfgetx3.cfg– Configuration file for PDFgetX3, auto-modifiedrun_command()– Executes shell command forpdfgetx3plot_chi_file()andplot_gr_file()– Plotting utilities for uploaded and processed data
pdfgetx3must be installed and callable in the shell. Before running the streamlit command, please make sure pdfgetx3 works fine, by running:pdfgetx3 --version- Common issues with pdfgetx3 installation can usually be fixed by correcting the required python version (at the time of writing, pdfgetx3 requires Python v3.8). The python version can be checked by running:
python --version - The
pdfgetx3.cfgfile should be available in the app directory and will be modified on-the-fly. - This app creates two working folders:
pdfgetx3_temp/– Temporary for each rundata_chi_files/– Stores uploaded.chifiles
All temporary data files are stored locally and can be deleted manually or via the Clear uploaded data files button.
This project is open-source and free to use for academic or personal research purposes (see LICENSE for more info).