pcalc - perform an arithmetic operation on a field in a list of apphot/daophot databases
pcalc infiles field value
- The APPHOT/DAOPHOT database(s) containing the field to be recomputed.
- The field to be recomputed. Field must be an integer or real field in the input file(s).
- The arithmetic expression used to recompute the specified field. Value may be an integer or real expression but must match the data type of field. The functions real and int may be used to do type conversions.
PCALC reads in the values of the field keyword from a set of APPHOT/DAOPHOT databases, replaces the old values with new values equal to the value of the arithmetic expression value , and updates the databases(s).
PCALC is script task which calls TXCALC is the input file is an APPHOT/DAOPHOT text database or TBCLAC if APPHOT/DAOPHOT is a tables database. If the input file is a text database, the expression value consists of variables which are the field names specified by the #N keywords or the parameters specified by the #K keywords in the APPHOT/DAOPHOT text databases. Only keywords beginning with #N can actually be replaced. If the input file is an ST tables database, the expression value consists of the table column names.
The supported arithmetic operators and functions are briefly described below.
addition + subtraction - multiplication * division / negation - exponentiation ** absolute value abs(x) cosine cos(x) sine sin(x) tangent tan(x) arc cosine acos(x) arc sine asin(x) arc tangent atan(x) arc tangent atan2(x,y) exponential exp(x) square root sqrt(x) natural log log(x) common log log10(x) minimum min(x,y) maximum max(x,y) convert to integer int(x) convert to real real(x) nearest integer nint(x) modulo mod(x)
1. Change the XCENTER and YCENTER fields to XCENTER + 5.4 and YCENTER + 10.3 respectively in a file produced by the apphot package center task.
pt> pcalc m92.ctr.1 xcenter "xcenter+5.4" pt> pcalc m92.ctr.1 ycenter "ycenter+10.3"
2. Add a constant to the computed magnitudes produced by nstar.
pt> pcalc n4147.nst.2 mag "mag+3.457"
TXCALC does not allow arrays in the expression field.