Skip to content

Commit

Permalink
testing should work now\
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderBorgmans committed Aug 3, 2023
1 parent 68664ea commit 5a65583
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ A version of gpxrdpy is also implemented in pyiron found in the [ugent pyiron br

## Requirements
* `pyobjcryst` - Python bindings to ObjCryst++, the Object-Oriented Crystallographic Library <br> (see [https://github.com/diffpy/pyobjcryst]())
* `numpy` - library for scientific computing in python
* `numpy` - library for computing in python
* `scipy` - library for scientific computing in python
* `molmod` - collection of molecular modelling tools for python <br> (see [https://github.com/molmod/molmod]())
* `matplotlib` - library for plotting in python
* `h5py` - library for storing data in python
21 changes: 18 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The easiest way to install gpxrdpy, is by first installing the pyobjcryst throug
$ conda install -c conda-forge pyobjcryst
```

Afterward, the gpxdpy package can be installed through pip:
Afterward, the gpxdpy package can be installed through pip, which will install all other dependencies:

```console
$ pip install --upgrade git+https://github.com/SanderBorgmans/gpxrdpy.git
Expand All @@ -25,7 +25,22 @@ Afterward, the gpxdpy package can be installed through pip:
To quickly check whether the installation went smoothly, you can run the gpxrdpy-test.py script as follows:

```console
$ gpxrdpy-test.py
$ gpxrd_test.py
```

which computes the static PXRD pattern of COF-5. This will generate a `.fhkl` file with the intensities for each hkl index, and a `.tsv` file with the integrated pattern.
which computes the static PXRD pattern of COF-5 and compares it to a reference pattern. This will generate a `.fhkl` file with the intensities for each hkl index, and two `.dat` files with the integrated diffraction intensities as a function of the Bragg angle (2θ), and the scattering vector (q). Finally, the comparison between the calculated and the reference pattern is saved to a `xrd.pdf` file, whereas the statistical comparison is printed to the terminal:

```console
Imported powder pattern: 2351 points, 2theta= 3.000 -> 50.000, step= 0.020
Guess = 3.725577310703468e-09, fit = 7.3208687727899055e-09

Statistical comparison
------------------------------------------------------------------
Quantity | Full | LA (min-10) | HA (10-max)
------------------------------------------------------------------
R factor (abs) | 0.942803315 | 0.845442566 | 0.985120011
R factor (squared) | 0.924069988 | 0.839995526 | 0.986114068
Weighted R factor | 0.953021538 | 0.873615415 | 0.985541226
Similarity index | 0.388794850 | 0.558217914 | 0.476000931

```
9 changes: 6 additions & 3 deletions scripts/gpxrdpy-test.py → scripts/gpxrd_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python

import os

deg = 0.017453292519943295 # conversion of rad to deg

Expand All @@ -24,7 +24,7 @@ def check_calculation():
numpoints = 1000
max2theta = 50 * deg
obspattern = obspattern
plot = True
plot = 'xrd'
check_peaks = False
detail = False # do not print detailed info for each peak
neutron = False
Expand All @@ -42,7 +42,10 @@ def check_calculation():
return

# Check whether correct files are created

assert os.path.exists('tests/data/COF-5.dat')
assert os.path.exists('tests/data/COF-5_fhkl.dat')
assert os.path.exists('tests/data/COF-5_q.dat')
assert os.path.exists('tests/data/xrd.pdf')

if __name__ == "__main__":
print("Testing your gpxrdpy installation...")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
description="PXRD pattern calculator based on pyobjcryst",
url="https://github.com/SanderBorgmans/gpxrdpy",
packages=setuptools.find_packages(),
scripts=['scripts/gpxrd.py', 'scripts/gpxrd_average.sh'],
scripts=['scripts/gpxrd.py', 'scripts/gpxrd_average.sh', 'scripts/gpxrd_test.py'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand Down

0 comments on commit 5a65583

Please sign in to comment.