Skip to content
Prev Previous commit
Next Next commit
chore: update more formatting, finish the removal of unwanted triple …
…quoted strings in the private function argument
  • Loading branch information
danielsirakov committed Jun 18, 2026
commit b047974425c0fd2a32f3e7abb55e497630cff586
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ skip = "*.cif,*.dat"
recursive = true
wrap-summaries = 72
wrap-descriptions = 72
non-cap = ["str", "int", "float", "bool", "list", "dict", "tuple", "set", "none", "ndarray"]

[tool.black]
line-length = 115
Expand Down
24 changes: 12 additions & 12 deletions src/diffpy/structure/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


class Atom(object):
"""Storage of structure information relevant for a single atom.
"""The storage of structure information relevant for a single atom.

This class manages atom information such as element symbol, position
in fractional and Cartesian coordinates, atomic displacement parameters
Expand All @@ -55,10 +55,10 @@ class Atom(object):
By default an empty string. When of the `Atom` type, create
a copy of `atype` and adjust it per other arguments.
xyz : numpy.ndarray, Optional
Fractional coordinates within the associated `lattice`.
The fractional coordinates within the associated `lattice`.
By default ``[0, 0, 0]``.
label : str, Optional
A unique string `label` for referring to this `Atom`.
The unique string `label` for referring to this `Atom`.
By default an empty string.
occupancy : float, Optional
The initial `occupancy` of this atom, by default ``1``.
Expand All @@ -76,7 +76,7 @@ class Atom(object):
*Uisoequiv* arguments may be provided at the same time. Assume
zero atomic displacements when *U* and *Uisoequiv* are unset.
lattice : Lattice, Optional
Coordinate system for the fractional coordinates `xyz`.
The coordinate system for the fractional coordinates `xyz`.
Use the absolute Cartesian system when ``None``.

Attributes
Expand Down Expand Up @@ -228,7 +228,7 @@ def msd_cart(self, vc):
return msd

