pept.tracking.SplitLabels¶
- class pept.tracking.SplitLabels(remove_labels=True, extract_lines=False, noise=False)[source]¶
Bases:
pept.base.pipelines.FilterSplit a sample of data into unique
labelvalues, optionally removing noise and extracting _lines attributes.Filter signature:
# `extract_lines` = False (default) LineData -> SplitLabels.fit_sample -> list[LineData] PointData -> SplitLabels.fit_sample -> list[PointData] # `extract_lines` = True and PointData.lines exists PointData -> SplitLabels.fit_sample -> list[LineData]
The sample of data must have a column named exactly “label”. The filter normally removes the “label” column in the output (if
remove_label = True).Methods
__init__([remove_labels, extract_lines, noise])copy([deep])Create a deep copy of an instance of this class, including all inner attributes.
fit(samples[, executor, max_workers, verbose])Apply self.fit_sample (implemented by subclasses) according to the execution policy.
fit_sample(sample)load(filepath)Load a saved / pickled PEPTObject object from filepath.
save(filepath)Save a PEPTObject instance as a binary pickle object.
- fit_sample(sample: pept.base.iterable_samples.IterableSamples)[source]¶
- copy(deep=True)¶
Create a deep copy of an instance of this class, including all inner attributes.
- fit(samples: collections.abc.Iterable, executor='joblib', max_workers=None, verbose=True)¶
Apply self.fit_sample (implemented by subclasses) according to the execution policy. Simply return a list of processed samples. If you need a reduction step (e.g. stack all processed samples), apply it in the subclass.
- 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")