Tracking Algorithms (pept.tracking
)#
Tracer location, identification and tracking algorithms.
The pept.tracking subpackage hosts different tracking algorithms, working with both the base classes, as well as with generic NumPy arrays.
All algorithms here are either pept.base.Filter
or pept.base.Reducer
subclasses, implementing the .fit and .fit_sample methods; here is an
example using PEPTML:
>>> from pept.tracking import *
>>>
>>> cutpoints = Cutpoints(0.5).fit(lines)
>>> clustered = HDBSCAN(0.15).fit(cutpoints)
>>> centres = (SplitLabels() + Centroids() + Stack()).fit(clustered)
Once the processing steps have been tuned (see the Tutorials), you can chain all filters into a pept.Pipeline for efficient, parallel execution:
>>> pipeline = (
>>> Cutpoints(0.5) +
>>> HDBSCAN(0.15) +
>>> SplitLabels() + Centroids() + Stack()
>>> )
>>> centres = pipeline.fit(lines)
If you would like to implement a PEPT algorithm, all you need to do is to
subclass a pept.base.Filter
and define the method .fit_sample(sample)

and you get parallel execution and pipeline chaining for free!
>>> import pept
>>>
>>> class NewAlgorithm(pept.base.LineDataFilter):
>>> def __init__(self, setting1, setting2 = None):
>>> self.setting1 = setting1
>>> self.setting2 = setting2
>>>
>>> def fit_sample(self, sample: pept.LineData):
>>> processed_points = ...
>>> return pept.PointData(processed_points)
Tracking Optimisation#

Print types and statistics about the objects being processed in a 

Automatically determine optimum adaptive time window to have an ideal number of elements per sample. 
GeneralPurpose Transformers#

Stack iterables  for example a 

Split a sample of data into unique 
alias of 


Stack all samples and split them into a list according to a named / numeric column index. 

Compute the geometric centroids of a list of samples of points. 

Compute the minimum distance point of some 

Select only data satisfying multiple conditions, given as a string, a function or list thereof; e.g. 

Select only samples satisfying multiple conditions, given as a string, a function or list thereof; e.g. 

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

Swap two columns in a LineData or PointData. 
Space Transformers#

Asynchronously voxelize samples of lines from a pept.LineData. 

Interpolate between data points at a fixed sampling rate; useful for Eulerian fields computation. 

Rotate a dataset such that it is oriented according to its principal axes. 

Remove tracer locations that are sparse in time  ie the 

Remove parts of a PointData where the tracer remains static. 
Tracer Locating Algorithms#

The Birmingham Method is an efficient, analytical technique for tracking tracers using the LoRs from PEPT data. 

Transform LoRs (a pept.LineData instance) into cutpoints (a pept.PointData instance) for clustering, in parallel. 

Transform LoRs (a pept.LineData instance) into minpoints (a pept.PointData instance) for clustering, in parallel. 

Use HDBSCAN to cluster some 

FPI is a modern voxelbased tracerlocation algorithm that can reliably work with unknown numbers of tracers in fast and noisy environments. 
Trajectory Separation Algorithms#

Segregate the intertwined points from multiple trajectories into individual paths. 

Bestfit trajectory segment reconstruction based on time, distance and arbitrary tracer signatures. 
Time Of Flight Algorithms#

Compute the positron annihilation locations of each LoR as given by the Time Of Flight (ToF) data of the two LoR timestamps. 

Compute cutpoints from all pairs of lines whose Time Of Flightpredicted locations are closer than max_distance. 

Append weights according to the Gaussian distribution that best fits the samples of points. 
Post Processing Algorithms#

Append the dimensionwise or absolute velocity to samples of points using a 2D fitted polynomial in a rolling window mode. 