This is a special purpose calculator. It can be used to perform calculations on columns in a FITS table and write the result to the table. It can also be used to create new columns in the table.
The entry field on the left hand side of the "=" sign is for entering the name of the resulting column. The arrow brings a pull down menu which lists all the existing columns in the table. If a new column name is entered, then a new column with that name will be created when the calculation is performed. Otherwise, the resulting column just replaces the old column with the same name.
Normally, when creating a new column, the column's data type will be the same as that of the expression. That is, an integer expression will create a 4-byte integer column (TFORM = 1J) and a real expression will create an 8-byte double column (TFORM = 1D). This can be overridden by placing the desired TFORM value within parentheses after the column's name. For example, specifying a column name NewCol(1E) will create a new column named 'NewCol' with a TFORM of '1E'. (The numerical value is optional and will be filled in with the vector size of the expression.) The expression's results will thus be converted to a 4-byte real when written to the column, even though the result could be of type integer or double.
The entry field on the right hand side of the "=" sign is for entering the expression for calculation. You can either type in the expression or use the buttons. To use a column in the calculation, one just inserts the column's name. Below are some sample expressions.
Add 100.0 to column TIME and save it as a new column with name NEWCOL.
Multiply 2.0 with column RATE and replace the old RATE column.
Create a new column with all the element value = 0.0 and save it in the table. This can also be used to create a new ASCII column with a initial value, e.g. NEWSCOL = "string value". Be sure the string has the quote characters around it.
NEWCOL = expr1 * (COLUMN1 > 3.0) + expr2 * (!(COLUMN1 > 3.0))
The result of the above expression is expr1 if values in COLUMN1 is larger than 3.0, otherwise, expr2.
Dec = (deg_sign != "-") * (degree + minute/60.) - (deg_sign == "-") * (degree + minute/60.)
In effect, the conditional expressions evaluate to 1 if true and 0 if false when multiplied by a numerical value.
NEWCOL = ASCIICOL
NEWCOL = TIME
If a calculation involves a column with Nulls or NaNs for certain rows, then these rows in the result column will be Nulls. An exception is if the Null is encountered within an && or || construction whose value is determined by the nonNull value. For example, "TRUE || NULL" evaluates to TRUE. The calculator has several special functions which can be used to test for Null values in columns.
All the column names are listed as buttons. Clicking on any of them will insert (replacing any selected text) the column name in the formula window. If the number of columns is greater than 24, the "Up" and "Down" buttons can be used to scroll through the column name list.
Arithmetic functions supported:
Vector functions supported:
Boolean functions supported:
NULL functions supported:
Type conversions supported: