xpdlines
A program for plotting powder diffraction patterns and background subtraction
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
✓Committers with academic emails
2 of 6 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords
Repository
A program for plotting powder diffraction patterns and background subtraction
Basic Info
Statistics
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
- Releases: 3
Topics
Metadata Files
readme.md
Lines
Lines is a program for plotting powder diffraction patterns, and was initially developed for interactively modifying the background during the course of a Rietveld refinement with XRS-82 (Baerlocher, 1982). The modern way of removing backgrounds is by fitting a Chebyshev polynomial during the course of the Rietveld refinement. In practice, this method is unreliable when doing a Pawley or Le Bail fit, and offers little control over the shape of the background during a Rietveld refinement.
Background correction
The background of any pattern (.xy or .xye format) can be corrected with:
lines pattern.xye --bgcorrect 1
Then by clicking on the figure, the background can be specified. By closing the program, a list of X and Y coordinates is printed to console and written to the file lines.out. The command line option --bgcorrect 1 tells the program to perform a linear background correction, and print the corrected file to pattern_corr.xy. Lines respects your standard deviations and never overwrites the original data. The background points are by default written to the file lines.out. In case this file exists, the original is backed up to lines.out~.
It is then possible to continue the background correction process by loading in the points from the file lines.out like this:
lines pattern.xye --bgcorrect 1 --bgin lines.out
It is also possible to perform the background correction while doing a refinement with TOPAS. In order to do so, the observed, calculated and difference plot should be output from TOPAS with the following commands:
Out_X_Yobs(x_yobs.xy)
Out_X_Ycalc(x_ycalc.xy)
Out_X_Difference(x_ydiff.xy)
Then, to start the background correct prodecure:
lines pattern.xye --bgcorrect 1 --bgin lines.out --topasbg
The option --topasbg will tell the program to read the observed, calculated and difference plots and --bg_in lines.out will load previously saved background points from the file lines.out.

Since its inception, many functions for operations performed on powder diffraction data have been implemented. A number of different file formats can be read and visualized in numerous ways. Further options for diffraction pattern manipulation include the options to adjust the wavelength of the diffraction data, or to re-bin, normalize, and smooth them. All the functions are documented in the help file, which can be accessed via lines --help.
GUI
On Windows, a GUI for the background subtraction is available. It is accessible via the lines_bg.bat file in the bin directory or by typing lines gui.
Pressing run opens an instance of lines where the background can be modified. By closing the plot window, and the corrected and background patterns will be written.

Requirements
In brackets are known working versions.
- Python 3.9+
- numpy (1.24.1)
- scipy (1.10.0)
- matplotlib (3.6.3)
Installation
bash
pip install xpdlines
Or, to install the latest version from this repository:
bash
pip install git+https://github.com/stefsmeets/lines
Citation (CITATION.cff)
# YAML 1.2
---
authors:
-
family-names: Smeets
given-names: Stef
orcid: "https://orcid.org/0000-0002-5413-9038"
cff-version: "1.1.0"
date-released: 2023-01-16
doi: "10.5281/zenodo.4715908"
keywords:
- "Plotting"
- "Powder diffraction"
- "Background subtraction"
- "Crystallography"
- "Profile refinement"
license: "MIT"
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/stefsmeets/lines"
title: lines
version: "2.0.1"
...
GitHub Events
Total
Last Year
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 144
- Total Committers: 6
- Avg Commits per committer: 24.0
- Development Distribution Score (DDS): 0.403
Top Committers
| Name | Commits | |
|---|---|---|
| Stef Smeets | s****s@m****h | 86 |
| Stef Smeets | s****s@e****l | 23 |
| Stef Smeets | s****s@m****e | 19 |
| Stef Smeets | s****s@u****m | 14 |
| Edward Betts | e****d@4****m | 1 |
| Stef Smeets | S****e@v****h | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 2
- Total pull requests: 2
- Average time to close issues: about 1 hour
- Average time to close pull requests: about 15 hours
- Total issue authors: 2
- Total pull request authors: 2
- Average comments per issue: 1.5
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stefsmeets (1)
- Charlaiz (1)
Pull Request Authors
- stefsmeets (1)
- EdwardBetts (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 12 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
pypi.org: xpdlines
A program for plotting powder diffraction patterns and background subtraction
- Homepage: https://github.com/stefsmeets/lines
- Documentation: https://github.com/stefsmeets/lines
- License: MIT License
-
Latest release: 2.0.1
published about 3 years ago