@@ -369,18 +369,26 @@ class ModelCluster(object):
369369 def __init__ (self , model , * args , ** kwds ):
370370 """Intialize explicitly, or from existing ModelCluster.
371371
372- Parameters [Explicit creation]
373- model - Peaks object, or None->empty model
374- baseline - Baseline object, or None->0
375- r_data - Numpy array of r coordinates
376- y_data - Numpy array of y values
377- y_error - Numpy array of uncertainties in y
378- cluster_slice - slice object defining the range of cluster. None->all data
379- error_method - an ErrorEvaluator subclass
380- peak_funcs - a sequence of PeakFunction instances
381-
382- Parameters [Creation from existing ModelCluster]
383- model - ModelCluster instance, or sequence of ModelCluster instances
372+ Parameters
373+ ----------
374+ model : (lists of) ModelCluster instance
375+ The ModelCluster instances to be clustered.
376+ If it is None, then a ModelCluster object is created.
377+ baseline : Baseline object
378+ The Baseline object, if it is None, set to 0.
379+ r_data : array-like
380+ The numpy array of r coordinates
381+ y_data : array-like
382+ The numpy array of y values
383+ y_error : array-like
384+ The numpy array of uncertainties in y
385+ cluster_slice : slice object
386+ The slice object defining the range of cluster. If the input is None,
387+ then it will take the entire range.
388+ error_method : ErrorEvaluator subclass
389+ The error evaluator to use to calculate quality of model to data.
390+ peak_funcs : a sequence of PeakFunction instances
391+ The peak instances to use to calculate the cluster of data.
384392 """
385393 self .last_fit_size = 0
386394 self .slice = None
@@ -437,7 +445,13 @@ def addexternalpeaks(self, peaks):
437445 """Add peaks (and their value) to self.
438446
439447 Parameters
440- peaks - A Peaks object
448+ ----------
449+ peaks : A Peaks object
450+ The peaks to be added
451+
452+ Returns
453+ -------
454+ None
441455 """
442456 self .replacepeaks (peaks )
443457 self .y_data += peaks .value (self .r_data )
@@ -447,8 +461,9 @@ def writestr(self, **kwds):
447461 """Return partial string representation.
448462
449463 Keywords
450- pfbaselist - List of peak function bases. Otherwise define list from self.
451- blfbaselist - List of baseline function bases. Otherwise define list from self.
464+ --------
465+ pfbaselist - List of peak function bases. Otherwise, define list from self.
466+ blfbaselist - List of baseline function bases.Otherwise, define list from self.
452467 """
453468 from diffpy .srmise .basefunction import BaseFunction
454469
@@ -524,8 +539,9 @@ def factory(mcstr, **kwds):
524539 """Create ModelCluster from string.
525540
526541 Keywords
527- pfbaselist - List of peak function bases
528- blfbaselist - List of baseline function bases
542+ --------
543+ pfbaselist : List of peak function bases
544+ blfbaselist : List of baseline function bases
529545 """
530546 from diffpy .srmise .basefunction import BaseFunction
531547
@@ -696,8 +712,16 @@ def join_adjacent(m1, m2):
696712 unchanged.
697713
698714 Parameters
699- m1 - A ModelCluster
700- m2 - A ModelCluster
715+ ----------
716+ m1 : ModelCluster instance
717+ The first ModelCluster instance.
718+ m2 : ModelCluster instance
719+ The second ModelCluster instance.
720+
721+ Returns
722+ -------
723+ ModelCluster instance
724+ The new ModelCluster instance between m1 and m2.
701725 """
702726 # Check for members that must be shared.
703727 if not (m1 .r_data is m2 .r_data ):
@@ -778,7 +802,17 @@ def join_adjacent(m1, m2):
778802 )
779803
780804 def change_slice (self , new_slice ):
781- """Change the slice which represents the extent of a cluster."""
805+ """Change the slice which represents the extent of a cluster.
806+
807+ Parameters
808+ ----------
809+ new_slice : slice object
810+ The new slice to change.
811+
812+ Returns
813+ -------
814+ None
815+ """
782816 old_slice = self .slice
783817 self .slice = new_slice
784818 self .r_cluster = self .r_data [new_slice ]
@@ -815,10 +849,16 @@ def npars(self, count_baseline=True, count_fixed=True):
815849 """Return number of parameters in model and baseline.
816850
817851 Parameters
818- count_baseline - [True] Boolean determines whether or not to count
819- parameters from baseline.
820- count_fixed - [True] Boolean determines whether or not to include
821- non-free parameters.
852+ ----------
853+ count_baseline : bool
854+ The boolean determines whether to count parameters from baseline. Default is True.
855+ count_fixed : bool
856+ The boolean determines whether to include non-free parameters. Default is True.
857+
858+ Returns
859+ -------
860+ n : int
861+ The number of parameters in model and baseline.
822862 """
823863 n = self .model .npars (count_fixed = count_fixed )
824864 if count_baseline and self .baseline is not None :
@@ -829,8 +869,15 @@ def replacepeaks(self, newpeaks, delslice=slice(0, 0)):
829869 """Replace peaks given by delslice by those in newpeaks.
830870
831871 Parameters
832- newpeaks - Add each Peak in this Peaks to cluster.
833- delslice - Existing peaks given by slice object are deleted.
872+ ----------
873+ newpeaks : Peak instance
874+ The peak that id added to each existing peak to cluster.
875+ delslice : Peak instance
876+ The existing peaks given by slice object are deleted.
877+
878+ Returns
879+ -------
880+ None
834881 """
835882 for p in self .model [delslice ]:
836883 if not p .removable :
0 commit comments