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: line fitting

Summary

PROp3d_ifsfit_caller
Calls the fitting routine mpfit.
PROp3d_ifsfit_colorbar
Draws a colorbar on top of or to the right of a plot at the specified position.
PROp3d_ifsfit_confread
The purpose of this routine is to read and parse a plain-text file that contains information on which lines to fit, and how to fit them.
FUNCTIONp3d_ifsfit_function
This function calculates a composite function that consists of a background signal linear polynomial (of desired order) and any number of line functions of the type "Gaussian", "Lorentzian", "Moffat", and "Voigt".
PROp3d_ifsfit_ifu__define
Manages the object class p3d_ifsfit_ifu, which handles line-specific data of an integral-field unit (IFU).
PROp3d_ifsfit_io
The purpose of this routine is to write and read the output data files that are generated by p3d_ifsfit.
PROp3d_ifsfit_linesetup
The purpose of this routine is to setup the required parameter structure and an index array that are used by mpfit.
FUNCTIONp3d_ifsfit_mosaic_aspect
Calculates the x and y sizes depending on the pre-set aspect ratio.
PROp3d_ifsfit_postscript
Configures postscript output for use with p3d_ifsfit_mosaic.

Copyright

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

Copyright 2012, 2015-2017, 2020 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_ifsfit_caller.pro, line 147, last changed at 2020-08-27 by christersandin (revision 5463)

p3d_ifsfit_caller, x, y, dy, parinfo, index, lineconf, par, sigpar, z=, redshift=, sshift=, mpmaxiter=, mpxtol=, mpftol=, mpgtol=, ompniter=, ompchisq=, ompnfev=, ompdof=, ompstatus=, topwid=, logunit=, verbose=, error=, /debug, /help

Calls the fitting routine mpfit.

Input parameters:
xA one-dimensional floating-point type value array with the abscissae of y.
yA one-dimensional floating-point type-value array with the ordinate values.
dyA one-dimensional floating-point type-value array with the errors in y.
parinfoA parameter-structure array setup in p3d_ifsfit_lineconf.
indexAn index array that is used to access the required elements in PARINFO.
lineconfA line-setup structure – the output structure of p3d_ifsfit_confread.
Keyword parameters:
zA scalar floating-point type value that specifies an optional redshift of all regular lines. The default value is: 0.0
redshiftA scalar floating-point type value specifying an optional offset of all regular lines. The default value is: 0.0
sshiftA scalar floating-point type value specifying an optional secondary offset of all regular lines. The default value is: 0.0
mpmaxiterA scalar integer specifying the maximum number of iterations performed by MPFIT [MAXITER = 20]. The default value is: 20
mpxtolA scalar floating-point type value that specifies XTOL of MPFIT [XTOL = 1d-10].
mpftolA scalar floating-point type value that specifies FTOL of MPFIT [FTOL = 1d-10].
mpgtolA scalar floating-point type value that specifies GTOL of MPFIT [GTOL = 1d-10].
ompniterUpon successful exit this parameter contains a scalar integer specifying the number of iterations performed by MPFIT.
ompchisqUpon successful exit this parameter contains a scalar floating-point type value specifying the Chi square value of the fit.
ompnfevUpon successful exit this parameter contains a scalar integer specifying the number of function evaluations performed by MPFIT.
ompdofUpon successful exit this parameter contains a scalar integer specifying the number of degrees of freedom of the fit performed by MPFIT.
ompstatusUpon successful exit this parameter contains a scalar integer specifying the exit status code of MPFIT.
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:
parA double array with the fitted parameters.
sigparA double array with the errors of the fitted parameters.

routines/p3d_ifsfit_colorbar.pro, line 140, last changed at 2015-12-18 by christersandin (revision 3968)

p3d_ifsfit_colorbar, range, /reverse, /barright, position=, minor=, title=, /logscale, ncolors=, /bottom, tabcolors=, /cinv, charsize=, charthick=, thick=, decomposed=, font=, topwid=, logunit=, verbose=, error=, /debug, /help

Draws a colorbar on top of or to the right of a plot at the specified position.

Input parameters:
rangeA two-dimensional decimal-type array with the minimum and maximum values that the colors in the colorbar assume.
Keyword parameters:
reverseSet this keyword to reverse the colorbar.
barrightSet this keyword to draw a vertical colorbar instead of a horizontal colorbar. The colorbar is setup to be put on the right of the plot.
positionA four-element decimal-type array that specifies the position of the colorbar in normalized coordinates.
minorA scalar integer that specifies the number of minor tick mark intervals between the major tick marks. The default value is: 4
titleA scalar string with a title that is placed on top of (to the right of) the colorbar and the tick values when BARRIGHT is unset (set). The title string is prefixed with the 10-logarithm value of RANGE when LOGSCALE is unset. The default value is: ''
logscaleSet this keyword to draw a colorbar with logarithmic values instead of linear.
ncolorsA scalar integer value that defines the number of colors to use in the colorbar. The default value is: !d.table_size
bottomA scalar integer value that defines the bottom index of the color array. The color values smaller than BOTTOM are used to draw the colorbar axes. The default value is: !d.table_size – ncolors
tabcolorsAn integer array that provides the colors when using decomposed colors. The foreground (background) color is taken as the first (second) element in the array.
cinvSet this keyword to swap the foreground and background colors.
charsizeA scalar decimal-type value that defines the font size. The default value is: 1.0
charthickA scalar decimal-type value that defines the thickness of the font. The variable is passed on to PLOT, AXIS, and XYOUTS.
thickA scalar decimal-type value that defines the thickness of the lines. The variable is passed on to PLOT and AXIS.
decomposedA scalar integer that specifies if decomposed (1) or indexed (0) colors are to be used.
fontA scalar integer value that defines the font scheme to use. The variable is passed on to PLOT, AXIS, and XYOUTS.
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.

