pept.tracking.Remove#

class pept.tracking.Remove(*columns)[source]#

Bases: Filter

Remove columns (either column names or indices) from pept.LineData or pept.PointData.

Filter signature:

 pept.LineData -> Remove.fit_sample -> pept.LineData
pept.PointData -> Remove.fit_sample -> pept.PointData

Examples

To remove a single column named “line_index”:

>>> import pept
>>> from pept.tracking import *
>>> points = pept.PointData(...)    # Some dummy data
>>> rem = Remove("line_index")
>>> points_without = rem.fit_sample(points)

Remove all columns starting with “line_index” using a glob operator (*):

>>> points_without = Remove("line_index*").fit_sample(points)

Remove the first column based on its index:

>>> points_without = Remove(0).fit_sample(points)

Finally, multiple removals may be chained into a list:

>>> points_without = Remove(["line_index*", -1]).fit_sample(points)
__init__(*columns)[source]#

Methods

__init__(*columns)

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.

Attributes

columns

property columns#
fit_sample(sample: IterableSamples)[source]#
copy(deep=True)#

Create a deep copy of an instance of this class, including all inner attributes.

fit(samples, 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
filepathfilename or file handle

If filepath is a path (rather than file handle), it is relative to where python is called.

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
filepathfilename or file handle

If filepath is a path (rather than file handle), it is relative to where python is called.

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")