find_pixat11

sofia_redux.instruments.forcast.undistort.find_pixat11(transform, x0, y0, epsilon=1e-08, xrange=(0, 255), yrange=(0, 255), method=None, maxiter=None, verbose=False, direct=True)[source]

Calculate the position of x0, y0 after a transformation

Also calculate the position of x1 (= x0 + 1), y1 (= y0 + 1) after the transformation in order to determine pixel scaling and offsets.

If we have a transform that can be directly inverted, then the solution is simple and we can return an exact solution. In this case the all optional arguments are ignored aside from eps which will determine the number of decimal places in the output (None will not limit precision).

Otherwise, we will need to perform some type of minimization. The default minimization method, ‘TNC’ is a truncated Newton algorithm used to minimize a function subject to bounds. It is suitable for the purposes of sofia_redux.instruments.forcast.undistort. If you wish to solve an unbounded problem, leave method = None to allow scipy.optimize.minimize to select an appropriate method or set your own.

Parameters:
transformPolynomialTransform or function or object

as returned by warp_image with get_transform=True or a user defined function or object. Should take in (y, x) coordinates as an argument and return the transformed (y, x) coordinates.

x0float

input x coordinate

y0float

input y coordinate

epsilonfloat, optional

If a polynomial transform was used, an iterative method is used in place of inversion. The iteration will be terminated after the tolerance is lower than eplison.

xrangetuple of float, optional

(xmin, xmax) range of x values to search

yrangetuple of float, optional

(ymin, ymax) range of y values to search

methodstr, optional

optimization method. See scipy.optimize.minimize for full list of available options.

maxiterint, optional

terminitate search after this many iterations

verbosebool, optional

if True, print convergence messages

directbool, optional

Attempts direct inversion if True, otherwise use a minimization routine.

Returns:
dict
{x0 -> float, y0 -> float,

x1 -> float, y1 -> float, x1ref -> float, y1ref -> float}