STScI Logo

function stsdas.analysis.fitting


NAME · USAGE · DESCRIPTION · PARAMETERS · EXAMPLES · BUGS · REFERENCES
SEE_ALSO

NAME

function -- Evaluate a function of values taken from an image or table.

USAGE

function input1 input2 output row

DESCRIPTION

This task evaluates a 1- or 2-dimensional function over pixel coordinates in an image section, over the data values in a table column, or over an array in a table cell ("3-D table"). The output will be a 1- or 2-dimensional image, a table column or a table cell in a 3-D table. The task is intended to reconstruct the functions generated by the curve fitting tasks in this package, using coefficients stored in the fit table.

The number of dimensions in input1 and the tabulated function must agree. Image sections are supported -- provided that the resulting subimage is 1 or 2-dimensional.

In the case of 1-dimensional images, FITS keywords related to transformation from pixel to world coordinates will be taken from the image header. These keywords are used to generate the X independent variable in physical units. Supported keywords are: W0, WPC, CRPIXn, CRVALn, CDn_n, CDELTn, and DC-FLAG, where n is the image section axis selected by the input1 section specification. If no section specification exists, n defaults to 1. If no suitable keywords are found, then raw pixel numbers are used.

In the case of table input, the results will be written to a column of the input table. The input and output column names should be specified as the values of the column and output parameters respectively. That is, column gives the name of the column to be read as the independent X variable, and output gives the name of the column to contain the function values. If the output column exists it will be overwritten; if it doesn't exist it will be created. If a row selector is appended to the table name, it is assumed that the table stores arrays in its cells ("3-D table") and the computed function will be stored as a 1-D array in the selected row,column cell. Only a single row can be selected by the supplied row selector. In the case of ASCII tables, and when output is left blank (""), a new column will be appended to the table.

In the particular case of a "user" nonlinear function, this task reads the FORTRAN expression from the current userpars pset. This pset must contain the same function expression as used for fitting the original data.

PARAMETERS

input[file name]
Name of the input file to which the function will be applied. The input file may be an image or a table. The task checks to see if the input is an image or a table --- in that order. It may be necessary to add a file extension if there are similarly named files of different types in your current directory. If input1 is a table, results will be written to it in-place. Note that this implies that input1 may not be STDIN.
input[file name]
Name of the STSDAS fit table produced by the curve fitting tasks.
output [file name]
If input1 is an image, then output is the name of the output image. If input1 is a table, then output is the name of the column in input1 to contain the results. If this column doesn't exist it will be created. In the case of ASCII tables, if this parameter is set to an empty string ("") the column will be appended after the last column in the table.
row [integer, min=1]
Row to use from fit table.
(column) [string]
If input1 is an image, then column is ignored. If input1 is a table, then column is the name of the column in input1 to be read as the independent X variable. The function will be evaluated for each row in this column, and the results will be written back into input1 in column output.

EXAMPLES

1. Create an image with pixel values based on an evaluation of the function described by row 12 in the fit table.

  fi> function focim6[100:*] fit funimage 12

2. Create a new array column named "NEW" and store in its 3rd row an array with values based on the evaluation of the function described by row 12 in the fit table. Read the independent variable from the array stored in the same 3rd row in column named "WAVELENGTH".

  fi> function table.fits[r:3] fit "NEW" 12 column="WAVELENGTH"

BUGS

REFERENCES

This task was written by I.Busko

SEE ALSO

gfit1d, nfit1d, ngaussfit, n2gaussfit, selectors


Source Code · Package Help · Search Form · STSDAS