routines/p3d_ifsfit_confread.pro, line 274, last changed at 2015-10-30 by christersandin (revision 3727)

p3d_ifsfit_confread, filename, lineconf, topwid=, logunit=, verbose=, error=, /debug, /help

The purpose of this routine is to read and parse a plain-text file that contains information on which lines to fit, and how to fit them.

Each entry in the configuration file must contain three columns that are separated by white space. Anything that comes after a semicolon is ignored. The information can be entered in any order, for as long as all necessary information is available.

The information is specified in three different categories: setup, group, and line. Entries of the setup category define the line width, the order of the background polynomial, and which properties are limited. Entries of the group category define the wavelength range of each group of line fits. Entries of the line category define which group a line belongs to, which wavelength it has, which function type it is, if it is a regular line or a sky line, and if it is an emission or an absorption line.

Options in the setup category

Each option is specified with the word "setup" or the character "s" in the first column. The property name is specified in the second column and its value in the third column. These are the available properties:

[background_polorder] [1]

The order of the polynomial used to fit the line-free background. The default value of 1 results in a linear function.

[linewidth_fixed] [0]

Specifies if the line width should be allowed to vary (0) or if it is fixed (1).

[linewidth_limited] [1]

Specifies if the fitted line width is limited (1) or not (0).

[linewidth_mfactor] [0.10]

Specifies the allowed variation of the line width when either awidth_center or width_center is specified. The lower and the upper limits are calculated as: [linewidth_center * (1 – linewidth_mfactor), linewidth_center * (1 + linewidth_mfactor)]. Use the linewidth_high and linewidth_low parameters instead if width_mfactor does not work.

[linecenter_separate] [0]

Specifies if all regular lines are to be fitted using a tied offset between the lines (0) or if the offset can vary. The latter is recommended if you want to measure kinematics of two lines in the same line group that have a different velocity structure.

[linecenter_sky_separate] [0]

Specifies if all sky lines are to be fitted using a tied offset between the lines (0), or if the offset can vary.

abs_linewidth_center

The FWHM of absorption lines. The two parameters "abs_linewidth_high" and "abs_linewidth_low" are ignored if this parameter is specified.

abs_linewidth_high

The upper value limit of the fitted FWHM of absorption lines. The parameter "abs_linewidth_low" must also be specified if this parameter is set. This parameter is not used if the parameter "abs_linewidth_center" is set.

abs_linewidth_low

The lower value limit of the fitted FWHM of absorption lines. The parameter "abs_linewidth_high" must also be specified if this parameter is set. This parameter is not used if the parameter "abs_linewidth_center" is set.

linewidth_center

The FWHM of emission lines. The two parameters "linewidth_high" and "linewidth_low" are ignored if this parameter is set.

linewidth_high

The upper value limit of the fitted FWHM of emission lines. The parameter "linewidth_low" must also be specified if this parameter is set. This parameter is not used if the parameter "linewidth_center" is set.

linewidth_low

The lower value limit of the fitted FWHM of emission lines. The parameter "linewidth_high" must also be specified if this parameter is set. This parameter is not used if the parameter "linewidth_center" is set.

Options in the group category

Each option is specified with the word "group" or the character "g" in the first column. The mandatory group number is specified in the first column as well, following an underscore. For example, group 1 is specified as "group_1". The property name is specified in the second column and its value in the third column. These are the available properties:

waverange_low

The lower limit of the wavelength range. Note that this parameter must be lower than waverange_high.

waverange_high

The upper limit of the wavelength range. Note that this parameter must be higher than waverange_low.

Options in the line category

Each option is specified with the word "line" or the character "l" in the first column. The mandatory group and line id numbers are specified in the first column as well; following an underscore and the group number, another underscore and the line id number. For example, a line belonging to group 1 with the id number 101 is specified as "line_1_101". The property name is specified in the second column and its value in the third column. These are the available properties:

wavelength

The rest wavelength of the line, specified in Angstrom [Å].

[emission_or_absorption] [emission]

The property value, which must be set to either "emission" or "absorption" specifies if the line is an emission feature or an absorption feature.

[type] [regular]

