pept.tracking.Stack¶
- class pept.tracking.Stack(sample_size=None, overlap=None)[source]¶
Bases:
pept.base.pipelines.ReducerStack iterables - for example a
list[pept.LineData]into a singlepept.LineData, alist[list]into a flattenedlist.Reducer signature:
list[LineData] -> Stack.fit -> LineData list[PointData] -> Stack.fit -> PointData list[list[Any]] -> Stack.fit -> list[Any] list[numpy.ndarray] -> Stack.fit -> numpy.ndarray other -> Stack.fit -> other
Can optionally set a given sample_size and overlap. This is useful when collecting a list of processed samples back into a single object.
Methods
__init__([sample_size, overlap])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.
- fit(samples: collections.abc.Iterable)[source]¶
- 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
filenameorfilehandle If filepath is a path (rather than file handle), it is relative to where python is called.
- filepath
- Returns
pept.PEPTObjectsubclassinstanceThe 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
filenameorfilehandle 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")