The p3d logo. a general data-reduction tool for fiber-fed integral-field spectrographs
About p3d

Readme

Download

References

Documentation & Tutorials

Links

Screenshots

Authors & Thanks

MUSE cubes

Sourceforge project page

Category: wavelength calibration

Summary

PROp3d_wavecal_calculate_mcurv
Given an input image, a spectrum bin (SPECBIN) and a spectrum number (SPECNUM), this routine first locates the maximum position of an emission line on the dispersion axis.
PROp3d_wavecal_correct_maskpos
This routine calculates corrected positions for a list of calibration lines in every spectrum of a supplied spectrum image.
PROp3d_wavecal_delete_spec
Deletes numbered spectra in an input image.
PROp3d_wavecal_dispersion_correction
Resamples spectra from pixel units to wavelength-calibrated units.
PROp3d_wavecal_dispmask_add_spec
This routine adds numbered rows to a dispersion mask, that is given in parameter form.
PROp3d_wavecal_dispmask_gui
This is an interactive program for creating a dispersion mask.
PROp3d_wavecal_dispmask_gui_event
Handles widget events for p3d_wavecal_dispmask_gui.
PROp3d_wavecal_dispmask_gui_event_calc_linearlambda
.
PROp3d_wavecal_dispmask_gui_event_plot
Handles plot events of the dispersion-mask GUI.
FUNCTIONp3d_wavecal_dispmask_gui_imcombine
Combines images for p3d_wavecal_dispmask_gui.
PROp3d_wavecal_fit_maskwd
This is the routine where the actual wavelength calibration takes place.
PROp3d_wavecal_grating_eq
Computes various parameters using the grating equation.
PROp3d_wavecal_match_maskwd
This routine finds out which lines in the calibration line list (REFWAVE, at positions REFPIXL) are actually found in the spectrum SPEC(WAVELEN).
PROp3d_wavecal_set_linelist
The purpose of this routine is to provide line-list filenames for wavelength calibration.
PROp3d_wavecal_unfold_dispmask_file
This routine reads a dispersion mask file, that contains the polynomial fitting parameters, and sets up a matrix with a wavelength array for every spectrum.

Copyright

p3d: a general data-reduction tool for fiber-fed IFSs

Copyright 2009-2011, 2014, 2015, 2017, 2019 Leibniz Institute for Astrophysics Potsdam (AIP)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.

Additional permission under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or combining it with IDL (or a modified version of that library), containing parts covered by the terms of the IDL license, the licensors of this Program grant you additional permission to convey the resulting work.

Routine Documentation

routines/p3d_wavecal_calculate_mcurv.pro, line 128, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_calculate_mcurv, image, specbin, specnum, out, deadfibers=, sdeadfibers=, linewidth=, crosswidth=, topwid=, logunit=, verbose=, error=, /debug, /help

Given an input image, a spectrum bin (SPECBIN) and a spectrum number (SPECNUM), this routine first locates the maximum position of an emission line on the dispersion axis. Thereafter the same line is searched for in all other spectra in the image; these positions are compared to that of the first determined position using a cross- correlation method.

Input parameters:
imageA two-dimensional emission line image.
specbinInitial spectrum bin to look for an emission line in (in the dispersion direction).
specnumInitial spectrum to look for an emission line in (in the cross-dispersion direction).
Keyword parameters:
deadfibersA one-dimensional array of integers specifying which fiber positions are to be interpolated instead of fitted.
sdeadfibersA one-dimensional array of strings containing the type of the dead fibers. If this input is not used then all elements of DEADFIBERS are considered to be 'dead'. If it is set then the low-transmission fibers, which are indicated with the prefix 'low' (lower case) are sorted out, and are thereby considered to be normal fibers.
linewidth[specbin-linewidth,specbin+linewidth] defines the interval, where the line will be searched for initialization. The default value is: 5
crosswidthThe width of an interval around the emission line that is defined for cross-correlating the spectra. The default value is: 3 * linewidth
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outAn array containing the line geometry (x-positions of the emission line) for every spectrum.

routines/p3d_wavecal_correct_maskpos.pro, line 168, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_correct_maskpos, refimage, linepos, lwid, out, inlines, niterat=, offsets=, dooffsets=, refrow=, fwhm=, method=, deadfibers=, sdeadfibers=, /monitor, monk=, colorbg=, colorfg=, colorxb=, stawid=, topwid=, logunit=, verbose=, error=, /debug, /help

This routine calculates corrected positions for a list of calibration lines in every spectrum of a supplied spectrum image. The method is either 'Gaussian' (the default), or 'Weighted'. The results should be much more accurate using Gaussian line centering than using a data- weighted centering. The approach using Gaussian fitting is, however, much more time-consuming.

