Skip to content

Commit 6596333

Browse files
committed
Fix lenght to 5 characterse
1 parent 756be82 commit 6596333

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/diffpy/structure/structure.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,9 @@ def _get_composition(self):
711711
element = _linkAtomAttribute(
712712
"element",
713713
"""Character array of `Atom` types. Assignment updates
714-
the element attribute of the respective `Atoms`.""",
715-
toarray=numpy.char.array,
714+
the element attribute of the respective `Atoms`.
715+
Set the maximum length of the element string to 5 characters.""",
716+
toarray=lambda items: numpy.char.array(items, itemsize=5)
716717
)
717718

718719
xyz = _linkAtomAttribute(
@@ -742,8 +743,9 @@ def _get_composition(self):
742743
label = _linkAtomAttribute(
743744
"label",
744745
"""Character array of `Atom` names. Assignment updates
745-
the label attribute of all `Atoms`.""",
746-
toarray=numpy.char.array,
746+
the label attribute of all `Atoms`.
747+
Set the maximum length of the label string to 5 characters.""",
748+
toarray=lambda items: numpy.char.array(items, itemsize=5)
747749
)
748750

749751
occupancy = _linkAtomAttribute(

src/diffpy/structure/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _linkAtomAttribute(attrname, doc, toarray=numpy.array):
9292
from operator import setitem
9393

9494
_all = slice(None)
95-
95+
9696
def fget(self):
9797
va = toarray([getattr(a, attrname) for a in self])
9898
return va

0 commit comments

Comments
 (0)