Skip to content

Commit 1af98b4

Browse files
committed
Fix docstring for DiffractionObject with PEP256
1 parent f96728a commit 1af98b4

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/diffpy/utils/diffraction_objects.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ def _setter_wmsg(attribute):
3535

3636

3737
class DiffractionObject:
38-
"""
39-
A class to represent diffraction data for various scientific experiments involving scattering
40-
techniques such as X-ray, neutron, and electron diffraction. This object can manage diffraction
41-
data including transformations between different scattering quantities like q (scattering vector),
42-
2θ (two-theta angle), and d (interplanar spacing), and perform various operations like scaling, addition,
43-
and subtraction of diffraction patterns.
38+
"""Class for storing and manipulating diffraction data.
39+
40+
DiffractionObjct stores data produced from X-ray, neutron, and
41+
electron scattering experiment. The object can transform between different
42+
scattering quantities like q (scattering vector), 2θ (two-theta angle),
43+
and d (interplanar spacing), and perform various operations like scaling,
44+
addition, subtraction, and equality between diffraction objects.
4445
4546
Attributes
4647
----------
@@ -49,7 +50,7 @@ class DiffractionObject:
4950
input_xtype : str
5051
The type of the independent variable in `xarray`. Must be one of {*XQUANTITIES}
5152
id : uuid
52-
The unique identifier for the diffraction object.
53+
The unique identifier for the diffraction object.
5354
scat_quantity : str
5455
The type of scattering experiment (e.g., "x-ray", "neutron"). Default is an empty string "".
5556
wavelength : float
@@ -80,8 +81,7 @@ def __init__(
8081
name="",
8182
metadata={},
8283
):
83-
"""
84-
Initialize a DiffractionObject instance.
84+
"""Initialize a DiffractionObject instance.
8585
8686
Parameters
8787
----------
@@ -306,8 +306,8 @@ def id(self, _):
306306
raise AttributeError(_setter_wmsg("id"))
307307

308308
def get_array_index(self, value, xtype=None):
309-
"""
310-
Return the index of the closest value in the array associated with the specified xtype.
309+
"""Return the index of the closest value in the array associated with
310+
the specified xtype.
311311
312312
Parameters
313313
----------
@@ -370,8 +370,8 @@ def on_d(self):
370370
return [self.all_arrays[:, 3], self.all_arrays[:, 0]]
371371

372372
def scale_to(self, target_diff_object, q=None, tth=None, d=None, offset=0):
373-
"""
374-
returns a new diffraction object which is the current object but rescaled in y to the target
373+
"""Returns a new diffraction object which is the current object but
374+
rescaled in y to the target.
375375
376376
The y-value in the target at the closest specified x-value will be used as the factor to scale to.
377377
The entire array is scaled by this factor so that one object places on top of the other at that point.
@@ -412,8 +412,8 @@ def scale_to(self, target_diff_object, q=None, tth=None, d=None, offset=0):
412412
return scaled
413413

414414
def on_xtype(self, xtype):
415-
"""
416-
Return a list of two 1D np array with x and y data, raise an error if the specified xtype is invalid
415+
"""Return a list of two 1D np array with x and y data, raise an error
416+
if the specified xtype is invalid.
417417
418418
Parameters
419419
----------
@@ -458,8 +458,7 @@ def dump(self, filepath, xtype=None):
458458
np.savetxt(f, data_to_save, delimiter=" ")
459459

460460
def copy(self):
461-
"""
462-
Create a deep copy of the DiffractionObject instance.
461+
"""Create a deep copy of the DiffractionObject instance.
463462
464463
Returns
465464
-------

0 commit comments

Comments
 (0)