findorders

sofia_redux.spectroscopy.findorders.findorders(image, guesspos, sranges=None, step=5, slith_range=None, degree=4, frac=0.8, comwin=5, ybuffer=3)[source]

Determines the position of the order(s) in a spectral image

Parameters:
imagearray_like of float

(nrow, ncol) array from which to find edge coefficients and xranges for each order. Flat field image oriented so that the dispersion axis is roughly aligned with the rows.

guessposarray_like of float

(norders, 2) array giving the (x, y) (col, row) estimate for the center of each order. For example, guesspos[5, 1] gives the center y-position estimate for the 6th order. The positions should be near the center of the order and be located in a region of large flux away from bad pixels.

srangesarray_like of int, optional

(norders, 2) array giving the (start, stop) columns for each order. If None is supplied, sranges is calculated via nantrim over the full x-range of the image.

stepint, optional

Step size in the dispersion (column or x) direction.

slith_rangearray_like of float, optional

(2,) array giving the range of possible slit height in pixels. i.e. (minimum height, maximum height). This is used to make sure the routine doesn’t include bad pixels in the fit.

degreeint, optional

Polynomial fit degree for the edges of the orders.

fracfloat, optional

The fraction of the flux of the center of the slit used to identify the location of the edge of the order.

comwinint, optional

The Center-Of-Mass window giving the number of pixels that should be used to determine an edge position along each column (y-direction).

ybufferint, optional

Buffer in pixels around the edge of the image. Anything inside the buffer is marked as being “off” the image.

Returns:
edgecoeffs, xranges2-tuple of numpy.ndarray

edgecoeffs (norders, 2, degree+1) contains the lower and upper edge polynomial coefficients for each order. For example, the coefficients for the fifth order top edge are found at edgecoeffs[4, 1] while the bottom edge coefficients are at edgecoeffs[4, 0]. xranges (norders, 2) give the x-ranges for each order where the slit is fully on the image, much like sranges.