Skip to content

Commit da009de

Browse files
docs: refine docstring and add example for dump
1 parent 6757a57 commit da009de

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: src/diffpy/utils/diffraction_objects.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def on_q(self):
422422
423423
Returns
424424
-------
425-
(xarray, yarray) : tuple of ndarray
425+
(q-array, y-array) : tuple of ndarray
426426
The tuple containing two 1D numpy arrays with q and y data
427427
"""
428428
return [self.all_arrays[:, 1], self.all_arrays[:, 0]]
@@ -432,7 +432,7 @@ def on_tth(self):
432432
433433
Returns
434434
-------
435-
(xarray, yarray) : tuple of ndarray
435+
(tth-array, y-array) : tuple of ndarray
436436
The tuple containing two 1D numpy arrays with tth and y data
437437
"""
438438
return [self.all_arrays[:, 2], self.all_arrays[:, 0]]
@@ -442,7 +442,7 @@ def on_d(self):
442442
443443
Returns
444444
-------
445-
(xarray, yarray) : tuple of ndarray
445+
(d-array, y-array) : tuple of ndarray
446446
The tuple containing two 1D numpy arrays with d and y data
447447
"""
448448
return [self.all_arrays[:, 3], self.all_arrays[:, 0]]
@@ -537,6 +537,14 @@ def dump(self, filepath, xtype=None):
537537
The filepath where the diffraction object will be dumped
538538
xtype : str, optional, default is q
539539
The type of quantity for the independent variable chosen from {*XQUANTITIES, }
540+
541+
Examples
542+
--------
543+
To save a diffraction object to a file named "diffraction_data.chi" with
544+
the independent variable 'q':
545+
546+
>>> file = "diffraction_data.chi"
547+
>>> do.dump(file, xtype="q")
540548
"""
541549
if xtype is None:
542550
xtype = "q"

0 commit comments

Comments
 (0)