This property defines how the line is treated during the fitting. The property value must be set to "regular", "tied", "sky", or "auxiliary". The wavelength is not fitted with tied lines (using the "reference" property) when linecenter_separate is set. Sky lines are neither red- nor blue-shifted, while auxiliary lines are specified with a fixed intensity relative to another sky line (using the "scalefactor" and "reference" properties).

[function] [Gaussian]

This property defines the function type to use with the line. Valid property values are: "Gaussian", "Lorentzian", "Moffat", and "Voigt".

[title] [{wavelength}]

This property defines a title string to use with the line. The wavelength value is used instead if this property is undefined.

[limit_intensity] [yes]

This property defines if fitted negative (positive) intensities are allowed with emission (absorption) lines (no) or not (yes).

reference

If the line type is defined as "tied" or "auxiliary", the reference property value specifies the other line that this line is tied to. The property value must be specified as a group number, which is followed with an underscore character and the line id. For example, a valid reference property value is "1_101" if the line "line_1_101" is given.

scalefactor

This property defines a scale factor used to fix the intensity of an auxiliary line relative to its reference line.

The return structure

Upon a successful return this routine returns the structure LINECONF:

lineconf.setup

A structure with all the setup parameters that are mentioned above.

lineconf.lines

An lineconf.ngroup-element structure array that contains the complete setup of each line. All lines that belong to a specific group are indicated in lineconf.lidx.

lineconf.lidx

A [2,lineconf.ngroup] integer array that contains the lower and upper indices to use with each group of lines in lineconf.lines.

lineconf.ngroup

A scalar integer indicating the number of different groups of lines.

lineconf.igroup

A lineconf.ngroup-element integer array that contains all group ids.

lineconf.rgroup

A [2,lineconf.ngroup] decimal array that contains the wavelength range of the respective group.

Input parameters:
filenameA scalar string or an array of strings. If this variable is set to a scalar string, it must contain the name of a configuration file, including its full path. If it is instead an array of strings, it is assumed to contain the read contents of a configuration file.
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:
lineconfUpon exit of the routine this variable contains a structure with both all preset properties as well as those that were parsed from FILENAME.

routines/p3d_ifsfit_function.pro, line 163, last changed at 2018-08-01 by christersandin (revision 5016)

p3d_ifsfit_function, p, x=, y=, dy=, fei=, /funceval, z=, redshift=, sshift=, index=, lineconf=

This function calculates a composite function that consists of a background signal linear polynomial (of desired order) and any number of line functions of the type "Gaussian", "Lorentzian", "Moffat", and "Voigt". The line configuration is specified using the LINECONF and INDEX keywords. Regular lines, i.e. not sky/telluric lines, are also red- or blue-shifted using the REDSHIFT and SSHIFT keywords.

This function is normally called by MPFIT, calculating the function residual. When the FUNCEVAL and FEI keywords are set it can be used to calculate the total line function, or just an individual line component.

Input parameters:
p.
Keyword parameters:
xA one-dimensional floating-point type value array with the abscissae of y.
yA one-dimensional floating-point type-value array with the ordinate values.
dyA one-dimensional floating-point type-value array with the errors in y.
fei.
funceval.
zA scalar floating-point type value specifying an optional redshift of all regular lines. The default value is: 0.0
redshiftA scalar floating-point type value specifying an optional offset of all regular lines. The default value is: 0.0
sshiftA scalar floating-point type value specifying an optional secondary offset of all regular lines. The default value is: 0.0
index.
lineconf.

routines/p3d_ifsfit_ifu__define.pro, line 1358, last changed at 2018-08-01 by christersandin (revision 5016)

p3d_ifsfit_ifu::set, filename=, offset=, iscale=, scale=, minvali=, maxvali=, colmini=, colmaxi=, minvalv=, maxvalv=, colminv=, colmaxv=, minvalw=, maxvalw=, colminw=, colmaxw=, minvalc=, maxvalc=, colminc=, colmaxc=, title=, xstr=, ystr=, rightascension=, declination=, didoffset=, colortable=, /invert, setcolor=, /sexagesimal, /logscale, /loadcolortable, topwid=, logunit=, verbose=, error=, /debug, /help p3d_ifsfit_ifu::polyget, xpos, ypos, use=, color=, val=, dval=, nvertices=, velocity=, width=, continuum=, topwid=, logunit=, verbose=, error= p3d_ifsfit_ifu::cubeget, image, /true, velocity=, width=, continuum=, topwid=, logunit=, verbose=, error= p3d_ifsfit_ifu::get, nspx=, shape=, scale=, pa=, offset=, minvali=, maxvali=, colmini=, colmaxi=, minvalv=, maxvalv=, colminv=, colmaxv=, minvalw=, maxvalw=, colminw=, colmaxw=, minvalc=, maxvalc=, colminc=, colmaxc=, xstr=, ystr=, logscale=, rightascension=, declination=, didoffset=, sexagesimal=, tabcolors=, decomposed=, colortable=, invert=, npar=, src=, title=, spaxels=, xrange=, yrange=, bottom=, ncolors=, /help p3d_ifsfit_ifu::cleanup p3d_ifsfit_ifu__define

