This HTML automatically generated with rman for NEMO
Table of Contents


ccdsmooth - smoothing of an image map (2D or 3D)


ccdsmooth in=image out=image [parameter=value]


ccdsmooth will smooth an image (cube) through a simple direct convolution (no FFT). The smoothing beam must be circular/spherical, or smoothing must be done independantly per coordinate by calling ccdsmooth multiple times using the dir= keyword (see below).

Spatial smoothing in X-Y can also be done by creating an image of a beam, which is then convolved with the input image. For example, non-circular beams with a non-zero positon angle (in FITS: BPA) will need to create a beam file using ccdgen(1NEMO) .

For more artistic versions of a smoothing operation, such as added noise and diffraction spikes for bright stars, see ccddiffract(1NEMO) .


The following parameters are recognized in order; they may be given in any order if the keyword is also given. Use --help to confirm this man page is up to date.
input file, in Image(5) format [no default]
output file, will be in Image(5) format [no default]
Beam size (FWHM, note FWHM = 2*sqrt(2*ln(2) ) = 2.355 * sigma) of a gaussian smoothing kernel, in WCS units. Note this is size of the used smoothing kernel, NOT the resulting beam in the output map, which generally will be bigger depending on the pre-existing beam. If this parameter is used, the parameter smooth is ignored [default: not used].
If given, this will be the FWHM of the Moffat smoothing function.
Direction of smoothing. This gives the flexibility of smoothing in x, y and/or z separately. Note that when smoothing in more than one coordinate the beam is forced to be the same in each dimension [default: xy].
Smoothing array, should be at least 1 number, prefarably normalized to unity for sake for conservation of units (mass per unit square length). The program does not normalize the beam to unity. Example is e.g. the Hanning smoothing: "0.25,0.5,0.25". [default: 0.25,0.5,0.25]. This parameter is only used if gauss parameter is not used.
If used, this will be the (square) size of the Wiener filter.
Number of times the above smoothing kernel is applied over the data. [default: 1].
Input pixel value which to skip in smoothing. [Default: not used]
If used, this is the beta parameter for the Moffat smoothing function. [Default: 4.765]
Value at which to cutoff the gaussian beam. [Default: 0.01]
Optional 2D spatial beam, in Image(5) format. This should be a map with an odd number of pixels, ideally where the central pixel value is 1. Normalization by the beam volume is done automatically, such that smoothing conserves flux. The WCS of the beam is ignored, it’s the pixels that count.

Special edge smoothing mode (testing). [0]


Here is an example to compute the noise of an image with unity noise that has been smoothed with a beam/pixel (B/P) ratio of 2.0 :
  ccdgen "" -  noise 0,1 size=1000,1000 seed=123 | ccdsmooth - - 2.0 | ccdstat
- | grep dispersion
  Mean and dispersion    : -0.000116 0.334048
with the following table showing the resulting RMS for a few values of the B/P ratio
B/P     RMS
---    -----
0.0    1.000
1.0    0.796
2.0    0.334
3.0    0.223
4.0    0.168
5.0    0.1367
6.0    0.1160
7.0    0.1012
8.0    0.0917
caveat/TBD: this does not follow the expected (?) 1/sqrt(1.1309)/(B/P)

sigma_smooth = -0.133 + 1.52 / beam

Here is an example of creating a beam image, with 5 x 2.5 beam, and a position angle of 30 degrees, by creating a disk at pa=-30 and inclination the cos(bmin/bmaj):

    ccdgen beam1 gauss 1,5 size=33,33 pa=-30 inc="acosd(0.5)"


With 68881 on SUN 3/50 (~16Mhz) and 200*200 map - old program (pre-V2.1)
Nbeam=17    54s
Nbeam=33    98s
Nbeam=47    140s
HanningThe following are the weights needed in smooth= for subsequent hanning
1: 0.25,0.5,0.25
2: 0.0625,0.25,0.375,0.25,0.0625 
3: 0.015625,0.09375,0.234375,0.3125,0.234375,0.09375,0.015625 
4: 0.00390625,0.03125,0.109375,0.21875,0.273438,0.21875,0.109375,0.03125,0.00390625

and these results in a reduction of the RMS by 0.61, 0.52, 0.47 and 0.44 resp. Note this is not the official Hanning definition (0.5-0.5 cos(2.pi.N/(M-1))).
1: 0.25,0.5,0.25
2: 0.08333333,0.25,0.33333333,0.25,0.08333333
3: 0.03661165,0.125,0.21338835,0.25,0.21338835,0.125,0.03661165,
4: 0.0190983,0.0690983,0.1309017,0.1809017,0.2,0.1809017,0.1309017,0.0690983,0.0190983
5: 0.01116455,0.04166667,0.08333333,0.125,0.15550212,0.16666667,0.15550212,0.125,0.08333333,0.04166667,0.01116455
which reduce the RMS by 0.61, 0.49, 0.43, 0.38 and 0.34 resp.

Noise Reduction

For a given smoothing, a map with random gaussian noise will have a smaller noise for given smoothing. Most maps in astronomy will not have uncorrelated noise. Here’s a (bash) script and results to sample that behavior. We fix the noise at 1, and for given smoothing (in terms of pixels FWHM) the noise will be lower:
export DEBUG=-1
slist=$(nemoinp 0.01,0.25:5:0.25)
for s in $slist; do
     echo -n "$s "
     ccdgen "" - noise 0,1 size=256,256 | ccdsmooth - - $s | ccdstat - | grep
^Mean | awk ’{print $6}’
     ccdgen "" - noise 0,1 size=256,256 | ccdsmooth - - $s | ccdstat - | txtpar
- p0=Mean,1,6


Smoothing a map which has already been smoothed will result in an incorrect header - this would be a simple sum of squares, if the beams are aligned with the axis.

See Also

ccdgen(1NEMO) , ccdfill(1NEMO) , ccddiffract(1NEMO) , snapccd(1NEMO) , snapsmooth(1NEMO) , snapgrid(1NEMO) , image(5NEMO)





src/image/trans         ccdsmooth.c


29-jun-87    V1.0: Created as module from CCD program    PJT
30-Jun-87    V1.1: improved ’struct’ filestructure          PJT
 9-jul-87    V1.2: keyword ’dir’ and keyword order changed    PJT
 1-jun-88    V2.0: new filestruct, although code is same    PJT
 5-feb-89    V2.2: general 3D smoothing                    PJT
11-sep-91    some additional comments                    PJT
12-mar-98    V3.1: added cut=, fixed fwhm=0.0             PJT
23-jun-21    add EXAMPLE with smoothing noise        PJT
31-may-22    documented missing parameters        PJT
20-sep-23    V4.0 add beam=    PJT

Table of Contents