adjustguesspos

sofia_redux.spectroscopy.adjustguesspos.adjustguesspos(edgecoeffs, xranges, flat, ordermask, orders=None, cor_order=None, ybuffer=0, default=False)[source]

Adjust the guess positions via cross-correlation

Performs a vertical cross-correlation between the order mask and the raw flat field of a single order to identify the shift between the two. This shift is subtracted from the guess positions. The xranges are then checked to ensure the order range does not fall off the array.

Parameters:
edgecoeffsarray_like of float (norders, 2, order+1)

Polynomial coefficients which define the edges of the orders. edgecoeffs[0, 0, :] are the coefficients of the bottom edge of the first order and edgecoeffs[0, 1, :] are the coefficients of the top edge of the first order.

xrangesarray_like of float (norders, 2)

Column numbers between which the orders are completely on the array.

flatarray_like of float (nrow, ncol)

Raw flat field

ordermaskarray_like of int (nrow, ncol)

Array where each pixel is set to its order number. Interorder pixels are set to zero.

ordersarray_like of int (norders,), optional

Order numbers to process. Set to all by default.

cor_orderint, optional

The order with which o do the cross-correlation. Will default to the first order in orders.

ybufferint, optional

The number of pixels to buffer from the top and bottom of the array.

defaultbool, optional

If True, return the default guess positions and xranges.

Returns:
guess, xrangesnumpy.ndarray, numpy.ndarray

The adjusted guess positions and xranges. Both of type int and size (norders, 2). guess[:, 0] = y-guess and guess[:, 1] = x-guess.

Notes

If the range falls off the array, this will be marked by xrange = [-1, -1] for the affected order.