pept.tracking.Debug#
- class pept.tracking.Debug(verbose=5, max_samples=10)[source]#
Bases:
Reducer
Print types and statistics about the objects being processed in a
pept.Pipeline
.Reducer signature:
PointData -> Debug.fit -> PointData LineData -> Debug.fit -> LineData list[PointData] -> Debug.fit -> list[PointData] list[LineData] -> Debug.fit -> list[LineData] np.ndarray -> Debug.fit -> np.ndarray Any -> Debug.fit -> Any
This is a reducer, so it will collect all samples processed up to the point of use, print them, and return them unchanged.
New in pept-0.5.1
Examples
A
Debug
is normally added in aPipeline
:>>> import pept >>> import pept.tracking as pt >>> >>> pept.Pipeline([ >>> # First pass of clustering >>> pt.Cutpoints(max_distance = 0.2), >>> pt.HDBSCAN(true_fraction = 0.15), >>> pt.SplitLabels() + pt.Centroids(cluster_size = True, error = True), >>> >>> pt.Debug(), >>> pt.Stack(), >>> ])
Methods
__init__
([verbose, max_samples])copy
([deep])Create a deep copy of an instance of this class, including all inner attributes.
fit
(samples)load
(filepath)Load a saved / pickled PEPTObject object from filepath.
save
(filepath)Save a PEPTObject instance as a binary pickle object.
- copy(deep=True)#
Create a deep copy of an instance of this class, including all inner attributes.
- static load(filepath)#
Load a saved / pickled PEPTObject object from filepath.
Most often the full object state was saved using the .save method.
- Parameters
- filepath
filename
orfile
handle
If filepath is a path (rather than file handle), it is relative to where python is called.
- filepath
- Returns
pept.PEPTObject
subclass
instance
The loaded object.
Examples
Save a LineData instance, then load it back:
>>> lines = pept.LineData([[1, 2, 3, 4, 5, 6, 7]]) >>> lines.save("lines.pickle")
>>> lines_reloaded = pept.LineData.load("lines.pickle")
- save(filepath)#
Save a PEPTObject instance as a binary pickle object.
Saves the full object state, including inner attributes, in a portable binary format. Load back the object using the load method.
- Parameters
- filepath
filename
orfile
handle
If filepath is a path (rather than file handle), it is relative to where python is called.
- filepath
Examples
Save a LineData instance, then load it back:
>>> lines = pept.LineData([[1, 2, 3, 4, 5, 6, 7]]) >>> lines.save("lines.pickle")
>>> lines_reloaded = pept.LineData.load("lines.pickle")