@@ -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+ (q-array, y-array) : 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+ (tth-array, y-array) : 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+ (d-array, y-array) : 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,34 @@ 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+
541+ Examples
542+ --------
543+ To save a diffraction object to a file named "diffraction_data.chi" in the current directory
544+ with the independent variable 'q':
545+
546+ >>> file = "diffraction_data.chi"
547+ >>> do.dump(file, xtype="q")
548+
549+ To save the diffraction data to a file in a subfolder `output`:
550+
551+ >>> file = "./output/diffraction_data.chi"
552+ >>> do.dump(file, xtype="q")
553+
554+ To save the diffraction data with a different independent variable, such as 'tth':
555+
556+ >>> file = "diffraction_data_tth.chi"
557+ >>> do.dump(file, xtype="tth")
558+ """
510559 if xtype is None :
511560 xtype = "q"
512561 if xtype in QQUANTITIES :
0 commit comments