Skip to content

Commit 50b7d0d

Browse files
committed
Update input_data docstrings for clarity
1 parent 6dc2738 commit 50b7d0d

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

src/diffpy/utils/diffraction_objects.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,33 @@ def __init__(
4949
self._id = uuid.uuid4()
5050
self.input_data(xarray, yarray, xtype, wavelength, scat_quantity, name, metadata)
5151

52-
def input_data(self, xarray, yarray, xtype, wavelength, scat_quantity, name, metadata):
52+
def input_data(self, xarray, yarray, xtype, wavelength, scat_quantity=None, name="", metadata={}):
53+
"""
54+
Insert a new scattering quantity into the scattering object.
55+
56+
Parameters
57+
----------
58+
xarray : array-like
59+
The independent variable array (e.g., q, tth, or d).
60+
yarray : array-like
61+
The dependent variable array corresponding to intensity values
62+
xtype : str
63+
The type of the independent variable in `xarray`. Must be one of {*XQUANTITIES},
64+
such as "q", "tth", or "d".
65+
wavelength : float
66+
The wavelength of the incoming beam, specified in angstroms (Å).
67+
scat_quantity : str, optional
68+
The type of scattering experiment (e.g., "x-ray", "neutron"). Default is "".
69+
name : str, optional
70+
The name or label for the scattering data. Default is an empty string "".
71+
metadata : dict, optional
72+
The additional metadata associated with the diffraction object. Default is {}.
73+
74+
Returns
75+
-------
76+
None
77+
This method updates the object in place and does not return a value.
78+
"""
5379

5480
# Check xtype is valid. An empty string is the default value.
5581
if xtype not in XQUANTITIES:

tests/test_diffraction_objects.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,6 @@ def test_id_getter_with_mock(mocker, do_minimal):
345345
assert do.id == UUID("d67b19c6-3016-439f-81f7-cf20a04bee87")
346346

347347

348-
def input_data(
349-
self,
350-
xarray,
351-
yarray,
352-
xtype,
353-
metadata={},
354-
scat_quantity=None,
355-
name=None,
356-
wavelength=None,
357-
):
358-
359-
360348
def test_id_setter_error(do_minimal):
361349
do = do_minimal
362350

0 commit comments

Comments
 (0)