Skip to content

Commit aaa89ed

Browse files
MANIFEST.in, README.rst, pyproject.toml, tests/conftest.py
1 parent f788f68 commit aaa89ed

File tree

4 files changed

+85
-4
lines changed

4 files changed

+85
-4
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ graft tests
33
graft requirements
44

55
include AUTHORS.rst LICENSE*.rst README.rst
6+
include src/diffpy/labpdfproc/data *
67

78
# Exclude all bytecode files and __pycache__ directories
89
global-exclude *.py[cod] # Exclude all .pyc, .pyo, and .pyd files.

README.rst

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,28 @@
3737

3838
Tools for processing x-ray powder diffraction data from laboratory sources.
3939

40-
* LONGER DESCRIPTION HERE
40+
PDFgetX3 has revolutionized how PDF methods can be applied to solve nanostructure problems.
41+
However, the program was designed for use with Rapid Acquisition PDF (RAPDF) data from synchrotron sources.
42+
A key approximation inherent in the use of PDFgetX3 for RAPDF data is that absorption effects are negligible.
43+
This is typically not the case for laboratory x-ray diffractometers, where absorption effects can be significant.
44+
45+
This app is designed to preprocess data from laboratory x-ray diffractometers before using PDFgetX3 to obtain PDFs.
46+
The app currently carries out an absorption correction assuming a parallel beam capillary geometry
47+
which is the most common geometry for lab PDF measurements.
48+
49+
The theory is described in the following paper:
50+
51+
An ad hoc Absorption Correction for Reliable
52+
Pair-Distribution Functions from Low Energy x-ray Sources,
53+
Yucong Chen, Till Schertenleib, Andrew Yang, Pascal Schouwink,
54+
Wendy L. Queen and Simon J. L. Billinge, in preparation.
55+
56+
The related experimental data acquisition protocols are described in the following paper:
57+
58+
Protocols for Obtaining Reliable PDFs from Laboratory
59+
x-ray Sources Using PDFgetX3,
60+
Till Schertenleib, Daniel Schmuckler, Yucong Chen, Geng Bang Jin,
61+
Wendy L. Queen and Simon J. L. Billinge, in preparation.
4162

4263
For more information about the diffpy.labpdfproc library, please consult our `online documentation <https://diffpy.github.io/diffpy.labpdfproc>`_.
4364

@@ -81,6 +102,27 @@ and run the following ::
81102

82103
pip install .
83104

105+
Example
106+
-------
107+
108+
Navigate to the directory that contains 1D diffraction patterns that you would like to process.
109+
Activate the conda environment (`conda activate diffpy.labpdfproc_env`) that contains the package and run the following command ::
110+
111+
labpdfproc <muD> <path/to/inputfile.txt>
112+
113+
Here replace <muD> with the value of muD for your sample
114+
and <path/to/inputfile.txt> with the path and filename of your input file.
115+
For example, if the uncorrected data case is called zro2_mo.xy and is in the current directory
116+
and it has a muD of 2.5 then the command would be ::
117+
118+
labpdfproc 2.5 zro2_mo.xy
119+
120+
Please type ::
121+
122+
labpdfproc --help
123+
124+
for more information on the available options.
125+
84126
Support and Contribute
85127
----------------------
86128

@@ -109,7 +151,7 @@ trying to commit again.
109151

110152
Improvements and fixes are always appreciated.
111153

112-
Before contribuing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.labpdfproc/blob/main/CODE_OF_CONDUCT.rst>`_.
154+
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.labpdfproc/blob/main/CODE_OF_CONDUCT.rst>`_.
113155

114156
Contact
115157
-------

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ template = "{tag}"
4242
dev_template = "{tag}"
4343
dirty_template = "{tag}"
4444

45+
[project.scripts]
46+
labpdfproc = "diffpy.labpdfproc.labpdfprocapp:main"
47+
4548
[tool.setuptools.packages.find]
4649
where = ["src"] # list of folders that contain the packages (["."] by default)
4750
include = ["*"] # package names should match these glob patterns (["*"] by default)

tests/conftest.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,45 @@
77
@pytest.fixture
88
def user_filesystem(tmp_path):
99
base_dir = Path(tmp_path)
10+
input_dir = base_dir / "input_dir"
11+
input_dir.mkdir(parents=True, exist_ok=True)
1012
home_dir = base_dir / "home_dir"
1113
home_dir.mkdir(parents=True, exist_ok=True)
12-
cwd_dir = base_dir / "cwd_dir"
13-
cwd_dir.mkdir(parents=True, exist_ok=True)
14+
15+
chi_data = "dataformat = twotheta\n mode = xray\n # chi_Q chi_I\n 1 2\n 3 4\n 5 6\n 7 8\n"
16+
xy_data = "1 2\n 3 4\n 5 6\n 7 8"
17+
unreadable_data = "This is a file with no data that is non-readable by " "LoadData"
18+
binary_data = b"\x00\x01\x02\x03\x04"
19+
20+
with open(base_dir / "good_data.chi", "w") as f:
21+
f.write(chi_data)
22+
with open(base_dir / "good_data.xy", "w") as f:
23+
f.write(xy_data)
24+
with open(base_dir / "good_data.txt", "w") as f:
25+
f.write(chi_data)
26+
with open(base_dir / "unreadable_file.txt", "w") as f:
27+
f.write(unreadable_data)
28+
with open(base_dir / "binary.pkl", "wb") as f:
29+
f.write(binary_data)
30+
31+
with open(input_dir / "good_data.chi", "w") as f:
32+
f.write(chi_data)
33+
with open(input_dir / "good_data.xy", "w") as f:
34+
f.write(xy_data)
35+
with open(input_dir / "good_data.txt", "w") as f:
36+
f.write(chi_data)
37+
with open(input_dir / "unreadable_file.txt", "w") as f:
38+
f.write(unreadable_data)
39+
with open(input_dir / "binary.pkl", "wb") as f:
40+
f.write(binary_data)
41+
42+
with open(input_dir / "file_list.txt", "w") as f:
43+
f.write("good_data.chi \n good_data.xy \n good_data.txt \n missing_file.txt")
44+
with open(input_dir / "file_list_example2.txt", "w") as f:
45+
f.write("input_dir/*.txt \n")
46+
f.write("input_dir/good_data.chi \n")
47+
f.write("good_data.xy \n")
48+
f.write(f"{str(input_dir.resolve() / 'good_data.txt')}\n")
1449

1550
home_config_data = {"username": "home_username", "email": "[email protected]"}
1651
with open(home_dir / "diffpyconfig.json", "w") as f:

0 commit comments

Comments
 (0)