Manages the object class p3d_ifsfit_ifu, which handles line-specific data of an integral-field unit (IFU).

Data related to the entire IFU are stored in this class, which provides a simple interface to IFU data, and is used by, e.g., p3d_ifsfit_mosaic.

The typical use of the COLMIN and COLMAX keywords is when a number of data sets are re-scaled to use the same color table.

Keyword parameters:
The
individually:
p3d_ifsfit_ifu::set

filename – A scalar string with the name of a binary-table FITS file with data processed by p3d_ifsfit_io (p3d_ifsfit), which contents are loaded into a class object. offset [0.0, 0.0] - A two-element decimal-type value array that specifies how the data are to be offset on the x and the y axes, before they are stored in the class object. iscale – An optional scaling factor to apply to the loaded intensities and continuum data; ISCALE > 0.0. scale [file] – This keyword returns the value of the scale, as found in the binary-table FITS file. minvali [file] – A scalar decimal-type value that specifies the minimum value of the loaded intensity data. maxvali [file] – A scalar decimal-type value that specifies the maximum value of the loaded intensity data. colmini [file] – A scalar decimal-type value that specifies the minimum value of the loaded intensity data used with the color range. colmaxi [file] – A scalar decimal-type value that specifies the minimum value of the loaded intensity data used with the color range.

minvalv [file] – A scalar decimal-type value that specifies the minimum value of the loaded velocity data. maxvalv [file] – A scalar decimal-type value that specifies the maximum value of the loaded velocity data. colminv [file] – A scalar decimal-type value that specifies the minimum value of the loaded velocity data used with the color range. colmaxv [file] – A scalar decimal-type value that specifies the minimum value of the loaded velocity data used with the color range.

minvalw [file] – A scalar decimal-type value that specifies the minimum value of the loaded line-width data. maxvalw [file] – A scalar decimal-type value that specifies the maximum value of the loaded line-width data. colminw [file] – A scalar decimal-type value that specifies the minimum value of the loaded line-width data used with the color range. colmaxw [file] – A scalar decimal-type value that specifies the minimum value of the loaded line-width data used with the color range.

minvalc [file] – A scalar decimal-type value that specifies the minimum value of the loaded continuum data. maxvalc [file] – A scalar decimal-type value that specifies the maximum value of the loaded continuum data. colminc [file] – A scalar decimal-type value that specifies the minimum value of the loaded continuum data used with the color range. colmaxc [file] – A scalar decimal-type value that specifies the minimum value of the loaded continuum data used with the color range.

title [file] – A scalar string that specifies the name of the property stored in the file. xstr ['RA offset ['''']'] - A scalar string that specifies what to put on the x-axis (RA-direction) in data plots. ystr ['DEC offset ['''']'] - A scalar string that specifies what to put on the y-axis (DEC-direction) in data plots. rightascension [file] - A scalar decimal value that allows the value of the right ascension to be set manually. declination [file] - A scalar decimal value that allows the value of the declination to be set manually [degrees]. didoffset – N/A. colortable [-1] – A 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.

invert – Set this keyword to reverse the loaded color table. setcolor – Recalculates the color index (decomposed == 0) or value (decomposed == 1) for each spatial element. Note! Colors are recalculated automatically when any of the following keywords are changed: COLMINx, COLMAXx, COLORTABLE, or LOG. sexagesimal [0] – Set this keyword to plot axes using the sexagesimal format instead of arcsec. logscale [0] – If this keyword is set, the log_10 of the value is used to calculate the color instead of usual value. This is a nearly mandatory keyword when multiple lines of drastically different amplitude, or bright regions and much fainter regions are shown in the same plot. loadcolortable [1] - Set this keyword to force the color table to be loaded. topwid – If set, then error messages are displayed using DIALOG_MESSAGE, using this widget id as DIALOG_PARENT, instead of MESSAGE. logunit – Messages are saved to the file pointed to by this logical file unit, if it is defined. verbose – Set 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.

error – This scalar integer returns an error code if set. Any value different from zero means that an error has occurred. debug – No 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. help – Set this keyword to show this routine documentation, and then exit.

p3d_ifsfit_ifu::polygetxpos – Returns the x coordinates of polygons in an array (in all columns) for each spatial element in the IFU. ypos – Returns the y coordinates of polygons in an array (in all columns) for each spatial element in the IFU. use – Returns a byte array that indicates which polygons contain useful data. color – Returns an integer array with the color index (decomposed == 0) or color value (decomposed == 1) of each spatial element. val – Returns an array with the fitted values. dval – Returns an array with the fitted error values. nvertices [20] – Specifies the number of vertices(-1) to use with circular polygons (shape == 1). velocity – Velocities are returned instead of intensities if this keyword is set. width – Line widths are returned instead of intensities if this keyword is set. This keyword is ignored when VELOCITY is also set. continuum – Continuum values are returned instead of intensities if this keyword is set. This keyword is ignored when VELOCITY or WIDTH are also set.
p3d_ifsfit_ifu::get

