Skip to content

Commit a22a04a

Browse files
authored
Merge pull request #28 from vincefn/master
Merge doc changes + small issue with polyhedra + small fixes for powder pattern plotting
2 parents 569b7db + ffc3e57 commit a22a04a

File tree

9 files changed

+83
-27
lines changed

9 files changed

+83
-27
lines changed

.readthedocs.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.9"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: doc/manual/source/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
# formats:
24+
# - pdf
25+
26+
# Optionally declare the Python requirements required to build your docs
27+
python:
28+
install:
29+
- requirements: doc/requirements.txt

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release notes
22

3+
## Version X.Y.Z
4+
5+
### Fixed
6+
7+
- Fix access to PRISM_TETRAGONAL_DICAP, PRISM_TRIGONAL,
8+
ICOSAHEDRON and TRIANGLE_PLANE.
9+
10+
311
## Version 2.2.1 -- 2021-11-28
412

513
- Add quantitative phase analysis with PowderPattern.qpa(), including

doc/manual/source/conf.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys, os
66
import time
77
import sphinx_py3doc_enhanced_theme
8+
89
# Requires sphinx >= 0.6
910

1011
# If extensions (or modules to document with autodoc) are in another directory,
@@ -50,6 +51,7 @@
5051
# built documents.
5152
sys.path.insert(0, os.path.abspath('../../..'))
5253
from setup import versiondata
54+
5355
fullversion = versiondata.get('DEFAULT', 'version')
5456
# The short X.Y version.
5557
version = ''.join(fullversion.split('.post')[:1])
@@ -111,8 +113,10 @@
111113
# documentation.
112114
#
113115
html_theme_options = {
114-
'collapsiblesidebar' : 'true',
115-
'navigation_with_keys' : 'true',
116+
'collapsiblesidebar': 'true',
117+
'navigation_with_keys': 'true',
118+
'body_min_width': '40%',
119+
'body_max_width': '800px',
116120
}
117121

118122
# Add any paths that contain custom themes here, relative to this directory.
@@ -183,18 +187,17 @@
183187
# Output file base name for HTML help builder.
184188
htmlhelp_basename = 'pyobjcrystdoc'
185189

186-
187190
# -- Options for LaTeX output --------------------------------------------------
188191

189192
latex_elements = {
190-
# The paper size ('letterpaper' or 'a4paper').
191-
# 'papersize': 'letterpaper',
193+
# The paper size ('letterpaper' or 'a4paper').
194+
# 'papersize': 'letterpaper',
192195

193-
# The font size ('10pt', '11pt' or '12pt').
194-
# 'pointsize': '10pt',
196+
# The font size ('10pt', '11pt' or '12pt').
197+
# 'pointsize': '10pt',
195198

196-
# Additional stuff for the LaTeX preamble.
197-
# 'preamble': '',
199+
# Additional stuff for the LaTeX preamble.
200+
# 'preamble': '',
198201
}
199202

200203
# Grouping the document tree into LaTeX files. List of tuples

doc/manual/source/examples/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tested in parallel to determine which one is correct. The solutions
3939
can then be compared and displayed individually.
4040

4141
:doc:`Quantitative phase analysis (QPA) <Quantitative-phase-analysis>`
42-
______________________________________________________________________
42+
======================================================================
4343

4444
Example of QPA based on the data available from the `1999 Round Robin
4545
<https://www.iucr.org/__data/iucr/powder/QARR/samples.htm>`_,

doc/manual/source/index.rst

+21-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Crystallographic Library
1212
Authors
1313
================
1414

15-
pyobjcryst was written as part of the DANSE_ open-source project by
15+
`pyobjcryst` was written as part of the DANSE_ open-source project by
1616
Christopher Farrow, Pavol Juhás, and Simon J.L. Billinge.
1717
The sources are now maintained as a part of the DiffPy-CMI complex
1818
modeling initiative at the Brookhaven National Laboratory.
@@ -23,29 +23,41 @@ global optimisation and least squares algorithms (see the
2323
:doc:`examples/index`) are provided by Vincent Favre-Nicolin (ESRF).
2424

2525
For a complete list of contributors, see
26-
https://github.com/diffpy/pyobjcryst/graphs/contributors.
26+
https://github.com/diffpy/pyobjcryst/graphs/contributors and
27+
https://github.com/diffpy/libobjcryst/graphs/contributors.
2728

2829
.. _DANSE: http://danse.us/
2930

3031
======================================
3132
Installation
3233
======================================
3334