def __repr__(self):
"""String representation of this Atom."""
"""The string representation of this Atom."""
xyz = self.xyz
s = "%-4s %8.6f %8.6f %8.6f %6.4f" % (
self.element,
Expand Down Expand Up @@ -337,8 +337,8 @@ def anisotropy(self, value):

@property
def U(self):
"""The 3x3 matrix of anisotropic atomic, as a numpy.ndarray
displacements.
"""The 3x3 matrix of anisotropic atomic displacements, as a
ndarray.

For isotropic displacements (when `anisotropy` is ``False``)
assignment to *U* uses only the first ``Unew[0, 0]`` element
Expand Down Expand Up @@ -384,7 +384,7 @@ def _set_uij(self, i, j, value):
# _doc_uii, _doc_uij are temporary local variables.

_doc_uii = """
``float`` : The ``U[{0}, {0}]`` component of the displacement tensor `U`.
The ``U[{0}, {0}]`` component of the displacement tensor `U`, as a float

When `anisotropy` is ``False`` setting a new value updates entire
tensor *U*.
Expand All @@ -407,7 +407,7 @@ def _set_uij(self, i, j, value):
)

_doc_uij = """
``float`` : The ``U[{0}, {1}]`` element of the displacement tensor `U`.
The ``U[{0}, {1}]`` element of the displacement tensor `U`, as a float

Sets ``U[{1}, {0}]`` together with ``U[{0}, {1}]``. Assignment
has no effect when `anisotropy` is ``False``.
Expand Down Expand Up @@ -479,14 +479,14 @@ def Uisoequiv(self, value):
# _doc_bii, _doc_bij are local variables.

_doc_bii = """
``float`` : The ``B{0}{0}`` element of the Debye-Waller matrix.
The ``B{0}{0}`` element of the Debye-Waller matrix, as a float

This is equivalent to ``8 * pi**2 * U{0}{0}``. When `anisotropy`
is ``False`` setting a new value updates entire tensor `U`.
"""

_doc_bij = """
``float`` : The ``B{0}{1}`` element of the Debye-Waller matrix.
The ``B{0}{1}`` element of the Debye-Waller matrix, as a float

This is equivalent to ``8 * pi**2 * U{0}{1}``. Setting a new
value updates `U` in a symmetric way. Assignment has no effect
Expand Down Expand Up @@ -561,7 +561,7 @@ class _AtomCartesianCoordinates(numpy.ndarray):
Parameters
----------
atom : Atom
`Atom` instance to be linked to these coordinate array.
The `Atom` instance to be linked to these coordinate array.
"""

def __new__(self, atom):
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/structure/lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Attributes
----------
cartesian : Lattice
The constant instance of Lattice, default Cartesian system.
The default Cartesian lattice with a=b=c=1 and alpha=beta=gamma=90 degrees.
"""

import math
Expand Down
5 changes: 3 additions & 2 deletions src/diffpy/structure/parsers/p_xcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ class P_xcfg(StructureParser):
----------
format : str
The format name, default "xcfg".
cluster_boundary : int
The width of boundary around corners of non-periodic
cluster to avoid PBC effects in atomeye, default 2.
"""

cluster_boundary = 2
"""``int``: The width of boundary around corners of non-periodic
cluster to avoid PBC effects in atomeye."""

def __init__(self):
StructureParser.__init__(self)
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/structure/pdffitstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PDFFitStructure(Structure):
Attributes
----------
pdffit : dict
The dictionary for storing following extra parameters from
This stores the following extra parameters from
PDFFit structure files:
`'scale', 'delta1', 'delta2', 'sratio',
'rcut', 'spcgr', 'dcell', 'ncell'`
Expand Down
135 changes: 107 additions & 28 deletions src/diffpy/structure/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,73 +1057,152 @@ def _get_composition(self):

# linked atom attributes

element = _link_atom_attribute(
"element",
toarray=lambda items: numpy.char.array(items, itemsize=5),
)
element = _link_atom_attribute(
"element",
(
"Character array of `Atom` types. Assignment updates "
"the element attribute of the respective `Atoms`. "
"Set the maximum length of the element string to 5 characters. "
"Set the maximum length of the element string to 5 characters."
),
toarray=lambda items: numpy.char.array(items, itemsize=5),
)

xyz = _link_atom_attribute("xyz")
xyz = _link_atom_attribute(
"xyz",
"Array of fractional coordinates of all `Atoms`. " "Assignment updates `xyz` attribute of all `Atoms`.",
)

x = _link_atom_attribute("x")
x = _link_atom_attribute(
"x",
"Array of all fractional coordinates `x`. " "Assignment updates `xyz` attribute of all `Atoms`.",
)

y = _link_atom_attribute("y")
y = _link_atom_attribute(
"y",
"Array of all fractional coordinates `y`. " "Assignment updates `xyz` attribute of all `Atoms`.",
)

z = _link_atom_attribute("z")
z = _link_atom_attribute(
"z",
"Array of all fractional coordinates `z`. " "Assignment updates `xyz` attribute of all `Atoms`.",
)

label = _link_atom_attribute(
"label",
(
"Character array of `Atom` names. Assignment updates "
"the label attribute of all `Atoms`. "
"Set the maximum length of the label string to 5 characters. "
"Set the maximum length of the label string to 5 characters."
),
toarray=lambda items: numpy.char.array(items, itemsize=5),
)

occupancy = _link_atom_attribute("occupancy")
occupancy = _link_atom_attribute(
"occupancy",
"Array of `Atom` occupancies. " "Assignment updates the occupancy attribute of all `Atoms`.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should all be with a pattern something like
"The Atomoccupancies. Assignment updates the occupancy attributes of allAtoms"
Please could you update them all following this pattern?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply, I’ve been moving into a new place so I don’t have any WiFi or power currently. I’ll update it as soon as possible

)

xyz_cartn = _link_atom_attribute("xyz_cartn")
xyz_cartn = _link_atom_attribute(
"xyz_cartn",
"Array of absolute Cartesian coordinates of all `Atoms`. "
"Assignment updates the `xyz` attribute of all `Atoms`.",
)

anisotropy = _link_atom_attribute("anisotropy")
anisotropy = _link_atom_attribute(
"anisotropy",
"Boolean array for anisotropic thermal displacement flags. "
"Assignment updates the anisotropy attribute of all `Atoms`.",
)

U = _link_atom_attribute("U")
U = _link_atom_attribute(
"U",
"Array of anisotropic thermal displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

Uisoequiv = _link_atom_attribute("Uisoequiv")
Uisoequiv = _link_atom_attribute(
"Uisoequiv",
"Array of isotropic thermal displacement or equivalent values. "
"Assignment updates the U attribute of all `Atoms`.",
)

U11 = _link_atom_attribute("U11")
U11 = _link_atom_attribute(
"U11",
"Array of `U11` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

U22 = _link_atom_attribute("U22")
U22 = _link_atom_attribute(
"U22",
"Array of `U22` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

U33 = _link_atom_attribute("U33")
U33 = _link_atom_attribute(
"U33",
"Array of `U33` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

U12 = _link_atom_attribute("U12")
U12 = _link_atom_attribute(
"U12",
"Array of `U12` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

U13 = _link_atom_attribute("U13")
U13 = _link_atom_attribute(
"U13",
"Array of `U13` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

U23 = _link_atom_attribute("U23")
U23 = _link_atom_attribute(
"U23",
"Array of `U23` elements of the anisotropic displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

Bisoequiv = _link_atom_attribute("Bisoequiv")
Bisoequiv = _link_atom_attribute(
"Bisoequiv",
"Array of Debye-Waller isotropic thermal displacement or equivalent values. "
"Assignment updates the U attribute of all `Atoms`.",
)

B11 = _link_atom_attribute("B11")
B11 = _link_atom_attribute(
"B11",
"Array of `B11` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

B22 = _link_atom_attribute("B22")
B22 = _link_atom_attribute(
"B22",
"Array of `B22` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

B33 = _link_atom_attribute("B33")
B33 = _link_atom_attribute(
"B33",
"Array of `B33` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

B12 = _link_atom_attribute("B12")
B12 = _link_atom_attribute(
"B12",
"Array of `B12` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

B13 = _link_atom_attribute("B13")
B13 = _link_atom_attribute(
"B13",
"Array of `B13` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

B23 = _link_atom_attribute("B23")
B23 = _link_atom_attribute(
"B23",
"Array of `B23` elements of the Debye-Waller displacement tensors. "
"Assignment updates the U and anisotropy attributes of all `Atoms`.",
)

# Private Methods --------------------------------------------------------

Expand Down
Loading