nspx – Returns a scalar integer with the number of spatial elements on the IFU. shape – Returns a scalar byte that specifies the shape of the spatial elements. scale – Returns a scalar integer that specifies the scale of the spatial elements. pa – Returns a scalar decimal-type value with the position angle of the IFU. offset – Returns a two-element decimal-type array with the applied offsets on the x and the y axes. minvali – Returns a scalar decimal-type value with the minimum value of the loaded intensity data. maxvali – Returns a scalar decimal-type value with the maximum value of the loaded intensity data. colmini – Returns a scalar decimal-type value with the minimum value of the loaded intensity data used with the color range. colmaxi – Returns a scalar decimal-type value with the minimum value of the loaded intensity data used with the color range.

minvalv – Returns a scalar decimal-type value with the minimum value of the loaded velocity data. maxvalv – Returns a scalar decimal-type value with the maximum value of the loaded velocity data. colminv – Returns a scalar decimal-type value with the minimum value of the loaded velocity data used with the color range. colmaxv – Returns a scalar decimal-type value with the minimum value of the loaded velocity data used with the color range.

minvalw – Returns a scalar decimal-type value with the minimum value of the loaded line-width data. maxvalw – Returns a scalar decimal-type value with the maximum value of the loaded line-width data. colminw – Returns a scalar decimal-type value with the minimum value of the loaded line-width data used with the color range. colmaxw – Returns a scalar decimal-type value with the minimum value of the loaded line-width data used with the color range.

minvalc – Returns a scalar decimal-type value with the minimum value of the loaded continuum data. maxvalc – Returns a scalar decimal-type value with the maximum value of the loaded continuum data. colminc – Returns a scalar decimal-type value with the minimum value of the loaded continuum data used with the color range. colmaxc – Returns a scalar decimal-type value with the minimum value of the loaded continuum data used with the color range.

xstr – Returns a scalar string with the x-axis title. ystr – Returns a scalar string with the y-axis title. logscale – Returns a scalar integer that indicates if the data were logged or not. rightascension – Returns a scalar decimal-type value with the used right ascension coordinate (degrees). declination – Returns a scalar decimal-type value with the used declination coordinate (degrees). didoffset – Returns a scalar integer that indicates if the coordinates were offset or not using the OFFSET keyword. sexagesimal – Returns a scalar integer that indicates if SEXAGESIMAL was set when the object was created. tabcolors – Returns a pointer to a 256-element array with the table values that are used with decomposed graphics. decomposed – Returns a scalar integer that indicates if graphics are decomposed (1) or not (0). colortable – Returns a scalar integer or string that indicates which color table was used. invert – Returns a scalar integer that indicates if the color table was inverted when loading. npar – Returns a scalar inteher that indicates how many parameters went into the fit of the line. src – Returns a scalar string with the source of the fitted data (currently undefined). title – spaxels – Returns a structure array with the data stored in each spatial element (useful for debugging purposes, otherwise not). xrange – Returns a two-element array with the minimum and maximum values of the stored x-coordinates. yrange – Returns a two-element array with the minimum and maximum values of the stored y-coordinates. bottom – Returns a scalar integer that indicates the used bottom index used in the color table. ncolors – Returns a scalar integer that indicates how many colors where used in the color table. help – Prints this routine documentation, and exits.

Side effects:

When this object is created an array of objects of class p3d_ifsfit_spaxel is also created. In order to return all memory gracefully when objects of this class have been used, they should be deleted using the obj_destroy procedure.

routines/p3d_ifsfit_io.pro, line 517, last changed at 2020-08-27 by christersandin (revision 5463)

p3d_ifsfit_io, data, /save, filename=, lines=, offset=, /compress, nthreads=, /noC, posfile=, posdata=, cube=, inhdr=, inzhdr=, binidx_struc=, kwrdlist=, spaxelscale=, /binflipx, sbinflipx=, revision=, /z_scalar, /nowritebintables, /nowritemaps, daxis=, topwid=, logunit=, verbose=, error=, /debug, /cdebug, /help

The purpose of this routine is to write and read the output data files that are generated by p3d_ifsfit.

To save space the data are stored in binary-table FITS files; all outcome of the fitting process are stored in this file. Fitted data based on square-shaped elements are also saved as images in a file with multiple extensions; these extensions are explained below.

The content of binary-table fits files

The data that are to be stored are provided as a structure, where the same structure is returned when the routine is used to load data from a file. The input (output) data structure must have (has) the following content:

usebins

An integer specifying if the save data were binned (1) or not (0). Binned data contain the BINIDX tag instead of the ROWNUM, ID, XPOS, and XPOS tags and the bin map is written to the extension VORONOI_TABLE. The bin map is used to recreate the full data set when the data are restored.

nspx