Input parameters:
refimageA one- or two-dimensional array; of floating point type. It is assumed that the dispersion axis is the first dimension in REFIMAGE.
lineposA one-dimensional array.
lwidThe width of the region, which is used to integrate over the emission lines; given in pixels.
Keyword parameters:
niteratThe maximum number of iterations; a scalar integer <= 100. Only used with METHOD = 'Weighted'. The default value is: 5
offsetsSpecifies an array of offsets between the different spectra.
dooffsetsCalculates the offset array between the different spectra anew.
refrowThe starting spectrum. The default value is: s[2
fwhmA scalar decimal value with the instrumental line width in the dispersion dimension. Only used with METHOD=='Gaussian'.
methodA scalar string that defines the method to be used when calculating more precise line center positions: ['Gaussian'] or 'Weighted'.
monitorIf set to 1, Gaussian fits are shown for the reference spectrum. If MONITOR = 2, the fit is shown for all spectra. If MONITOR = 3, all fits are shown for the arc line MONK.
monkAn integer scalar, set to a value between 0 and the number of elements in LINEPOS – 1; this variable is only used if MONITOR = 3.
deadfibersA one-dimensional array of integers specifying which fiber positions are to be interpolated instead of fitted.
sdeadfibersA one-dimensional array of strings containing the type of the dead fibers. If this input is not used then all elements of DEADFIBERS are considered to be 'dead'. If it is set then the low-transmission fibers, which are indicated with the prefix 'low' (lower case) are sorted out, and are thereby considered to be normal fibers.
colorbgThis scalar integer contains the background color index.
colorfgThis scalar integer contains the foreground color index.
colorxbThis scalar integer contains the additional foreground color index.
stawidIf set to a valid ID then a log message is written using this ID for relevant actions.
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outA two-dimensional array of corrected positions for every calibration line in every spectrum.
inlinesA one-dimensional array specifying for which lines in LINEPOS that corrected positions could be calculated. If none, INLINES = – 1L.

routines/p3d_wavecal_delete_spec.pro, line 105, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_delete_spec, inspec, rownum, outspec, daxis=, topwid=, logunit=, verbose=, error=, /debug, /help

Deletes numbered spectra in an input image.

Input parameters:
inspecA two-dimensional array of decimal type.
rownumA one-dimensional array of integer indices indicating which rows of INSPEC are to be removed.
Keyword parameters:
daxisSpecifies the dispersion axis of INSPEC. The default value is: 1
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outspecA two-dimensional array with the spectra indicated by ROWNUM removed from INSPEC.

routines/p3d_wavecal_dispersion_correction.pro, line 843, last changed at 2020-10-06 by christersandin (revision 5477)

p3d_wavecal_dispersion_correction, stack, waves, crval, cdelt, out, dout, dstack=, incdelt=, incrval=, npix=, /drizzle, resample_startpx=, combined_out=, combined_dout=, obpmask=, oobpmask=, combined__oobpmask=, satmask=, osatmask=, combined__osatmask=, /originalerrors, skyalign=, /oneskyoffset, maxskyoffset=, /dpath, daxis=, deadfibersmask=, psfilename=, /a2, /a3, /a5, /letter, /legal, /tabloid, nthreads=, /use_ifu, topwid=, logunit=, verbose=, error=, /debug, /cdebug, /help

Resamples spectra from pixel units to wavelength-calibrated units.

This routine contains an algorithm that applies a dispersion correction on a stacked spectrum image, given a wavelength template, which is an image of the same size as the input image.

By default, the routine uses a one-dimensional drizzling algorithm. The one-dimensional drizzle algorithm is implemented using the approach of Fruchter & Hook (2002; eqs. 4 & 5).

The second option is a linear interpolation; when DRIZZLE is unset, or the error image is missing. The errors were earlier calculated using an erroneuous approach – set the ORIGINALERRORS keyword to force the use of this approach. Now the errors are calculated using the approach as presented by Bevington (1992 or 2002; chapter 4 [Estimates of mean and errors], and the sub-sections "Weighting the Data – Nonuniform Uncertainties" and "Error in the Weighted Mean", specifically Eq. 4.19) or Taylor (1997; chapter 7 [Weighted averages]). The approach of Fruchter & Hook (2002) differs slightly, as it contains additional weighting of the data with the used pixel fraction and relative input/output pixel size.

Comments

This routine will produce several hundreds of megabytes and more of log-file output when LOGLEVEL>=3, which might cause problems if there is little free diskspace.

References

Bevington, P.R., Robinson, D.K. 1992 (2002), "Data reduction and error analysis for the physical sciences", 2nd (3rd) Ed. (McGraw Hill)

Fruchter, A.S., Hook, R.N. 2002, PASP, 114, 144, "Drizzle: A Method for the Linear Reconstruction of Undersampled Images"

Taylor, J.R. 1997, "An introduction to error analysis, the study of uncertainties in physical measurements", 2nd Ed. (University Science Books)

Input parameters:
stackA three- (or two-)dimensional array of stacked image data.
wavesA two-dimensional array of floating point type, that specifies a value on the wavelength for every pixel.
Keyword parameters:
dstackIf present, this is the error in STACK. The dimensions of DSTACK must be the same as those of STACK.
incdeltA decimal scalar (USE_IFU set) or an array of decimal values (USE_IFU unset) that specifies the wavelength bin width (dispersion) [Å/pixel].
incrvalA decimal scalar (USE_IFU set) or an array of decimal values (USE_IFU unset) that specifies the the wavelength of the first pixel [Å].
npixA scalar integer (USE_IFU set) or an array of integers (USE_IFU unset) that specifies the number of wavelength bins.
drizzleSet this keyword to use a one-dimensional drizzling algorithm instead of the standard linear interpolation. The default value is: 1
resample_startpxA scalar value that specifies the starting pixel in the calculation of the output wavelength array when resampling pixel values to wavelength values. The value can be set to 'first', 'middle' [default], or 'last', to use of the first, the middle, or the last output pixel as a starting point. Alternatively, it can be set to an integer within the same range. Negative values, and values that are higher than the maximum number of pixels, short of one, are truncated. The default value is: 'middle'
combined__outA one-dimensional array with the combined wavelength calibrated spectrum (only calculated when USE_IFU is unset).
combined__doutThe resulting error of the extraction spectrum COMBINED__OUT; this variable is only calculated when USE_IFU is unset and DSTACK is set.
obpmaskA two-dimensional array of the same size as STACK, containing an output bad-pixels mask. If this keyword is set, the contents are also converted to wavelength coordinates; the output is stored in OOBPMASK.
oobpmaskIf OBPMASK is set, this keyword contains the converted output bad-pixels mask image upon exit. The dimensions are the same as those of OUT.
combined__oobpmaskIf USE_IFU is unset and OBPMASK is set, this keyword contains the converted output bad-pixels mask image of the combined spectrum upon exit. The dimensions are the same as those of COMBINED__OUT.
satmaskA two-dimensional array of the same size as STACK, containing a saturated-pixels mask. If this keyword is set, the contents are also converted to wavelength coordinates; the output is stored in OSATMASK.
osatmaskIf SATMASK is set, this keyword contains the converted saturated-pixels mask image upon exit. The dimensions are the same as those of OUT.
combined__osatmaskIf USE_IFU is unset and OSATMASK is set, this keyword contains the converted output saturated-pixels mask image of the combined spectrum upon exit. The dimensions are the same as those of COMBINED__OUT.
originalerrorsSet this keyword to use the original version of the calculated errors (with the linear interpolation scheme).
skyalignThis keyword can be used in two ways:

  • Set it to a scalar string with the name of an existing file with a list of telluric (sky-emission) lines.

  • Set it to a floating-point value array with pre-selected telluric-line wavelengths.

This way the wavelength solution is aligned with the median of the telluric-line offset positions. Only the fylly working spectra/fibers are used when calculating the offset if DEADFIBERSMASK is specified. Also see the ONESKYOFFSET and the MAXSKYOFFSET keywords.
oneskyoffsetSet this keyword to use one median offset value on all wavelength arrays in the dispersion mask. Otherwise, each wavelength array in the dispersion mask is offset individually. Additionally, when this parameter is unset the offset at each wavelength bin is weighted with the wavelength extent of the pixel relative to the corresponding extent at the selected sky-emission line (since uncalibrated wavelength arrays generally deviate from a linear function).
maxskyoffsetA scalar decimal value that when multiplied with the pixel dispersion (CDELT) specifies the maximum allowed offset of the sky-emission lines, from the location provided in the dispersion mask. The unit is Angstrom. A higher value than the default of 2.0 * CDELT could be used in case the expected offset due to flexure is higher. (Otherwise such lines are ignored.) The default value is: 2.0
dpathIf this keyword is set, SKYALIGN is passed through p3d_misc_pathify with dpath set.
daxisSpecifies the dispersion axis of STACK; 1 is the x-axis, 2 is the y-axis. The default value is: 1
deadfibersmaskAn integer array with as many elements as there are spectra in STACK. The elements must each have the value 0 (the fiber is dead, should not be used, is a low-transmission fiber) or 1 (the fiber can be used). This mask is used when fitting telluric emission lines.
psfilenameSet this scalar string to the name of the postscript file that will be created to show the fits of the telluric lines (when using SKYALIGN).
a2Set this keyword to use the A2 paper format with PostScript and PDF output instead of A4.
a3Set this keyword to use the A3 paper format with PostScript and PDF output instead of A4.
a5Set this keyword to use the A5 paper format with PostScript and PDF output instead of A4.
letterSet this keyword to use the US Letter paper format with PostScript and PDF output instead of A4.
legalSet this keyword to use the US Legal paper format with PostScript and PDF output instead of A4.
tabloidSet this keyword to use the US Tabloid paper format with PostScript and PDF output instead of A4. (see p3d_misc_plotallspectra.)
nthreadsA scalar integer that specifies how many threads to use in the parallelized dispersion correction calculation. The default value is: 1
use_ifuAll spectra in STACK use the same dispersion solution when this keyword is set. Otherwise, they use different solutions.
topwidIf set, error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
cdebugA keyword as DEBUG used with the called C routines.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
crvalA decimal scalar that specifies the wavelength of the first pixel.
cdeltA decimal scalar that specifies the dispersion per pixel for output images, which are linearized in wavelength.
outA three- (or two-)dimensional array of stacked images, which have been wavelength calibrated.

routines/p3d_wavecal_dispmask_add_spec.pro, line 115, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_dispmask_add_spec, inparams, rownum, outparams, topwid=, logunit=, verbose=, error=, /debug, /help

This routine adds numbered rows to a dispersion mask, that is given in parameter form. Each added row holds the same parameters as the preceeding row. A purpose of this routine is to add calibration spectra for instance, which were not used in the creation of the dispersion mask.

Input parameters:
inparamsA structure that contains a two-dimensional array (c) with parameters of the polynomial fit (2nd dimension) of the wavelength array. Different spectra are stacked in the first dimension. Additionally, another array (m) holds the minimum and the maximum pixel values that were used to scale the pixel array before calling poly_fit.
rownumA one-dimensional array of integer indices indicating where to add lines.
Keyword parameters:
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outparamsA two-dimensional array with the parameters of the polynomial fits – with added rows (according to ROWNUM).

routines/p3d_wavecal_dispmask_gui.pro, line 694, last changed at 2020-12-01 by christersandin (revision 5487)

p3d_wavecal_dispmask_gui, imagefile, linelist, gratingfile, ofilename, dispmaskin=, linewidth=, refdist=, nrows=, kwrdlist=, cdelt=, xdeg=, ydeg=, saved=, colortable=, /invert, /cinv, bottom=, cindex=, cindv=, ch_start=, ch_rots=, ch_gamma=, ch_hue=, residualcut=, fwhm=, postable=, /posreverse, deadfibers=, sdeadfibers=, /removecalfibers, linelistilimit=, vignettedfile=, /compactview, userparfile=, imageorder=, imagesplitbin=, /dflip, /use_ifu, /compress, dbin=, track=, detector=, daxis=, eventwid=, topwid=, logunit=, verbose=, font=, error=, /debug, /cdebug, /help

This is an interactive program for creating a dispersion mask. That is, a file listing the best-fit dispersion solution parameters for each spectrum in the input image.

The contents of the GUI are described in detail in the documentation of the tool p3d_cdmask. Here is a brief summary of what this routine does.

The GUI layout displays this input RSS image in the top panel. A "reference spectrum" plot is shown below that. The currently viewed wavelength range is shown between the two panels.

The initial dispersion mask is a set of straight lines given by the input line list. This mask is overlaid on the RSS image. The user can modify the initial mask as follows:

  • Match the shape of the mask lines to the curvature of the emission lines in the RSS image.

  • Shift and centroid the mask so that it is spatially aligned with the emission lines in the RSS image.

  • Optionally, delete mask lines from the input line list.

  • Inspect the best-fit dispersion solution for the reference spectrum and change the order of the best-fit polynomial if necessary.

  • When the match between the mask and the data of the RSS image is satisfactory, create the output dispersion mask and save it to a FITS file.

Format of files with lists of arc lines:

  • Lines that begin with the character ';' are comments.

  • Individual lines are specified with the wavelength and an optional relative intensity (the two values are separated by whitespace). The wavelength unit is by default Angstrom [Å]. The unit can be set by prefixing a line in the file header with the string "; wavelength unit: ". These are the available options:

    + "µm", "micrometer", "micron": Micro meter (1e-4 cm).

    + "nm", "nanometer": Nano meter (1e-7 cm).

    + "Angstrom", "Å" [default]: Ångström (1e-8 cm).

  • All arc line entries are kept unless the intensity is lower than a limit value that is set with the keyword LINELISTILIMIT.

Input parameters:
imagefileOne, or two, filename(s) of an exposure, which was taken using one, or several, arc lamps. If IMAGEFILE is actually two image files, they are combined using the values of IMAGEORDER and IMAGESPLITBIN:

IMAGEORDER = 0

The used image uses the wavelength bins 0:IMAGESPLITBIN – 2 from IMAGEFILE[0] and IMAGESPLITBIN: from IMAGEFILE[1].

IMAGEORDER = 1

The used image uses the wavelength bins 0:IMAGESPLITBIN – 2 from IMAGEFILE[1] and IMAGESPLITBIN: from IMAGEFILE[0].

The lowermost value of IMAGESPLITBIN is 1.
linelistThe filename of a file specifying which wavelengths are emission lines of the arc lamp. Note! This variable is not used if DISPMASKIN is set and that file also contains the ARCLNNUM and the ARCLxxx header keywords. The routine must still be called with this keyword present!
gratingfileThe filename of an instrument-specific file that provides grating-related parameters.
ofilenameThe filename of the output dispersion mask.
Keyword parameters:
dispmaskinA scalar string with the name of a dispersion-mask input file. When present this file is used to create the first-guess wavelength solution. Note! If DISPMASKIN is set, this routine attempts to read the line list from the header keywords in this file; specifically, the required information is contained in the ARCLNNUM and the ARCLxxx header keywords. (These are available in any dispersion-mask image created using revision >= 1004 of this routine.)
linewidthA scalar integer that specifies the half-pixel- width used when searching for maxima of emission lines in the spectrum image (of IMAGEFILE). The default value is: 4
refdistA scalar integer specifying if any spectrum is to be skipped. If REFDIST = 1, all spectra are used, if REFDIST = 2, every second spectrum is used, etc. (cf. REFDIST in p3d_wavecal_fit_maskwd). The default value is: 1
nrowsA scalar integer specifying how many adjacent spectra should be used in the fitting procedure (the actual number is 2 * NROWS + 1). The default value is: 0
kwrdlistThe name of a file, which contains a two-column list of parameters to use with p3d for the instrument in question.
cdeltThe dispersion (only used when PMAS = 0).
xdegThe degree of the polynomial used to fit emission-line wavelengths to the full spectrum. The default value is: 3
ydegThe degree of the polynomial used to fit emission-line wavelengths on the cross-dispersion (spatial) axis; YDEG = – 1 skips this fitting. The default value is: -1
colortableA scalar string or integer that specifies which color table should be loaded. If COLORTABLE is a string, the string must contain two parts separated by a comma, without any whitespace between. The first part before the comma specifies the color-table number in the file name specified after the comma; the file must be formatted as described in the documentation for MODIFYCT. As an example, COLORTABLE='25,brewer.tbl'. Components in the ColorBrewer color-table file "brewer.tbl" found in the resource directory can be specified explicitly by preceeding the string with "CB"; for example, COLORTABLE='CB25'. If COLORTABLE is an integer, the integer must be given in the range -4, -3, -2, -1, 0, ..., up to the maximum number of available tables in IDL, plus the available tables in the ColorBrewer file (resource/) "brewer.tbl". Select -4, -3, -2, or -1 to load the cubehelix, 2 * Califa, and the Sauron color tables, the other values use the respective color map as defined by LOADCT. These are the permitted values:

-4

Loads the cubehelix color table.

-3

Loads the Califa project intensity color table, as defined September 2012.

-2

Loads the Califa project velocity field color table, as defined September 2012.

-1

Loads the Sauron color table (default).

0-74 (IDL version >= 8.3)

Loads the corresponding color table with LOADCT.

0-40 (IDL version < 8.3)

Loads the corresponding color table with LOADCT.

'CB0'-'CB85'

Loads the corresponding ColorBrewer color table; the color tables are defined in the file "resource/brewer.tbl"

75-159 (IDL version >= 8.3)

Loads the ColorBrewer color table corresponding to this number after 75 is subtracted; the color tables are defined in the file "resource/brewer.tbl"

41-125 (IDL version < 8.3)

Loads the ColorBrewer color table corresponding to this number after 41 is subtracted; the color tables are defined in the file "resource/brewer.tbl"

'x,ctfile'

Loads the x:th entry ('x' must be an integer) in the color-table file 'ctfile.

The default value is: -1
invertSet this keyword to invert the loaded color table.
cinvSet this keyword to plot white lines on a black background instead of the default, which is to plot black lines on a white background.
bottomA scalar integer that specifies the bottom color map index to use with the data; 0 <= BOTTOM <= !d.table_size – 1.
cindexAn array of integers specifying the color indices used as reserved colors. CINDEX ideally has 7 elements, P3D_SV uses 7 reserved colors. If the number of elements is smaller, the upper range of reserved colors will use the largest index available (also see CINDV).
cindvAn array of 7 integers specifying which of the indices in CINDEX are used as the reserved colors: If CINDEX has 7 elements, CINDV = CINDEX[0:6]. If CINDEX has 3 elements, CINDV = [CINDEX[0], CINDEX[1], CINDEX[2], CINDEX[2], CINDEX[2], CINDEX[2], CINDEX[2]].
ch_startThis scalar decimal value defines the color when colortable = -4. The default value is: 0.5
ch_rotsThis scalar decimal value defines the rotation in color when colortable = -4. The default value is: -1.5
ch_hueThis scalar decimal value defines the hue intensity scaling when colortable = -4. The default value is: 1.2
ch_gammaThis scalar decimal value defines the gamma correction factor when colortable = -4. The default value is: 1.0
residualcutA scalar floating-point type value. During the polynomial fitting, to get the dispersion solution, residuals > RESIDUALCUT will not be used in a second fit. The default value is: -1
fwhmA scalar floating-point type value with the instrumental line width in the dispersion dimension.
methodA scalar string with the name of the method used when centering lines; ['Gaussian'] and 'Weighted' are implemented, see p3d_wavecal_correct_maskpos.
postableA scalar string that contains the name of a position-table file; this file is, if present, used to remove calibration elements in the data before the tool is setup.
posreverseThe position-table arrays are reversed (x, y, and lens size) when this keyword is set.
deadfibersAn array of integers specifying dead fibers, which should not be considered. The values must be 1-based, and the maximum number must be smaller than the maximum number of spectra in the input image file.
sdeadfibersA string array with as many elements as DEADFIBERS specifying the type of fiber in DEADFIBER (dead, low transmission, unused,...).
removecalfibersn/a. bration fibers are removed from the data before ling the data if this keyword is set. The default value is: 1
linelistilimitA scalar decimal value that sets the upper limit used when reading the arc line-list file.
vignettedfileA scalar string that contains the name of a vignetted fibers file; the contents of this file is used to remove arc lines in vignetted regions, before a polynomial is fitted as wavelength(pixel).
compactviewSet this keyword to use the lower spectrum plot region when showing quality plots; this is useful when there are very few spectra, in which case the upper draw widget will be too small to show plots in. The default value is: 0
userparfileA scalar string specifying the name of an optional user-parameter file, that could contain the keyword 'polynomialorder'. If it does, the value of that keyword is used instead of XDEG. If there are several 'polynomialorder'-lines in the file, only the first is used.
imageorderA scalar integer that is used if the number of files specified in IMAGEFILE is equal to two. For the use, see the description of the input parameter IMAGEFILE. The default value is: 0
imagesplitbinA scalar integer used if the number of files specified in IMAGEFILE is equal to two. For the use, see the description of the input parameter IMAGEFILE. The default value is: 0.5*# pixels in dispersion direction of IMAGEFILE[0
dflipSpectrum order; if dflip is set, it is assumed that the wavelength range has been flipped. The default value is: 0
use_ifuUnset this keyword to work with spectrum orders instead of an IFU. In this case, it is necessary to create a dispersion function for each order separately. The default value is: 1
compressIf this keyword is set, the output data file is compressed (using gzip). The default value is: 0
dbinThis parameter determines if the input data are re- binned on the dispersion axis (DBIN = 2 || 3), or if the data are kept as is (DBIN = 1). A good reason to rebin the data is if all pixels should fit on the screen. The different values allowed are: DBIN = 1: The data are not rebinned. DBIN = 2: The data are rebinned by a factor 2. DBIN = 3: The data are rebinned by a factor 2 until all pixels fit on the screen. The default value is: 1
trackA keyword specifying if hints are to be shown about what is being done and what the functions of the various widgets are.
detectorA scalar integer specifying which detector (setup) to use; this keyword should only be used if several detectors are configured in the used instrument-parameter file.
daxisDefines the dispersion direction dimension of the data of IMAGEFILE. The default, 1, is in the x-direction. The default value is: 1
eventwidIf this variable is set to the widget id of a button widget, that widget will receive an event once the GUI created here is closed.
topwidIf set, error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

fontSet this scalar string to the name of the font to use with all widget components of this tool.
errorThis scalar integer returns an error code if set; any non-zero value indicates that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
cdebugA keyword as DEBUG used with the called C routines.
helpSet this keyword to show this routine documentation and then exit.

routines/p3d_wavecal_dispmask_gui_event.pro, line 515, last changed at 2021-12-28 by christersandin (revision 5584)

p3d_wavecal_dispmask_gui_event, event

Handles widget events for p3d_wavecal_dispmask_gui.

routines/p3d_wavecal_dispmask_gui_event_calc_linearlambda.pro, line 66, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_dispmask_gui_event_calc_linearlambda, state

.

Input parameters:
stateThe state structure of p3d_wavecal_dispmask_gui.

routines/p3d_wavecal_dispmask_gui_event_plot.pro, line 68, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_dispmask_gui_event_plot, state, xtra_x, xtra_y, image=, rpos=, /imxtra, wavrange=, /wall, spectrum=, /nox, /plotfit, /tplotfit, final=, residuals=, tresiduals=, /erase, error=

Handles plot events of the dispersion-mask GUI.

Input parameters:
stateThe state structure of p3d_wavecal_dispmask_gui.

routines/p3d_wavecal_dispmask_gui_imcombine.pro, line 65, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_dispmask_gui_imcombine, filenames, isplitbin, imageorder, daxis, /removecalfibers, calibspec=, topwid=, logunit=, verbose=, error=, /debug

Combines images for p3d_wavecal_dispmask_gui.

routines/p3d_wavecal_fit_maskwd.pro, line 206, last changed at 2020-07-16 by christersandin (revision 5423)

p3d_wavecal_fit_maskwd, image, nlines, linepos, wavelength, refdist, dispdeg, crossdeg, out, residualcut=, chisq=, maxspecnum=, refrow=, deadfibers=, sdeadfibers=, vignetted=, optlow=, opthig=, fitline=, orders=, stawid=, topwid=, logunit=, verbose=, error=, /debug, /help

This is the routine where the actual wavelength calibration takes place. The wavelengths in the arc line mask are fitted with a polynomial of order DISPDEG against the corrected positions of the lines in the spectrum image, that is assumed to contain these lines.

Additional parameters allow the procedure to be modified: If REFDIST is set to any integer above 1 then the fitting is made with REFDIST as the stride. I.e., with REFDIST==2 every second spectrum is fitted. If NROWS > 0 then the 2 * NROWS + 1 most adjacent spectra are used in the fitting of every spectrum (boundaries are different). If CROSSDEG >= 0 then the fitted parameters are fitted once again, across all spectra for each order in the fitted parameters separately (use is not recommended).

In order to check the quality of the fit the maximum residual (or all residuals if LOGLEVEL==2) is output to a logfile or the screen (if VERBOSE is set). Additionally the Chi-square value and the status of POLY_FIT are also shown.

The polynomial parameters are provided for each spectrum of the image in an array upon completion.

Input parameters:
imageA two-dimensional image with emission lines of an arc (calibration) lamp.
nlinesA scalar integer (IFU data) or a one-dimensional array (non-IFU data with separate spectra specified in LINEPOS). The value specify the number of calibration lines.
lineposA pointer array that either contains a two-dimensional array in the first index or a one-dimensional array for each spectrum order. The data hold the positions of each matched calibration line for all spectra; given in pixels.
wavelengthA pointer array where each element contains a one-dimensional array with the corresponding wavelength of each emission line specified in the data of LINEPOS.
refdistA scalar integer specifying if any spectrum is to be skipped. If REFDIST==1 1 then each spectrum is used, if REFDIST==2 then each second, etc.
dispdegA scalar integer specifying the order of the polynomial that is used to fit each spectrum on the dispersion axis.
crossdegA scalar integer specifying the order of the polynomial that is used to fit the separate parameters of the cross-dispersion (spatial) axis. The default value is: -1
Keyword parameters:
residualcutResiduals are calculated between the polynomial fit of the wavelength function and WAVELENGTH. If RESIDUALCUT is set to a positive value then the weights are set to zeros where the residual is larger than RESIDUALCUT. The default value is: -1
chisqA one-dimensional array that returns the chi² values of the fits for each spectrum.
maxspecnumReturns the index of the spectrum which has the largest residual.
refrowThe starting spectrum. The default value is: s[2
deadfibersA one-dimensional array of integers specifying which fiber positions are to be interpolated instead of fitted.
sdeadfibersA string array with as many elements as DEADFIBERS specifying the type of fiber in DEADFIBER (dead, low transmission, unused,...). This array is used in order to only skip [D]ead or [U]nused fibers.
vignettedAn optional two-dimensional array with two columns and as many rows has LINEPOS has rows. Each value pair specify the useful pixel range for each spectrum, vignetted regions can thereby be excluded to improve the accuracy of the polynomial fit. If necessary the polynomial order is decremented to allow a fit.
optlow

If this keyword is set then the wavelength at pixel 0 is at first calculated using a linear fit of the existing entries of the line list. That wavelength is thereafter added to the wavelength and pixel arrays before the final fit is made. By this procedure it is possible to constrain fits where there are few emission lines at the lowe range of pixels in the arc image.

Note: OPTLOW and OPTHIG can be used simultaneously.

opthig

If this keyword is set then the wavelength at the last pixel is at first calculated using a linear fit of the existing entries of the line list. That wavelength is thereafter added to the wavelength and pixel arrays before the final fit is made. By this procedure it is possible to constrain fits where there are few emission lines at the upper range of pixels in the arc image.

Note: OPTLOW and OPTHIG can be used simultaneously.

fitlineReturns a two-dimensional integer array that indicates which emission lines were fit for each spectrum.
ordersWhen NLINES is set to an array and the data in IMAGE are of multiple spectrum orders, this array specifies he order number of each spectrum.
stawidIf set to a valid ID then a log message is written using this ID for relevant actions.
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outA structure with a two-dimensional array (c) that contains the parameters of the polynomial fit [2nd dim.] for each spectrum in IMAGE. Additionally, another array (m) holds the minimum and the maximum pixel values that were used to scale the pixel array before calling poly_fit.

routines/p3d_wavecal_grating_eq.pro, line 144, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_grating_eq, lpmm, blaze, alpha, npixdisp, m, pix, lambda, lam_min, lam_cen, lam_max, rec_disp, pix_disp, spcres, r, eta=, view=, pixsize=, psf=, flip=, grotpos=, flen=, grotoffset=, topwid=, logunit=, verbose=, error=, /debug, /help

Computes various parameters using the grating equation.

Input parameters:
lpmmGroove density [lines per mm].
blazeBlaze angle [degrees].
alphaGrating angle normal to the incident beam.
npixdispNumber of pixels on CCD in the dispersion direction.
mSpectrum order. Note! -1 is FORWARD diffraction.
Keyword parameters:
etaCollimator/camera angle [degrees]. The default value is: 42°
viewPlots the lambda and grating geometry.
pixsizeThe pixel size. The default value is: 0.015mm
psfThe width of the instrumental profile [pixels]. The default value is: 4.0
flipReverses the order of pixels.
grotposThe grating rotator encoder position. A default value of -58.9 is used if this keyword is set to either GROTPOS==1b or GROTPOS==1 (i.e. byte or integer type).
flenThe focal length [mm]. The default value is: 270mm
grotoffsetThe grating rotator of PMAS was broke in 2008. The new encoder values are offset compared to the tabulated values. This offset value can be set in order to calculate the actual grating rotator position. The default value of -214.8 is used iff GROTPOS>0.0, otherwise it is set to 0.0. This value is added to GROTPOS. The default value is: -214.8||0.0
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
pixAn array with NPIXDISP elements: pixel number.
lambdaAn array with NPIXDISP elements; corresponding Lambda values [Å].
lam_minlambda_min, the minimum wavelength [Å].
lam_cenlambda_cen, the center wavelength [Å].
lam_maxlambda_max, the maximum wavelength [Å].
rdispThe reciprocal linear dispersion [Å/mm].
pdispThe reciprocal linear dispersion [Å/pix].
dlamThe spectrum resolution [Å].
RThe resolving power; Lambda/d_Lambda.
Examples:

p3d_wavecal_grating_eq, 1200, 17.5, 2, 2048, 1, pix, lam, lmin, lcen, lmax, ldisp, rdisp, dlam, r, /v, /i, /flip

p3d_wavecal_grating_eq, 1200, 17.5, -48, 2048, 1, pix, lam, lmin, lcen, lmax, ld, rd, dl, r, /v, /i, /flip, /gr

routines/p3d_wavecal_match_maskwd.pro, line 139, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_match_maskwd, spec, wavelen, refpixl, refwave, fwhm, identline, identpixl, identwave, noise=, poldeg=, niterate=, findwidth=, topwid=, logunit=, verbose=, error=, /debug, /help

This routine finds out which lines in the calibration line list (REFWAVE, at positions REFPIXL) are actually found in the spectrum SPEC(WAVELEN).

Input parameters:
specA one-dimensional array containing the spectrum against which the matching is done. It has to be of floating point type.
wavelenA one-dimensional wavelength array corresponding to SPEC.
refpixlA one-dimensional array that specifies the location of every line given in REFWAVE in the array WAVELEN.
refwaveA one-dimensional array that specifies the wavelengths of known emission lines; used together with REFPIXL.
fwhmA scalar decimal value (integer is also ok) specifying the full width at half maximum value that is used when summing up the contribution at the location of a potential emission line; given in pixels.
Keyword parameters:
noiseA scalar value specifying the noise. If this variable is not given then it is determined from regions in SPEC where there are no calibration lines specified.
poldegThe degree of the polynomial, that is used to fit REFWAVE(REFPIXL). The default value is: 1
niterateA scalar integer specifying how many times the solution is iterated. The default value is: 1
findwidthThe width of the region, that is used to search for the emission lines given in REFWAVE(REFPIXL); given in pixels. The default value is: fwhm
topwidIf set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
identlineReturns an array with the indices of those lines in REFWAVE, which have been found in SPEC, based on the input array WAVELEN. The array is the section of WAVELEN which is completely bounded by REFWAVE.
identpixlReturns an array with the pixel number of the arrays returned in IDENTLINE.
identwaveAn array with the wavelength of the positively matched lines.

routines/p3d_wavecal_set_linelist.pro, line 392, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_set_linelist, filename, lfilename, linelists, lamp, arclinefile=, kwrdlist=, userparfile=, prompt=, /header, /no_header, continuum=, /wsep, font=, topwid=, logunit=, verbose=, error=, /debug, /help

The purpose of this routine is to provide line-list filenames for wavelength calibration. Since different instruments have different ways to setup calibration lines, this routine allows the use of five different methods to accomodate the different approaches, see below. If no line-list file is found, the routine returns with an error.

For the second and third method, the format of the lamps file is as follows:

  • Lines that begin with the character ';' are considered comments. Columns are separated by white space.

  • Format specific to method 2: For every combination of grisms/gratings, filters, and detector-id, the first column specifies such a string. The second column contains the line-list filename to use with that combination. It is assumed that the default path is used.

  • Format specific to method 3: For every calibration line, the first column specifies the shutter keyword. The second column specifies the power supply. The third, and final, column specifies the name of the calibration lamp (and this string is also used to create the filename). It is assumed that the default path is used. All data are read as strings.

The already configured instruments tend to use the following setups:

Method 1

Any instrument

Method 2

VIMOS, FLAMES

Method 3

PMAS/LARR

Method 4

PMAS/PPAK, VIRUS-P, GMOS

In each case, the line-list file is searched for using five different approaches. Here <filename> contains a path, if any, and {filename} has been stripped of the path. If any one approach is successful, the routine continues:

i.

The specified file is tested for its existence (using the IDL internal routine FILE_TEST). If the file exists, as it is specified (with or without the path) then the filename is used as it is.

The final filename becomes: <filename>

ii.

The user-parameter file path is appended as a prefix. This approach is only attempted if a user-parameter file has been specified and the 'arclinefile' parameter is set.

The final filename becomes: path(userparfile)/<filename>

iii.

The user-parameter file path is appended as a prefix to a path-stripped filename. This approach is only attempted if a user-parameter file has been specified and the 'arclinefile' parameter is set.

The final filename becomes: path(userparfile)/{filename}

iv.

The parent directory of the user-parameter file is appended as a prefix. This approach is only attempted if a user-parameter file has been specified and the 'arclinefile' parameter is set.

The final filename becomes: path(userparfile)/../{filename}

v.

Using the p3d default path for line-list files; i.e., ${p3d_path}/data/tables/linelists/...

The final filename becomes: !p3d_path/data/tables/{filename}

Here follows a description of the five different methods:

1. Using the keyword ARCLINEFILE or the user-parameter file

In the first method, the line list file(s) are defined in the keyword ARCLINEFILE or in the user-parameter file. Any number of files can be specified. If the user-parameter file is used, the rows must begin with the string 'arclinefile'. If no such filename is specified, the routine attempts to use method 2 instead.

2. The filename is determined using the file header, explicitly

In the second method, the instrument data-keywords list is searched for the three keywords DETECTOR, FILTERNAME, and GRATNAME. If all these keywords are present (also see below), a string is created according to: GNAME = h[GRATNAME] + '_' + h[FILTERNAME] + '_' + h[DETECTOR], where h[] denotes the value as is found in the data header. In a last step GNAME is searched for in the instrument lamps file; the line-list <filename> is extracted from the 2:nd column in that file.

Note: If FILTERNAME is set to "n/a", GNAME is created using only the keyword GRATNAME.

2b. The filename is read from the instrument keywords file

The third method is used when the three kewyords DETECTOR, FILTERNAME, and GRATNAME are unavailable in the instrument keywords file, but instead the keyword ARCFILE must be present and set to one of the existing files in the data/linelists directory.

3. The filename is determined using the file header, implicitly

The fourth method is fairly specific to PMAS. In this approach the data header is searched for information on which shutters and power supplies are used, the header keywords are taken from the instrument lamps file. The line-list files, which will be used, depend on which power supplies are switched on, and on which shutters are open (several can be chosen). The last column in the instruments lamps file (that relates each combination of power supply and shutter to a line-list file) contains the <filename> that will be used.

4. Manual selection of one or several line-list files

In the fifth and final method, line-list files are selected manually, using a graphical user interface. Among the options these line-list <filenames> are found: HG (Mercury), NE (Neon), CD (Cadmium), AR (Argon), ThAr (Thorium Argon), user defined.

Input parameters:
filenameIf HEADER == 1, this parameter should be the filename of the input PMAS FITS file. If HEADER == 0, this is a FITS header string array.
lfilenameThis is a scalar string with the filename of a file that contains the calibration lamp-header keywords that are used with the current instrument and data.
Keyword parameters:
arclinefileAn array of strings with the names of line-list files.
kwrdlistA two-dimensional string array holding the instrument-specific keywords for a defined set of keywords which are used to determine the grating/grism setup. KWRDLIST must have two columns.
userparfileA scalar string specifying the name of an optional user-parameter file, which contains keywords, be- ginning with the string 'arclinefile'. The keywords must point at existing files which, if present, will be used instead of any header keywords. As in the other parameter files lines preceeded by ';' are considered to be comments. Entries of multiple files are concatenated to create one line-list.
promptPrompt the user for the lamps to use.
headerSet this keyword if FILENAME is actually a variable that contains the header keywords.
no_headerSpecified if the necessary information is not contained in the FITS header. In this case the information has to be entered at the prompt.
continuumA scalar string that specifies the name of the ontinuum lamp of the current instrument. The default value is: 'HL'
wsepIf this keyword is set, the directory pointed at by this variable is used to load data.
fontSet this scalar string to the name of the font to use with the widget tool of this routine.
topwidIf set, error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
linelistsFilenames of emission line lists.
lampUsed emission line lamps.

routines/p3d_wavecal_unfold_dispmask_file.pro, line 114, last changed at 2019-12-08 by christersandin (revision 5316)

p3d_wavecal_unfold_dispmask_file, filename, npix, out, bin=bin, daxis=, npix_out=, topwid=, logunit=, verbose=, error=, /debug, /help

This routine reads a dispersion mask file, that contains the polynomial fitting parameters, and sets up a matrix with a wavelength array for every spectrum.

Input parameters:
filenameA string specifying the filename of the file that holds the dispersion mask data.
npixA scalar integer that specifies the number of wavelength bins on the dispersion axis.
Keyword parameters:
binA scalar integer specifying the detector pixel bin size.
daxisDefines the dispersion axis. The default, 1, is in the x-direction. The default value is: 1
npix_outReturns the actually used NPIX; useful with non-IFU data.
topwidIf set, error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE.
logunitMessages are saved to the file pointed to by this logical file unit, if it is defined.
verboseSet this parameter to a positive scalar integer to make p3d write some information on STDOUT about what is going on. The following four values are acknowledged:

0

Writes no information at all. This is the default.

1

Writes the more important information; regarding subroutine configurations, mostly.

2

Writes most information; includes a more verbose output than 1.

3

Writes all information, including information on the execution state of GUI subroutines. This may be a useful mode when debugging the code.

errorThis scalar integer returns an error code if set. Any value different from zero means that an error has occurred.
debugNo error handler is setup if this keyword is set. The default is otherwise to setup an error handler (using the routine CATCH), which makes each subroutine exit quietly in case a bug is encountered. Use this keyword when debugging p3d.
helpSet this keyword to show this routine documentation, and then exit.
Output parameters:
outA two-dimensional array holding a wavelength array of NPIX elements for every spectrum.


page last updated on: Sunday January 1, 2023 16:54:33; retrieved on: Friday April 26, 2024 21:09:33