%N smoothtobm %F $MIR/src/scripts/smoothtobm.clone
%D Smooth the input file to have the given beamsize
%P bpw
%: analysis
%B
Smoothes the input file to have the given beamsize (keyword wanted=),
as opposed to smooth or convol, where you specify the smoothing beam
instead of the final beam.

A smoothing beam is calculated from the original gaussian beam B with
FWHM in x and y Bx and By and the wanted beam W with FWHM Wx and Wy
as Sx=sqrt(Wx^2-Bx^2). The map is then smoothed with the gaussian
with FWWM Sx and Sy.
The output is scaled so that the definition of brightness temperature
is preserved: TB=flux/beamarea. Nominally 'convol options=scale' takes
care of this. However, this works only if the header is OK, which is
not the case if one smoothes a map not yet treated by restor.

smoothtobm can be used to restore a map by using beam=0 for the original
beam.
%A in
Input map [no default]
%A out
Output map [no default]
%A region
The region of the input map to smooth. See the 'doc region' or the
users manual for instruction on how to specify this. Default is the
entire input image.
%A beam
Original major and minor axis and pa of beam of input map. Default is to
try to find bmaj/bmin/bpa in the header of the input map. If bmin size
is not given it is assumed equal to bmax. Default for bpa is 0.
If beam=0, smoothtobm works like restor.
%A wanted
Wanted beam for output map. No default. Values are bmaj,bmin,bpa.
Default for bmin is bmaj, default for bpa is 0.
%A options
if options=flux, then flux is preserved instead of the surface
brightness (i.e. smoothing function has integral 1).
efault is to preserve surface brightness (i.e. brightness
temperature)
