trim_xy

sofia_redux.spectroscopy.rectifyorder.trim_xy(xarray, yarray, xgrid, ygrid, ybuffer=None, xbuffer=None, xrange=None, yrange=None)[source]

Trim rows and columns from the edges of the coordinate arrays.

Parameters:
xarraynumpy.ndarray

(nrows, ncols) array of x-coordinates

yarraynumpy.ndarray

(nrows, ncols) array of y-coordinates

xgridnumpy.ndarray

(ncols,) array of x-coordinates along the x-axis of the rectified arrays.

ygridnumpy.ndarray

(nrows,) array of y-coordinates along the y-axis of the rectified arrays.

ybufferint, optional

number of pixels to cut from the top and bottom of the arrays

xbufferint, optional

number of pixels to cut from the left and right of the arrays

xrangearray_like of float

(2,) [lower limit, upper limit] defining the range of valid x values.

yrangearray_like of float

(2,) [lower limit, upper limit] defining the range of valid y values.

Returns:
numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray

(xarray2, yarray2, xgrid2, ygrid2) where array dimensions may be smaller than the original input arrays.