An integer that specifies the number of spatial elements in the dataset. All arrays below have/must have this many elements unless usebins is set, in that case the number is nbins.

nbins

An integer that specifies the number of bins in the dataset. All arrays below have/must have this many elements unless usebins is unset, in that case the number is nspx.

lid

An integer that specifies the line id number that was used when fitting the line.

gid

An integer that specifies the group id number that was used when fitting the line.

src

A scalar string that specifies the source of the fitted data.

background_polorder

A scalar integer that specifies the order of the linear polynomial that was used to fit the background signal.

title

A scalar string that specifies a string describing the fitted line. This title string can, for example, be used to label a plot automatically.

fun

A scalar string that specifies the function that was used to fit the data; this string is set to one of the following four values: gaussian, lorentzian, moffat, voigt.

npar

A scalar integer that specifies the number of parameters used with the chosen function; set to either 3 or 4.

scale

A scalar floating-point type value that specifies the spaxel scale.

spaxelarea

A scalar floating-point type value that specifies the spatial-element area that was used to scale the data.

shape

A scalar integer that specifies the shape of the spatial element. The following four shapes are available: 0 for square-shaped elements, 1 for disc-shaped elements, 2 and 3 for hexagon-shaped elements;.

wavelength0

A scalar floating-point type value that specifies the rest wavelength of the fitted line.

z : A scalar floating-point type value that specifies the redshift used when fitting the data.

redshift

A scalar floating-point type value that specifies the wavelength offset value that was used to fit the data; specifically the object lines (this parameter could use a better name, but of historical reasons it is kept as it is).

binidx

If usebins is set, this is an unsigned integer array with nspx elements that specifies the bin of each spatial element.

rownum

An nspx-element integer array that specifies the RSS image row number of each spatial element; this entry is only present if usebins is unset.

id

An nspx-element string array that specifies the id of each spatial element; this element is only present if usebins is unset.

xpos

An nspx-element floating-point type value array that specifies the relative W-E position of each spatial element, with respect to the center of the IFU; this element is only present if usebins is unset, otherwise it is taken from the VORONOI_TABLE extension.

ypos

An nspx-element floating-point type value array that specifies the relative S-N position of each spatial element, with respect to the center of the IFU; this element is only present if usebins is unset, otherwise it is taken from the VORONOI_TABLE extension.

continuum

An nspx-element floating-point type value array that specifies the continuum signal level at the position of the fitted line.

i

An nspx-element floating-point type value array that specifies the fitted intensity.

di

An nspx-element floating-point type value array that specifies the error in the fitted intensity.

w

An nspx-element floating-point type value array that specifies the fitted line width.

dw

An nspx-element floating-point type value array that specifies the error in the fitted line width.

c

An nspx-element floating-point type value array that specifies the fitted wavelength.

dc

An nspx-element floating-point type value array that specifies the error in the fitted wavelength.

x

An nspx-element floating-point type value array that specifies the fitted fourth parameter; this value is only used with the function types "moffat" and "voigt". This array must only be present when NPAR = 4.

dx

An nspx-element floating-point type value array that specifies the error in the fitted fourth parameter; this value is only used with the function types "moffat" and "voigt". This array must only be present when NPAR = 4.

var

An nbins-element floating-point type value array that specifies the variance of the spatial elements that are used with each bin; this value is only present if usebins is set.

nvar

An nbins-element integer array that specifies the number of spatial elements that were summed up to calculate the variance VAR; this value is only present if usebins is set.

mpstatus

An nspx-element integer array that specifies the output status code of MPFIT.

mpniter

An nspx-element integer array that specifies the number of iterations used by MPFIT to fit the line.

mpchisq

An nspx-element floating-point type value array that specifies the Chi square value of the fit, as determined by MPFIT.

z

An nspx-element floating-point type value array that specifies the redshift used with the element.

use

An nspx-element byte array that specifies if the line fit is OK to use (1) or not (0).

ra

A scalar floating-point type value that specifies the Right Ascension of the observations.

commentra

A scalar string with the FITS header comment of RA.

dec

A scalar floating-point type value that specifies the Declination of the observations

commentdec

A scalar string with the FITS header comment of DEC.

didoffset

A scalar integer that specifies if the position coordinates were offset (1) or not (0); this value is only present if usebins is unset.

When the parameter usebins is set, the additional file extension VORONOI_TABLE is assumed to contain the following keywords (the routine returns with an error if these data are not present in the file):

binidx

An nspx-element integer array that specifies the index of each bin.

x

An nspx-element integer array that specifies the //x// position of each bin.

y

An nspx-element integer array that specifies the //y// position of each bin.

The extensions of image (map) files

Data based on square-shaped elements are saved in image files (unless the keyword NOWRITEMAPS is set). An attempt is made to calculate the world coordinate system (WCS). The image files contain the following extensions:

DATA_I

The intensity. The unit is set to that of BUNIT in the input data, after removing the final unit, which should be the wavelength.

DATA_DI

The intensity error. The unit is set to that of BUNIT in the input data, after removing the final unit, which should be the wavelength.

