refine_tracks_centroid

lumicks.pylake.refine_tracks_centroid

refine_tracks_centroid(tracks, track_width=None, bias_correction=True)

Refine the tracks based on the brightness-weighted centroid.

This function interpolates the determined tracks (in time) and then uses the pixels in the vicinity of the tracks to make small adjustments to the estimated location. The refinement correction is computed by considering the brightness weighted centroid.

Note

The track_width parameter is given in physical units, but the algorithm works with discrete pixels. In order to avoid bias in the result, the number of pixels to use is rounded up to the nearest odd value.

Parameters
  • tracks (List[KymoTrack] or KymoTrackGroup) – Detected tracks on a kymograph

  • track_width (float) – Expected (spatial) spot size in physical units. Must be larger than zero. If None, the default is 0.35 (half the wavelength of the red limit of the visible spectrum) for kymographs calibrated in microns. For kymographs calibrated in kilobase pairs the corresponding value is calculated using 0.34 nm/bp (from duplex DNA).

  • bias_correction (bool) – Correct coordinate bias by ensuring that the window is symmetric (see 1 for more information). Note that while this increases the variance (reduces precision), it can greatly reduce the bias when there is a high background.

Returns

refined_tracks – KymoTrackGroup with refined coordinates.

Return type

KymoTrackGroup

Raises

ValueError – If the track width is not at least 3 pixels.

References

1

Berglund, A. J., McMahon, M. D., McClelland, J. J., & Liddle, J. A. (2008). Fast, bias-free algorithm for tracking single particles with variable size and shape. Optics express, 16(18), 14064-14075.