35+
`pyobjcryst` and `libobjcryst` conda packages can be easily installed under
36+
Linux and macOS using channel `conda-forge` or `diffpy` channels,
37+
e.g.:
38+
39+
* `conda install -c diffpy libobjcryst pyobjcryst`
40+
* `conda install -c conda-forge libobjcryst pyobjcryst`
41+
3442
See the `README <https://github.com/diffpy/pyobjcryst#requirements>`_
35-
file included with the distribution.
43+
file included with the distribution for more details.
3644

3745
======================================
3846
Usage
3947
======================================
4048

41-
pyobjcryst can be used in different ways:
49+
`pyobjcryst` can be used in different ways:
4250

43-
* as a backend library to manage crystal structures description in an application
51+
* **as a backend library** to manage crystal structures description in an application
4452
like `DiffPy-CMI <https://www.diffpy.org/products/diffpycmi/index.html>`_
45-
* in python scripts or notebooks, allowing to display crystal structures,
46-
index and refine powder diffraction patterns, solve crystal structures
47-
from diffraction data using global optimisation algorithms, etc.. The
48-
functionality is similar to what is available in `Fox <http://fox.vincefn.net>`_.
53+
* **in python scripts or notebooks**, allowing to:
54+
55+
* display crystal structures,
56+
* index and refine powder diffraction patterns
57+
* solve crystal structures from diffraction data using global optimisation algorithms
58+
* etc..
59+
60+
The functionality is similar to what is available in `Fox <http://fox.vincefn.net>`_.
4961
See the :doc:`examples/index`:
5062

5163
* :doc:`3D Crystal structure display <examples/crystal_3d_widget>`

doc/requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sphinx_py3doc_enhanced_theme
2+
m2r2
3+
nbsphinx
4+
nbsphinx-link
5+
numpy

src/extensions/zpolyhedron_ext.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void wrap_zpolyhedron()
5959
.value("CUBE", CUBE)
6060
.value("ANTIPRISM_TETRAGONAL", ANTIPRISM_TETRAGONAL)
6161
.value("PRISM_TETRAGONAL_MONOCAP", PRISM_TETRAGONAL_MONOCAP)
62-
.value("PRISM_TETRAGONAL_DICAP ", PRISM_TETRAGONAL_DICAP)
63-
.value("PRISM_TRIGONAL ", PRISM_TRIGONAL)
62+
.value("PRISM_TETRAGONAL_DICAP", PRISM_TETRAGONAL_DICAP)
63+
.value("PRISM_TRIGONAL", PRISM_TRIGONAL)
6464
.value("PRISM_TRIGONAL_TRICAPPED", PRISM_TRIGONAL_TRICAPPED)
65-
.value("ICOSAHEDRON ", ICOSAHEDRON)
66-
.value("TRIANGLE_PLANE ", TRIANGLE_PLANE)
65+
.value("ICOSAHEDRON", ICOSAHEDRON)
66+
.value("TRIANGLE_PLANE", TRIANGLE_PLANE)
6767
;
6868
}

src/pyobjcryst/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
Objects are wrapped according to their header file in the ObjCryst source.
1919
20-
See the online ObjCryst++ documentation (http://vincefn.net/ObjCryst/).
20+
See the online ObjCryst++ documentation (https://vincefn.net/ObjCryst/).
2121
2222
Modules
2323

src/pyobjcryst/powderpattern.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def plot(self, diff=None, hkl=None, figsize=(9, 4), fontsize_hkl=6, reset=False,
121121
plt.figure(figsize=figsize)
122122
plt.plot(x, obs, 'k', label='obs', linewidth=1)
123123
plt.plot(x, calc, 'r', label='calc', linewidth=1)
124-
m = self.GetMaxSinThetaOvLambda() * self.GetWavelength()
124+
m = min(1, self.GetMaxSinThetaOvLambda() * self.GetWavelength())
125125
mtth = np.rad2deg(np.arcsin(m)) * 2
126126
if plot_diff:
127127
diff = calc - obs - obs.max() / 20
@@ -191,8 +191,7 @@ def _do_plot_hkl(self, nb_max=100, fontsize_hkl=None):
191191
calc = self.GetPowderPatternCalc()
192192
x = np.rad2deg(self.GetPowderPatternX())
193193
# Clear previous text (assumes only hkl were printed)
194-
plt.gca().texts = []
195-
iphase = 0
194+
plt.gca().texts.clear()
196195
for ic in range(self.GetNbPowderPatternComponent()):
197196
c = self.GetPowderPatternComponent(ic)
198197
if isinstance(c, PowderPatternDiffraction) is False:

0 commit comments

Comments
 (0)