DATA_W

The line width.

DATA_DW

The line width error.

DATA_V

The velocity. The unit is km/s.

DATA_DV

The velocity error. The unit is km/s.

DATA_C

The wavelength. The unit is set to the same value as read in the input data: CUNIT3 (data cubes) CUNITx (RSS images, where x is the dispersion axis, i.e. 1 or 2).

DATA_DC

The wavelength error. The unit is set to the same value as read in the input data: CUNIT3 (data cubes) CUNITx (RSS images, where x is the dispersion axis, i.e. 1 or 2).

DATA_CON

The continuum. The unit is set to that of BUNIT in the input data, after removing the final unit, which should be the wavelength.

DATA_X

The extra property used with the parametrized Voigt and Moffat profiles.

DATA_DX

The extra property error used with the parametrized Voigt and Moffat profiles.

DATA_V0

The velocity as calculated from the *input* redshift data (i.e. this is *not* used when using a scalar redshift). The unit is km/s.

Keyword parameters:
saveIf this keyword is set then DATA is stored in a FITS binary-table file with the name FILENAME. If this keyword is unset then the FITS binary-table file with the name FILENAME is loaded into the data structure DATA.
filenameA string scalar or a string array with the name of the file(s) that should be read from (SAVE=0) or written to (SAVE=1). This keyword must have as many elements as DATA.
linesAn array of integers that specifies which files are to be loaded. Only those entries in FILENAME that contain the sub-string *_iXXX.* are loaded.
offsetAn optional [2, n]-element array specifying an offset that is applied to the x (W-E) and y (S-N) positions of the loaded data. This keyword must have as many rows as FILENAME has elements. However, if LINES is specified OFFSET must have as many rows as the number of selected files.
compressSet this keyword to compress the output when save is set.
nthreadsA scalar integer that specifies how many threads to use in the parallelized output file compression. The default value is: max
noCThis keyword is forwarded to p3d_misc_rss2cube.
posfileThis keyword is forwarded to p3d_misc_rss2cube.
posdataThe data origin is assumed to be a data cube if this keyword is used. It is also forwarded to p3d_misc_rss2cube.
cubeThis variable indicates if the original data belong in a cube (1) or not (0); a pre-binned cube is indicated with a separate code (2).
inhdrA string array forwarded to p3d_misc_wcs_setup.
inzhdrA string array forwarded to p3d_misc_wcs_setup.
binidx_strucA scalar structure with tags for the bin index and //x// and //y// positions for each spatial element as well as a unique bin index array, etc.
kwrdlistA string array forwarded to p3d_misc_wcs_setup.
spaxelscaleA string array forwarded to p3d_misc_wcs_setup.
binflipxSet this keyword to have the position data flipped on the x-axis (W->E) when CUBE is set to 2.
sbinflipxA scalar string identifying the origin of how BINFLIPX is set, when it is set.
revisionA scalar integer forwarded to p3d_misc_bins_file_write.
z_scalarA column (Z) is added with used redshift values if this keyword is unset.
nowritebintablesSet this keyword to avoid writing the binary table utput files containing the fitted properties.
nowritemapsSet this keyword to avoid writing the spatial map images of the fitted properties; these files are, in any case, only written for data sets using square-shaped spatial elements (including data cubes).
daxisDefines the dispersion direction dimension of the input data. The default, 1, is in the x-direction. The default value is: 1
topwidIf set, error messages are displayed using DIALOG_MESSAGE with 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; valid values are 0-6 where a higher number results in more output to STDERR.
helpSet this keyword to show this routine documentation, and then exit.

routines/p3d_ifsfit_linesetup.pro, line 108, last changed at 2020-08-27 by christersandin (revision 5463)

p3d_ifsfit_linesetup, group, index, parinfo, p, lineconf=, order=, dcenter=, topwid=, logunit=, verbose=, error=, /debug, /help

The purpose of this routine is to setup the required parameter structure and an index array that are used by mpfit.

Input parameters:
groupA scalar integer with the group number that shall be setup.
Keyword parameters:
lineconfA line-setup structure – the output structure of p3d_ifsfit_confread.
orderReturns an array with the line ids as they were setup.
dcenterA scalar decimal value specifying the allowed deviation of the line center position. The default value is: 1.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:
indexAn array of structures with one structure per component.
parinfoThe setup parameter control structure for MPFIT.
pA double-type array with the initial values.

routines/p3d_ifsfit_mosaic_aspect.pro, line 63, last changed at 2015-10-19 by christersandin (revision 3628)

p3d_ifsfit_mosaic_aspect, xsize, ysize, xmargin, ymargin, aspect, /doy, /charsize=

Calculates the x and y sizes depending on the pre-set aspect ratio.

routines/p3d_ifsfit_postscript.pro, line 207, last changed at 2022-07-15 by christersandin (revision 5654)

