Skip to content

Commit ecf14d4

Browse files
committed
Fix docstrings for API reference.
1 parent 2577d00 commit ecf14d4

File tree

13 files changed

+357
-203
lines changed

13 files changed

+357
-203
lines changed

doc/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@
116116
# Display all warnings for missing links.
117117
nitpicky = True
118118

119+
nitpick_ignore = [
120+
("py:class", "array_like"),
121+
("py:class", "Parser"),
122+
]
123+
119124
# -- Options for HTML output ----------------------------------------------
120125

121126
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -287,3 +292,7 @@
287292

288293
# Example configuration for intersphinx: refer to the Python standard library.
289294
# intersphinx_mapping = {'http://docs.python.org/': None}
295+
intersphinx_mapping = {
296+
"python": ("https://docs.python.org/3", None),
297+
"numpy": ("https://numpy.org/doc/stable/", None),
298+
}

src/diffpy/structure/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@
1313
#
1414
##############################################################################
1515

16-
"""classes related to structure of materials
16+
"""
17+
Classes related to the structure of materials.
18+
1719
Classes:
1820
Atom
21+
1922
Lattice
23+
2024
Structure
25+
2126
PDFFitStructure
2227
Exceptions:
2328
StructureFormatError
29+
2430
LatticeError
31+
2532
SymmetryError
2633
"""
2734

@@ -51,13 +58,13 @@ def loadStructure(filename, fmt="auto", **kw):
5158
5259
filename : str
5360
Path to the file to be loaded.
54-
fmt : str, optional
55-
Format of the structure file such as 'cif' or 'xyz'. Must be
61+
fmt : str, Optional
62+
Format of the structure file such as 'cif' or 'xyz'. Must be
5663
one of the formats listed by the `parsers.inputFormats` function.
5764
When 'auto', all supported formats are tried in a sequence.
58-
kw : misc, optional
65+
kw : Optional
5966
Extra keyword arguments that are passed to `parsers.getParser`
60-
function. These configure the dedicated Parser object that
67+
function. These configure the dedicated Parser object that
6168
is used to read content in filename.
6269
6370
Returns

src/diffpy/structure/apps/anyeye.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,37 @@
1313
#
1414
##############################################################################
1515

16-
"""anyeye view structure file in atomeye
16+
"""
17+
anyeye view structure file in atomeye
18+
1719
Usage: anyeye [options] strufile
1820
19-
anyeye understands more structure formats than atomeye. It converts strufile
20-
to a temporary XCFG file which is opened in atomeye. Supported file formats:
21+
Anyeye understands more structure formats than atomeye. It converts strufile
22+
to a temporary XCFG file which is opened in atomeye. Supported file formats:
2123
inputFormats
2224
2325
Options:
24-
-f, --formula override chemical formula in strufile, formula defines
25-
elements in the same order as in strufile, e.g, Na4Cl4
26-
-w, --watch watch input file for changes
27-
--viewer=VIEWER the structure viewer program, by default "atomeye".
28-
The program will be executed as "VIEWER structurefile"
29-
--formats=FORMATS comma separated list of file formats that are understood
30-
by the VIEWER, by default "xcfg,pdb". Files of other
31-
formats will be converted to the first listed format.
32-
-h, --help display this message and exit
33-
-V, --version show script version and exit
26+
-f, --formula
27+
Override chemical formula in strufile. The formula defines
28+
elements in the same order as in strufile, e.g., Na4Cl4.
29+
30+
-w, --watch
31+
Watch input file for changes.
32+
33+
--viewer=VIEWER
34+
The structure viewer program, by default "atomeye".
35+
The program will be executed as "VIEWER structurefile".
36+
37+
--formats=FORMATS
38+
Comma-separated list of file formats that are understood
39+
by the VIEWER, by default "xcfg,pdb". Files of other
40+
formats will be converted to the first listed format.
41+
42+
-h, --help
43+
Display this message and exit.
44+
45+
-V, --version
46+
Show script version and exit.
3447
"""
3548

3649
from __future__ import print_function

