matchutils

A module that provides algorithms for initial estimation of shifts based on 2D histograms.

jwst.tweakreg.matchutils.build_xy_zeropoint(imgxy, refxy, searchrad=3.0)[source]

Create a matrix which contains the delta between each XY position and each UV position.

jwst.tweakreg.matchutils.center_of_mass(img, labels=None, index=None)[source]

Calculate the center of mass of the values of an array at labels.

Parameters:img (ndarray) – Data from which to calculate center-of-mass.
Returns:centerofmass – Coordinates of centers-of-masses.
Return type:tuple, or list of tuples

Examples

>>> from jwst.tweakreg import matchutils
>>> a = np.array(([0,0,0,0],
                  [0,1,1,0],
                  [0,1,1,0],
                  [0,1,1,0]))
>>> matchutils.center_of_mass(a)
(2.0, 1.5)
jwst.tweakreg.matchutils.find_xy_peak(img, center=None, sigma=3.0)[source]

Find the center of the peak of offsets