| mkmultispec | stsdas.hst_calib.ctools | mkmultispec |
mkmultispec -- Create a MULTISPEC WCS based on wavelength tables.
mkmultispec input wave output
This task takes input spectra and wavelength tables, uses the IRAF curfit routines to fit the wavelength table, creates a MULTISPEC world coordinate system (WCS) description of the fit and creates a new copy of the input spectrum with the new WCS.
This task is intended to be used with the Hubble Space Telescope (HST) spectrographic data from Faint Object Spectrograph (FOS) and Goddard High Resolution Spectrograph (GHRS) to merge the wavelengths that result from the calibration into the data itself so that other IRAF tasks, such as splot, may be used. However, this task is general; any wavelength image or table may be applied to any one dimensional spectrum. The task does not create the appropriate MULTISPEC WCS for multiple one-dimensional spectra stacked into a two dimensional data format.
There are four functions that can be fit to the wavelength data: legendre, chebyshev, spline1, and spline3. Also, there is a table function which copies the input wavelengths into the header of the output spectral file.
mkmultispec operates in two modes: interactive or non-interactive. By default, non-interactive mode is used. In non-interactive mode, fitting information is taken from the parameters and the same fit is applied to all input. In interactive mode, mkmultispec uses the IRAF icfit task which allows users to modify fit parameters and review results---such as residuals.
Data files to be modified are specified by the input parameter. Output files will be written using the names specified by the output parameter. input and output must contain the same number of values (file names). If output is not specified, the files will be modified in-place and existing values overwritten.
The wave parameter specifies the list of files that contain tables of wavelengths. These can either be one-dimensional images or tables. You can specify just one wavelength file or as many wavelength files as there are output files. If only one wavelength file is specified, one wavelength solution will be applied to all input files. There must be as many wavelengths in the wavelength image or table as there are pixels in the corresponding input image.
The weight parameter specifies a list of files containing relative weight information to apply to the wavelength information while fitting. There can be one weight file specified, or the same number of weight files as wavelength files. If only one weight file is specified, the same weight is used for all input wavelength files. Each weight file is either a one-dimensional image or a table. There must be as many weight values in the image or table as there are wavelengths in the corresponding wavelength file. The values in the weight files should be real values between 0. (no weight) and 1. (full weight).
mkmultispec handles multi-group data automatically. The solution for each group of the current wavelength file will be applied to the corresponding group in the current input file. If the input file has more groups than the wavelength file, the fit for the last group of the wavelength file will be applied to the remaining groups of the input file. For example, if the input file has four groups of spectra and the wavelength file has four groups of wavelengths, a fit will be determined for the first wavelength group and applied to the first input group, a fit will be determined for the second wavelength group and applied to the second input group, etc. However, if the input file has four groups of data and the wavelength file only has one group, the fit to the one group of wavelength data will be applied to all four groups of the input file.
The concept of groups has been extended to tables as well. If a table is specified for the wavelengths or weights and no column is specified, mkmultispec assumes that all columns of the wavelength table contain wavelength information. For example, for a four-group input file and a wavelength table containing four columns of wavelengths, a fit will be made to the first column and applied to the first input group, a fit will be made to the second column and applied to the second input group, etc. This behavior can be changed as described above, or by specifying a specific column or list of columns with the wavelength table name. (See the description of the wave parameter for examples of the syntax to be used).
In interactive mode, mkmultispec displays the results of the fit with the current fit parameters and the current wavelength or weight information. While the image is displayed, you can examine statistics about the current fit. For example, pressing the "j" key will display the residuals of the fit, The "h" key will redisplay the fit. If some parameter of the fit needs to be changed, you can use the "colon" commands. For example, to see what the current function is, type the sequence ":function". To change the function, for example from spline3 to legendre, type the sequence ":function legendre". Pressing "q" exits interactive mode for the current fit and applies the fit to the input spectrum. If a list of wavelengths was given, the process repeats.
Once you are satisifed with the fitting parameters, you can apply them to all remaining input files instead of going through each fit. To do this, press "e". The "e" key applies the current fit to all remaining input. This will let you try a couple fits, then tell mkmultispec to apply the fit to all remaining input without further interaction. (Type "help icfit" for a list of the interactive keystroke commands.)
For more information about the MULTISPEC world coordinate system, type "help onedspec.package". For more information about the interactive curve fitting routine, type "help icfit".
These should be one-dimensional spectra and can be either regular IRAF images or Space Telescope multigroup data.
If only one wavelength table is specified, the resulting MULTISPEC WCS will be applied to all input spectra. If more than one input wavelength is specified, there must be the same number of wavelength specifications as input spectra. The files may either be a tables or images. If a file is a table, the columns to use are specified as follows: tablename[columnname1,columnname2,...]. If no columns are specified, mkmultispec assumes all columns contain wavelength information.
If this parameter is blank, the spectra will be modified in-place. If file names are specified, there must be the same number of output spectra as input spectra.
The type of function to fit to the wavelength tables. If "table" is specified, the wavelength data are written directly into the input file headers. If the input is multigroup and "table" is specified, only one table will be applied to all the groups of the input. If interactive mode was choosen, the parameter will be set to the last function specified by the ":function" command.
If this is blank, uniform weights will be given to all points. The weights can either be in a table or one dimensional image. If only one weight file is specified, it is applied to every input spectrum. If more than one is given, there must be the same number of input spectra as weight files. If the file is a table, the column to use for the weight data can be specified as follows: filename[columnname1, columnname2,...]. If no columns are specified, mkmultispec assumes all columns contain weight information.
The following parameters apply only for interactive fitting.
If you are rejecting many points, you might not want to mark rejected points. If interactive mode was choosen, this parameter will be set to the last value specified by the ":markrej" command.
1. Take all the calibrated data from HRS observations and define the MULTISPEC header information. Put the results into new files where the rootnames end in "_wcs".
hr> mkmultispec z*.c1h z*.c0h z*%%_wcs%.c1h
2. Fit the wavelengths stored in the table wave.tab under column "wavelength" to all FOS observations in the current directory. Modify the data in-place.
hr> mkmultispec y*.c1h wave.tab[wavelength] ""
3. Fit the wavelength information stored in the fourth group of the image wave.hhh and apply it to the first group of the image spectrum.hhh. Write the result to the file out.hhh. out.hhh will contain only the one group of data.
hr> mkmultispec spectrum.hhh[1] wave.hhh[4] out.hhh
4. Apply the wavelength solutions found in wave.hhh to the spectra in spectra.hhh and write the results to out.hhh. Both input files contain four groups and the fitting will be done interactively.
hr> mkmultispec spectra.hhh wave.hhh out.hhh interactive=yes
...The fit for the first group of 'wave.hhh' is displayed.
...To see what function is being fit, type:
:function
...And it displays:
--> spline3
...Change the function to "legendre":
:function legendre
:function
--> legendre
...To refit with the new function, press the "f" key.
f
...To use this fit, press "q"
q
...The fit for the next group appears. To use this
...fit for this and all remaining groups, press "e".
e
...At this point, the fitting is completed.
curfit, icfit, splot, onedspec