Table of Contents

Name

ccdmath - map arithmetic using function expressions

Synopsis

ccdmath in=[image1[,image2,...]] out=image fie=expression

Description

ccdmath combines maps through some simple operations to make a new map. It also handles a few arithmetic functions, such as sqrt, exp, log10. See fie(3NEMO) for a full definition of the available functions and operations. Input maps are referred to by %n, where n is the ordinal number of the input maps (1 being the first one), in the function expression fie.

The program can also be used in creation mode: when no input files are given, parameters %x, %y and %z in fie= can be used to refer to the X, Y and Z pixel coordinates in the map to be created, (0,0,0) in pixel coordinates w.r.t. reference pixel. %w and %r can be used for 2D and 3D radius w.r.t. reference pixel, again in pixel coordinates.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=in-file(s)
list of input file name(s), each in image(5NEMO) format. In case of multiple files, the list must be space or comma separated. If no files are given, the program is in creation mode.
out=out-file
output file, will be in Image(5NEMO) format [no default]
fie=expression
Expression how to manipulate the input maps or create output map. Input maps are referred to by %n or $n, in creation mode position is referred to by %x and %y [no default].
size=nx,ny,nz
Size of the output map in case program is in creation mode [default: 10,10,1].
crpix=r1,r2,r3
(New) values for the reference pixel. Note these are in FITS notation, i.e. (1,1,1) is the lower left of the first plane in a cube. Recall that (nx+1)/2 is the central pixel in coordinate X, not nx/2! By default the WCS is transferred from the first input image to the output image, however, by using all 3 keywords crpix=,crval=,cdelt= the WCS of the output image can be overwritten. [Default: 1,1,1 for image creation].
crval=r1,r2,r3
(New) values for the reference pixel. [Default: 0,0,0 for image creation].
cdelt=r1,r2,r3
(New) values for the pixel separation. [Default: 1,1,1 for image creation].
seed=integer
seed for the random number generator (default: a value 0, which will be converted into a unique new value using UNIX’s clock time, in seconds since once-upon-a-time-in-the-seventies).

Example

Create a ’difference’ map from two input maps:
   % ccdmath inmap1,inmap2 outmap "abs(%1-%2)"
create the maximum of two maps:
   % ccdmath inmap1,inmap2 outmap "ifgt(%1,%2,%1,%2)"
create the difference of two maps if either of the two is not zero:
   % ccdmath inmap1,inmap2 outmap "ifne(%1,0,%1-%2,ifne(%2,0,%1-%2,0))"
create a map from scratch:
  % ccdmath out=newmap fie="exp(-((%x-50)/25)**2-((%y-50)/25)**2)" size=100,100
create a (2 plane 4x3 image) cube from scratch:
  % ccdmath "" cube432 "%x+10*%y+100*%z" 4,3,2
create a new WCS for an existing cube, with reference value (0,0,0) in the center of the cube, assuming you know the size of the cube (nx,ny,nz) and pixel sizes (dx,dy,dz):
  % ccdmath cube0 cube1 %1 crpix=$nx/2+0.5,$ny/2+0.5,$nz/2+0.5 crval=0,0,0
cdelt=$dx,$dy,$dz
and creating an annulus:
  %  ccdmath "" map0 "ifgt(%w,20,1,iflt(%w,10,1,0))" size=512 crpix=256,256

Timing

Performance on Rigel (SUN 3/160, 16Mhz):
100 * 100    rang: 5.8"    +: 3.4"      sqrt: 2.6"
200 * 200    rang: 23.2    +: 13.0"    sqrt: 8.7"
300 * 300    rang: 51.8"    +: 31.3"    sqrt: 23.8"
512 * 512    rang: 152.7"    +: 88.4"    sqrt: 64.2"

See Also

fie(3NEMO) , image(5NEMO) , tsf(1NEMO) , ccdgen(1NEMO) , ccdsky(1NEMO)

Author

Peter Teuben

Files


src/image/trans      ccdmath.c ccdmath.1

Update History


 1-Jul-87    V1.0: Created    PJT
 6-jul-87    V1.1: order keywords changed for future enhancements    PJT
 1-jun-88    V2.0: new filestruct, although code is same             PJT
18-dec-88    V2.1: new keyword structure, fie() used.             PJT
22-jan-89    V2.3: can make map from scratch using %x, %y and %z    PJT
1-mar-03    V3.0: set/change the WCS                PJT
19-jun-03    V3.1: allow %w and %r, and use offset from crpix    PJT
25-aug-04    V3.2: fixed error in setting crpix (off by 2!)        PJT


Table of Contents