[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4715880.svg)](https://doi.org/10.5281/zenodo.4715880)
# 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.
![background](https://cloud.githubusercontent.com/assets/873520/14958064/02be1a30-1089-11e6-8f2d-61b458e4cc0d.png)
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.
![gui](https://cloud.githubusercontent.com/assets/873520/14958063/029e912e-1089-11e6-9ffc-976ddbf1f992.png)
## 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/stefsmeets/lines",
"name": "xpdlines",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "plotting,powder-diffraction,background-correction,profile-refinement",
"author": "Stef Smeets",
"author_email": "s.smeets@esciencecenter.nl",
"download_url": "https://files.pythonhosted.org/packages/ec/68/4dc289ceb56591de92f5b8e7c46fcc3980600c769b722ddcfed1558b84ec/xpdlines-2.0.1.tar.gz",
"platform": null,
"description": "[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4715880.svg)](https://doi.org/10.5281/zenodo.4715880)\n\n# Lines\n\nLines 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. \n\n## Background correction\n\nThe background of any pattern (.xy or .xye format) can be corrected with:\n\n lines pattern.xye --bgcorrect 1\n\nThen 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~.\n\nIt is then possible to continue the background correction process by loading in the points from the file lines.out like this:\n\n\tlines pattern.xye --bgcorrect 1 --bgin lines.out\n\nIt 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:\n\n Out_X_Yobs(x_yobs.xy)\n Out_X_Ycalc(x_ycalc.xy)\n Out_X_Difference(x_ydiff.xy)\n\nThen, to start the background correct prodecure:\n\n lines pattern.xye --bgcorrect 1 --bgin lines.out --topasbg\n\nThe 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.\n\n![background](https://cloud.githubusercontent.com/assets/873520/14958064/02be1a30-1089-11e6-8f2d-61b458e4cc0d.png)\n\nSince 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.\n\n## GUI\n\nOn 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`.\n\nPressing 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.\n\n![gui](https://cloud.githubusercontent.com/assets/873520/14958063/029e912e-1089-11e6-9ffc-976ddbf1f992.png)\n\n## Requirements\n\nIn brackets are known working versions.\n\n- Python 3.9+\n- numpy (1.24.1)\n- scipy (1.10.0)\n- matplotlib (3.6.3)\n\n## Installation\n\n```bash\npip install xpdlines\n```\n\nOr, to install the latest version from this repository:\n\n\n```bash\npip install git+https://github.com/stefsmeets/lines\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "A program for plotting powder diffraction patterns and background subtraction",
"version": "2.0.1",
"split_keywords": [
"plotting",
"powder-diffraction",
"background-correction",
"profile-refinement"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c9810bdbee5d16c7a122094cd12828ea90a2e606388d982f181737ec9a31d7f0",
"md5": "c7eced815fc2128b90023e642ef30906",
"sha256": "9e778a24c7a0180bf06fd28971eab3c5e95b6c1445891c308105a58fc4f59336"
},
"downloads": -1,
"filename": "xpdlines-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c7eced815fc2128b90023e642ef30906",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 36985,
"upload_time": "2023-01-16T15:18:07",
"upload_time_iso_8601": "2023-01-16T15:18:07.009756Z",
"url": "https://files.pythonhosted.org/packages/c9/81/0bdbee5d16c7a122094cd12828ea90a2e606388d982f181737ec9a31d7f0/xpdlines-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ec684dc289ceb56591de92f5b8e7c46fcc3980600c769b722ddcfed1558b84ec",
"md5": "4d201b79086bbc6fe1519ff4c8b814fe",
"sha256": "318cfa3dafdad62cd5f511dbf849c07cd44251e26b072431305d1cb78d9f1e0e"
},
"downloads": -1,
"filename": "xpdlines-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "4d201b79086bbc6fe1519ff4c8b814fe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37724,
"upload_time": "2023-01-16T15:18:09",
"upload_time_iso_8601": "2023-01-16T15:18:09.080518Z",
"url": "https://files.pythonhosted.org/packages/ec/68/4dc289ceb56591de92f5b8e7c46fcc3980600c769b722ddcfed1558b84ec/xpdlines-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-16 15:18:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "stefsmeets",
"github_project": "lines",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "xpdlines"
}