pept.tracking.OutOfViewFilter#

class pept.tracking.OutOfViewFilter(max_time=200.0, k=5)[source]#

Bases: Reducer

Remove tracer locations that are sparse in time - ie the k-th nearest detection is later than max_time.

Reducer signature:

      PointData -> OutOfViewFilter.fit -> PointData
list[PointData] -> OutOfViewFilter.fit -> PointData
  numpy.ndarray -> OutOfViewFilter.fit -> PointData

This reducer (i.e. stacks all data samples, then processes it) is useful when the tracer goes out of the PEPT scanners and there are a few sparse noisy detections to remove.

New in pept-0.5.1

Examples

Select only tracer locations whose next detection is within 200 ms.

>>> import pept
>>> import pept.tracking as pt
>>> trajectories = pept.PointData(...)
>>> # Only keep points whose next detection is within 200 ms
>>> inview = pt.OutOfViewFilter(max_time = 200.).fit(trajectories)
__init__(max_time=200.0, k=5)[source]#

Methods

__init__([max_time, k])

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