ap_trace

pydis.ap_trace(img, fmask=(1, ), nsteps=20, interac=False, recenter=False, prevtrace=(0, ), bigbox=15, Saxis=1, display=False)[source]

Trace the spectrum aperture in an image

Assumes wavelength axis is along the X, spatial axis along the Y. Chops image up in bins along the wavelength direction, fits a Gaussian within each bin to determine the spatial center of the trace. Finally, draws a cubic spline through the bins to up-sample the trace.

Parameters
img2d numpy array

This is the image, stored as a normal numpy array. Can be read in using astropy.io.fits like so:

>>> hdu = fits.open('file.fits')  
>>> img = hdu[0].data  
nstepsint, optional

Keyword, number of bins in X direction to chop image into. Use fewer bins if ap_trace is having difficulty, such as with faint targets (default is 50, minimum is 4)

fmaskarray-like, optional

A list of illuminated rows in the spatial direction (Y), as returned by flatcombine.

interacbool, optional

Set to True to have user click on the y-coord peak. (Default is False)

recenterbool, optional

Set to True to use previous trace, but allow small shift in position. Currently only allows linear shift (Default is False)

bigboxfloat, optional

The number of sigma away from the main aperture to allow to trace

displaybool, optional

If set to true display the trace over-plotted on the image

Saxisint, optional

Set which axis the spatial dimension is along. 1 = Y axis, 0 = X. (Default is 1)

Returns
myarray

The spatial (Y) positions of the trace, interpolated over the entire wavelength (X) axis