src/diffpy/structure/atom.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ class Atom(object):
3939
4040
Parameters
4141
----------
42-
atype : str or Atom, optional
42+
atype : str or Atom, Optional
4343
The string atom type to be set as the `element` attribute.
4444
By default an empty string. When of the *Atom* type, create
4545
a copy of *atype* and adjust it per other arguments.
46-
xyz : ndarray, optional
46+
xyz : numpy.ndarray, Optional
4747
Fractional coordinates within the associated `lattice`.
4848
By default ``[0, 0, 0]``.
49-
label : str, optional
49+
label : str, Optional
5050
A unique string `label` for referring to this Atom.
5151
By default an empty string.
52-
occupancy : float, optional
52+
occupancy : float, Optional
5353
The initial `occupancy` of this atom, by default ``1``.
54-
anisotropy : bool, optional
54+
anisotropy : bool, Optional
5555
The flag for anisotropic thermal displacements parameters.
5656
This overrides `anisotropy` implied by presence of the
5757
*U* or *Uisoequiv* arguments. Defaults to ``False``
5858
when not set in any other way.
59-
U : ndarray, optional
59+
U : numpy.ndarray, Optional
6060
The 3x3 matrix of anisotropic thermal displacement parameters.
6161
When present `anisotropy` defaults to ``True``.
62-
Uisoequiv: float, optional
62+
Uisoequiv: float, Optional
6363
The isotropic atomic displacement parameter. The `anisotropy`
6464
defaults to ``False`` when present. Only one of the *U* and
6565
*Uisoequiv* arguments may be provided at the same time. Assume
@@ -72,7 +72,7 @@ class Atom(object):
7272
----------
7373
element : str
7474
The string type of the atom. An element or ion symbol.
75-
xyz : ndarray
75+
xyz : numpy.ndarray
7676
The fractional coordinates in the associated `lattice`.
7777
label : str
7878
A unique string label referring to this atom, for example, "C_1".
@@ -211,7 +211,7 @@ def __copy__(self, target=None):
211211
212212
Parameters
213213
----------
214-
target : Atom, optional
214+
target : Atom, Optional
215215
An already existing Atom object to be updated to a duplicate
216216
of this Atom. Create a new Atom object when not specified.
217217
This facilitates extension of the `__copy__` method
@@ -254,7 +254,7 @@ def __copy__(self, target=None):
254254
@property
255255
def xyz_cartn(self):
256256
"""
257-
ndarray: Atom position in absolute Cartesian coordinates.
257+
numpy.ndarray: Atom position in absolute Cartesian coordinates.
258258
259259
This is computed from fractional coordinates `xyz` and the
260260
current `lattice` setup. Assignment to *xyz_cartn* or
@@ -305,7 +305,7 @@ def anisotropy(self, value):
305305
@property
306306
def U(self):
307307
"""
308-
ndarray : The 3x3 matrix of anisotropic atomic displacements.
308+
numpy.ndarray : The 3x3 matrix of anisotropic atomic displacements.
309309
310310
For isotropic displacements (when `anisotropy` is ``False``)
311311
assignment to *U* uses only the first ``Unew[0, 0]`` element

src/diffpy/structure/expansion/makeellipsoid.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,26 @@ def makeSphere(S, radius):
3636

3737

3838
def makeEllipsoid(S, a, b=None, c=None):
39-
"""Cut a structure out of another one.
40-
41-
Arguments
42-
S -- A Structure instance
43-
a -- primary equatorial radius (along x-axis)
44-
b -- secondary equatorial radius (along y-axis). If b is None
45-
(default) then it is set equal to a
46-
c -- polar radius (along z-axis). If c is None (default), then it is
47-
set equal to a.
48-
49-
Returns a new structure instance
39+
"""
40+
Cut a structure out of another one.
41+
42+
Parameters
43+
----------
44+
S :
45+
A Structure instance.
46+
a :
47+
Primary equatorial radius (along x-axis).
48+
b :
49+
Secondary equatorial radius (along y-axis). If b is None
50+
(default), then it is set equal to a.
51+
c :
52+
Polar radius (along z-axis). If c is None (default), then it is
53+
set equal to a.
54+
55+
Returns
56+
-------
57+
Structure :
58+
A new structure instance.
5059
"""
5160
if b is None:
5261
b = a

src/diffpy/structure/expansion/supercell_mod.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,32 @@
2222

2323

2424
def supercell(S, mno):
25-
"""Perform supercell expansion for a structure.
25+
"""
26+
Perform supercell expansion for a structure.
2627
2728
New lattice parameters are multiplied and fractional coordinates
2829
divided by corresponding multiplier. New atoms are grouped with
2930
their source in the original cell.
3031
31-
S -- an instance of Structure from diffpy.structure.
32-
mno -- sequence of 3 integers for cell multipliers along
33-
the a, b and c axes.
32+
Parameters
33+
----------
34+
S :
35+
An instance of Structure from diffpy.structure.
36+
mno :
37+
Sequence of 3 integers for cell multipliers along
38+
the a, b and c axes.
39+
40+
Returns
41+
-------
42+
Structure
43+
A new structure instance representing the expanded supercell.
3444
35-
Return a new expanded structure instance.
36-
Raise TypeError when S is not Structure instance.
37-
Raise ValueError for invalid mno argument.
45+
Raises
46+
------
47+
TypeError
48+
S is not a Structure instance.
49+
ValueError
50+
Invalid mno argument.
3851
"""
3952
# check arguments
4053
if len(mno) != 3:

0 commit comments

Comments
 (0)