Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | utility | |
Module | fitting | |
Tool | functionfitter |
name | in | The table (AIPS++ or ascii) name | |
Allowed: | String | ||
cold | in | The columns holding the coordinate and ordinate values | |
Allowed: | Integer vector of length 2 | ||
Default: | [1,2] | ||
cole | in | The columns holding the ordinate error data | |
Allowed: | Integer | ||
Default: | None | ||
colm | in | The column holding the mask data | |
Allowed: | Integer | ||
Default: | None | ||
xunit | in | The unit of the x-data | |
Allowed: | Unit string | ||
Default: | 'm' | ||
autoheader | in | Auto detect data type from ascii table | |
Allowed: | T or F | ||
Default: | T |
This function sets the data that you wish to fit by reading it directly from a table. That table can be an AIPS++ table or an ascii table (this is auto-detected). You specify which columns in the table which the appropriate data are to be found. If the table is ascii, the mask column should be integer with values 0 (bad) or 1 (good).
The coordinate column may be multi-dimensional (e.g. if you want to fit 2-D functions to the data). See function setdata for more information on coordinate vector packing and data dimensions. As an example, imagine you are fitting an N-D function. Each row of the Coordinates column should hold a vector (of length N) of coordinates.
The argument autoheader is only relevant if the input data are stored in an ascii file; it is ignored otherwise. It is used to control whether it is attempted to auto-detect the type of data in the table or not. If autoheader=T (the default), then the first row of the text file (and it should be a proper data row) is used to work out the data types. It will only recognize I (integer), D (double or float) and A (ascii). This is usually the easiest thing to do for simple fitting of 1-D functions.
If autoheader=F then you must specify the column names (although they are not used by this Tool) in row 1, and the data types for each column in row 2.
If you are fitting 1-D data, then you can use either value for autoheader. However, if you are fitting data of greater dimensionality than one, you must use autoheader=F and specify how the data are formatted (it cannot be auto-determined what the dimensionality of columns is). As an example, let us say you are fitting a 2-D problem. This means the coordinate vectors must be of length two. The first couple of lines of the ascii table might look like:
COL1 COL2 # Column names must be given (but can be arbitrary) R2 R # Must specify column shape and type 1.1 2.2 10.0 # Line 1 2.2 4.4 20.0 # Line 2
So we specify explicitly that the coordinate column is a vector of floats and the vector is of length 2. For the data column, it is just a scalar (R, not R1 which would be a vector of length 1). For more details you can look at the tablefromascii constructor which is used behind the scenes by this Tool.
If and when you plot the data, a Tabular coordsys tool is made internally for you. This maps pixel index to the world x values that you specified with the x vector. The world units are given by the xunit variable, which defaults, not very helpfully perhaps, to metres. You can replace this Tabular Coordinate System if you want with another via the setcoordsys function.
- include 'functionfitter.g' - ff := functionfitter() - ff.setdatafromtable ('data.txt', [1,2], 3, 4); # Ascii table; Columns 1, 2, 3, 4 - ff.setdatafromtable ('data.tbl', [3,4], 1, 2) # aips++ table; Columns 3, 4, 1, 2