trackpy.refine_com

trackpy.refine_com(raw_image, image, radius, coords, max_iterations=10, engine='auto', shift_thresh=0.6, characterize=True, pos_columns=None)

Find the center of mass of a bright feature starting from an estimate.

Characterize the neighborhood of a local maximum, and iteratively hone in on its center-of-brightness.

Parameters:
raw_imagearray (any dimensions)

Image used for final characterization. Ideally, pixel values of this image are not rescaled, but it can also be identical to image.

imagearray (same size as raw_image)

Processed image used for centroid-finding and most particle measurements.

coordsarray or DataFrame

estimated position

max_iterationsinteger

max number of loops to refine the center of mass, default 10

engine{‘python’, ‘numba’}

Numba is faster if available, but it cannot do walkthrough.

shift_threshfloat, optional

Default 0.6 (unit is pixels). If the brightness centroid is more than this far off the mask center, shift mask to neighboring pixel. The new mask will be used for any remaining iterations.

characterizeboolean, True by default

Compute and return mass, size, eccentricity, signal.

pos_columns: list of strings, optional

Column names that contain the position coordinates. Defaults to ['y', 'x'] or ['z', 'y', 'x'], if 'z' exists.

Returns:
DataFrame([x, y, mass, size, ecc, signal, raw_mass])

where “x, y” are appropriate to the dimensionality of the image, mass means total integrated brightness of the blob, size means the radius of gyration of its Gaussian-like profile, ecc is its eccentricity (0 is circular), and raw_mass is the total integrated brightness in raw_image.