The routines described below will automatically process CDS data by removing cosmic rays and calibrating, and then allow automatic Gaussian fitting of line profiles. A futher, widget-based routine allows browsing of the fitted data.
WARNING: currently this software is not compatible with sit-and-stare data, or complete NIS spectral data (e.g., NISAT).
The routines described below are available in a tar file.
This routine is called as
IDL> auto_process, a, data
the standard CDS calibration routines are applied, leading to 3D arrays for each wavelength window containing intensities and intensity errors, but not wavelengths (see below for more discussion).
WARNING: if you want to re-process a data-set, you must reload the CDS FITS file with readcdsfits before running auto_process.
The arrays are stored in a structure with the following tags (file s3075r00 is used as an example).IDL> help,data,/str
The PIX array stores the X-pixel numbers for each point in the 3D array. These have been corrected for the CDS spectral tilt, and the scan mirror position, and are suitable to be converted to wavelengths by pix2wave. Although these wavelengths represent the absolute wavelengths, one should be careful about using them for velocity analysis - a better method is to set the zero point velocity from averaged spectra.
The INT array has units of erg cm-2 s-1 sr-1 pixel-1, while the ERR array gives the error on the intensity value. ERR has been derived by assuming photon statistics (see CDS Software Note #49).
For weak lines it is often useful to bin several spatial pixels to improve the S/N. This can be achieved in auto_process as follows:
IDL> auto_process, a ,data, xbin=4, ybin=4
where groups of 4x4 spatial pixels are binned into 1 pixel. Thus for the example above, the spatial dimensions of 60 x 71 are changed to 15 x 17. The error bars on the binned pixels are correctly dealt with, as are missing pixels.
After the processing, the fits for a single emission line across the spatial image can be obtained by doing:
IDL> auto_fit, data, output, wind=4, refwvl=629.732
where WIND=4 selects the O V 629.7 window. A reference wavelength is required to convert the line centroid into a velocity. The CHIANTI database has reference wavelengths for virtually all CDS emission lines. Try, e.g.,
IDL> which_line,'o_5', 629
NOTE: by default the routine uses every pixel in the wavelength window for the fit (although missing data such as cosmic rays are automatically discarded). This is OK for an unblended line centred in its wavelength window, e.g., O V 629.7, but not for other lines. See below for information on dealing with more difficult cases.
OUTPUT is a structure with the following tags:IDL> help,output,/str
The INT, WID, VEL and CHI arrays give the intensity, line width (FWHM), velocity and Chi^2 value at each spatial pixel. LAMBARR gives the wavelength vector at each spatial pixel, while PIX_MIN1 indicates which wavelength pixels were used for the fit at each spatial pixel. AA contains the fit parameters at each spatial pixel.
Sometimes observers choose wavelength windows that are directly adjacent to each other in order to get a contiguous piece of spectrum that will aid in line fitting. A line could thus be partly in both windows, or a piece of "good" background needed to fit the line may lie in the neighbouring window.
To combine two windows when using AUTO_FIT, simply do, e.g.,
IDL> auto_fit, data, output, wind=[4,5], refwvl=629.732
where 4 and 5 are the indices for the windows.
Large wavelength windows can contain two or more emission lines, thus you only want to fit the part of the spectrum containing the line you're interested in. This can be done by giving the /CHOOSE keyword. A graphics window will then appear showing the average profile for the specified wavelength window. Click twice with the mouse to select the sub-region that you want to fit.
To precisely specify which pixels are to be included in the fit, one can use the PIXMAP input. For example, if a wavelength window is 40 pixels wide, then one can do
IDL> auto_fit, data, output, wind=4, refwvl=629.732, pixmap=pixmap
where only pixels 0:4, 15:26 and 32:37 will be used in the fit.
A widget-based routine is available to view the results from the fitting, and is called as
IDL> fit_viewer, data, output
The top 3 graphics windows give intensity, velocity and line width maps. They are all clickable with the mouse. The button widget on left-hand side gives the 'mouse mode'. When set to ZOOM, clicking-and-dragging the mouse across the image opens a rubber-band box for zooming into the images. When set to PIXEL, clicking on individual pixels in the images, brings up the line profile in the graphic window in the bottom left corner.
The graphic window in the bottom right shows an intensity histogram for the whole image.
WARNING: Currently the button widgets in the bottom half of the GUI do not work!