mktrace¶
Refine a STIS trace table.
A trace is generated from the science file and a trace center is computed.
The two traces bracketing the trace center are extracted from the trace table and interpolated
The correction is computed as the difference between the linear fit to the science and interpolated traces
The correction is applied to all traces in the trace file for that particular OPT_ELEM and CENWAVE
A new trace table is written to the current directory and the relevant keywords are updates in the header of the input file.
Examples¶
Simple example of running mktrace on a STIS file named 'file.fits':
>>> import mktrace
>>> mktrace.mktrace('file.fits', [tracecen=509.4], [weights=[(x1,x2),(x3,x4)])
- Authors:
Author (IDL): Linda Dressel
Python version: Nadia Dencheva
- class stistools.mktrace.Trace(file, kwinfo)¶
Trace class for a crj or flt file.
Notes
tr=Trace(file) file is a crj or flt file.
opt_elem, cenwave, sporder are read from the header of the science file a2center is a2center of the trace generated from the science file
tr_ind= tr.getTraceInd(a2center)
tr_ind is the index of the row in the trace file which brackets from below a2center as computed fro the generated trace
tr.readTrace(tr_ind)
a2center = tr.generateTrace(...)
Methods
gFitTrace
(specimage, y1, y2)Fit a gaussian to each column of an image.
generateTrace
(data, kwinfo[, tracecen, wind])Generates a trace from a science file.
getTraceInd
(a2center)Finds the first trace in the trace table whose A2CENTER is larger than the specified a2center.
openTraceFile
(filename)Returns a spectrum trace table
readTrace
(tr_ind)reads the specified row from the 1dttab.fits
writeTrace
(fname, sciline, refline, ...)The 'writeTrace' method performs the following steps:
- gFitTrace(specimage, y1, y2)¶
Fit a gaussian to each column of an image.
- generateTrace(data, kwinfo, tracecen=0.0, wind=None)¶
Generates a trace from a science file.
- getTraceInd(a2center)¶
Finds the first trace in the trace table whose A2CENTER is larger than the specified a2center.
- openTraceFile(filename)¶
Returns a spectrum trace table
- readTrace(tr_ind)¶
reads the specified row from the 1dttab.fits
- writeTrace(fname, sciline, refline, interp_trace, trace1024, tr_ind, a2disp_ind)¶
The 'writeTrace' method performs the following steps:
Adds sciline-refline to all traces with the relevent OPT_ELEM, CENWAVE and SPORDER.
Writes the new trace table to the current directory.
Updates the SPTRCTAB keyword in the header to point to the new table.
Writes out fits files with the
science trace - '_sci'
the fit to the science trace - '_scifit'
the interpolated trace - '_interp'
the linear fit to the interpolated trace - '_interpfit'
- stistools.mktrace.interp(y, n)¶
Given a 1D array of size m, interpolates it to a size n (m < n).
- stistools.mktrace.mktrace(fname, tracecen=0.0, weights=None)¶
Refine a stis spectroscopic trace.