Skip to content

Commit 6757a57

Browse files
docs: add docstrings and news
1 parent 0a3241b commit 6757a57

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Diff for: news/DO-docstring.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* docstrings for `on_q`, `on_tth`, `on_d`, and `dump` in `diffraction_objects.py`.
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

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

+31
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,33 @@ def _get_original_array(self):
418418
return self.on_d(), "d"
419419

420420
def on_q(self):
421+
"""Return the tuple of two 1D numpy arrays containing q and y data.
422+
423+
Returns
424+
-------
425+
(xarray, yarray) : tuple of ndarray
426+
The tuple containing two 1D numpy arrays with q and y data
427+
"""
421428
return [self.all_arrays[:, 1], self.all_arrays[:, 0]]
422429

423430
def on_tth(self):
431+
"""Return the tuple of two 1D numpy arrays containing tth and y data.
432+
433+
Returns
434+
-------
435+
(xarray, yarray) : tuple of ndarray
436+
The tuple containing two 1D numpy arrays with tth and y data
437+
"""
424438
return [self.all_arrays[:, 2], self.all_arrays[:, 0]]
425439

426440
def on_d(self):
441+
"""Return the tuple of two 1D numpy arrays containing d and y data.
442+
443+
Returns
444+
-------
445+
(xarray, yarray) : tuple of ndarray
446+
The tuple containing two 1D numpy arrays with d and y data
447+
"""
427448
return [self.all_arrays[:, 3], self.all_arrays[:, 0]]
428449

429450
def scale_to(self, target_diff_object, q=None, tth=None, d=None, offset=None):
@@ -507,6 +528,16 @@ def on_xtype(self, xtype):
507528
raise ValueError(_xtype_wmsg(xtype))
508529

509530
def dump(self, filepath, xtype=None):
531+
"""Dump the xarray and yarray of the diffraction object to a two-column
532+
file, with the associated information included in the header.
533+
534+
Parameters
535+
----------
536+
filepath : str
537+
The filepath where the diffraction object will be dumped
538+
xtype : str, optional, default is q
539+
The type of quantity for the independent variable chosen from {*XQUANTITIES, }
540+
"""
510541
if xtype is None:
511542
xtype = "q"
512543
if xtype in QQUANTITIES:

0 commit comments

Comments
 (0)