trackpy.minmass_v04_change

trackpy.minmass_v04_change(raw_image, old_minmass, diameter, preprocess=True, old_smoothing_size=None, new_smoothing_size=None)

Convert minmass value from v0.3 to v0.4.

From trackpy version 0.4.0, the default image preprocessing is changed. Before version 0.4.0 a blurred out image (rolling or boxcar average) with a circular kernel with radius diameter was subtracted from the image before refinement and mass calculation. From version 0.4.0, this has changed to a square kernel with sides diameter, more or less twice as small. This increases tracking accuracy, and reduces the mass.

This function estimates this difference and applies it to calculate the new minmass value.

Here the following approximate relation between the “real” mass of the feature and the mass apparent from the bandpassed image is used:

\[M_{bp} = M_{real} \left( 1 - \frac{n_r}{n_{bp}} \right)\]

Where \(n_r\) denotes the number of pixels in the (circular) refine mask and \(n_{bp}\) the number of pixels in the (square) rolling average kernel.

This follows from a simple model where the bandpassed image \(I_{bp}\) relates to the “real” feature \(F\) and the noise \(N\) by:

\[I_{bp} = F + N - \left(N + \frac{M_{real}}{n_{bp}} \right)\]
Parameters:
raw_imagendarray
old_minmassnumber
diameternumber or tuple

Odd-valued number that is used in locate

preprocessboolean, optional

Defaults to True. Minmass is not changed when preprocess=False.

old_smoothing_sizenumber or tuple, optional

The smoothing size used in the old (pre v0.4) trackpy version (the radius of the circular kernel). Defaults to diameter.

new_smoothing_sizenumber or tuple, optional

The smoothing size used in the new (post v0.4) trackpy version (the size of the sides of the square kernel). Defaults to diameter.

Returns:
New minmass