p3d_ifsfit_postscript, filename=, /encapsulated, /pdf, /landscape, /portrait, /color, /cmyk, /isolatin1, bits_per_pixel=, charsize=, /a2, /a3, /a5, /letter, /legal, /tabloid, font_size=, paperxsize=, xsize=, xoffset=, paperysize=, ysize=, yoffset=, /aspect, caspect=, xmargin=, ymargin=, nxplot=, nyplot=, /avantgarde, /bkman, /courier, /helvetica, /palatino, /schoolbook, /times, /bold, /book, /demi, /italic, /light, /medium, /narrow, /oblique, ofile=, set_font=, /tt_font, topwid=, logunit=, verbose=, error=, /debug, /help

Configures postscript output for use with p3d_ifsfit_mosaic.

Keyword parameters:
filename- Default postscript filename. The default value is: p3d_ifsfit.ps|.eps
encapsulatedProduces an encapsulated postscript file.
pdfSet this keyword to indicate that the output is saved to a temporary directory.
landscapeSpecifying if the plot should be drawn in landscape mode instead of portrait mode; PORTRAIT takes precedence if both LANDSCAPE and PORTRAIT are set.
portraitSpecifying the portrait orientation; PORTRAIT takes precedence if both LANDSCAPE and PORTRAIT are set.
colorSpecifies if the postscript file should be printed in color. The default value is: 1
cmykSet this keyword to use the CMYK color scheme instead of RGB.
isolatin1See documentation for the procedure 'device'. The default value is: 1
bits_per_pixelSee documentation for the procedure 'device'. The default value is: 8
charsizeSets the character size used in determining an optimal paper size.
a2Uses the A2 paper size instead of the default A4.
a3Uses the A3 paper size instead of the default A4.
a5Uses the A5 paper size instead of the default A4.
letterUses the US LETTER paper size instead of the default A4.
legalUses the US LEGAL paper size instead of the default A4.
tabloidUses the US TABLOID paper size instead of the default A4.
font_sizeSets the font size (points). The default value is: 10.0
paperxsizeorizontal size of the paper. The default value is: 21.0; landscape: 29.7cm
xsizeorizontal size of the printed area. The default value is: 19.0; landscape: 26.0cm
xoffsetorizontal offset. The default value is: value resulting in a centered area on the papercm
paperysizeertical size of the paper. The default value is: 29.7; landscape: 21.0cm
ysizeertical size of the printed area. The default value is: 26.0; landscape: 19.0cm
yoffsetertical offset. The default value is: value resulting in a centered area on the papercm
aspect

Fixes the aspect XSIZE / YSIZE of plotted regions. If set, YSIZE is recalculated using the XSIZE and the ASPECT values.

Note: Since hardware fonts are used (by default), it is difficult to calculate an exact aspect ratio. However, the result should be a good approximation. If a better value is required, use the XSIZE and YSIZE keywords.

caspectA aspect ratio correction factor. The default value is: 1.0
xmargin

Two-element arrays specifying the margins on the xis.

e! Only used when ASPECT is set.

The default value is: 0.0, 0.0
ymargin

Two-element arrays specifying the margins on the xis.

e! Only used when ASPECT is set.

The default value is: 0.0, 0.0
nxplotA scalar integer that specifies the number of panels to use on the x-axis; the default is 1. Note! Only used when ASPECT is set. The default value is: 1
nyplotA scalar integer that specifies the number of panels to use on the y-axis; the default is 1. Note! Only used when ASPECT is set. The default value is: 1
avantgardeSet this keyword to select the ITC Avant Garde PostScript font.
bkmanSet this keyword to select the ITC Bookman PostScript font.
courierSet this keyword to select the Courier PostScript font.
helveticaSet this keyword to select the Helvetica PostScript font.
palatinoSet this keyword to select the Palatino PostScript font.
schoolbookSet this keyword to select the New Century Schoolbook PostScript font.
timesSet this keyword to select the Times-Roman PostScript font.
boldSet this keyword to specify that the bold version of the current PostScript font should be used.
bookSet this keyword to specify that the book version of the current PostScript font should be used.
demiSet this keyword to specify that the demi version of the current PostScript font should be used.
italicSet this keyword to specify that the italic version of the current PostScript font should be used.
lightSet this keyword to specify that the light version of the current PostScript font should be used.
mediumSet this keyword to specify that the medium version of the current PostScript font should be used.
narrowSet this keyword to specify that the narrow version of the current PostScript font should be used.
obliqueSet this keyword to specify that the oblique version of the current PostScript font should be used.
set_font

Set this font to a scalar string specifying the name of the font used with hardware or TrueType fonts.

Note: It is necessary to also set TT_FONT when using a TrueType font.

tt_fontSet this keyword to indicate that the font set via the SET_FONT keyword should be treated as a TrueType font.
ofileSe to the output filename including the path, if PDF is set.
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.
helpDisplays this routine documentation, and exits.
Output parameters:
parA double array with the fitted parameters.


page last updated on: Sunday January 1, 2023 16:54:33; retrieved on: Thursday May 2, 2024 19:49:08