smlmlp.metric_squirrel module

smlmlp.metric_squirrel(widefield_image, sr_image=None, /, xx=None, yy=None, image_sigma=None, mask=None, *, pixel_sr_nm=15.0, fit_intercept=True, ignore_zero=True, cuda=False, parallel=False)[source]

Compare a wide-field image with a super-resolution image.

The super-resolution image is linearly matched to the wide-field image before errors are measured, following the practical SQUIRREL idea without coupling the metric to plotting or file IO.

Parameters:
  • widefield_image (array-like) – Reference 2D wide-field image.

  • sr_image (array-like, optional) – Super-resolution image to compare. If omitted, xx and yy are rendered into an SMLM image with the same shape as widefield_image.

  • xx (array-like, optional) – Localizations used only when sr_image is omitted.

  • yy (array-like, optional) – Localizations used only when sr_image is omitted.

  • image_sigma (array-like, optional) – Localizations used only when sr_image is omitted.

  • mask (array-like of bool, optional) – Pixels included in the fit and metric calculation.

  • fit_intercept (bool, optional) – Fit both scale and offset when true; otherwise fit scale only.

  • ignore_zero (bool, optional) – Exclude zero-valued pixels in either image from the fit.

Returns:

  • error_map (ndarray) – Absolute residual image after intensity matching.

  • info (dict) – Contains scale, offset, rse, rsp and n_pixels.