Table of Contents

Name

tabblend - create (blended) gaussian profiles and bin them

Synopsis

tabblend [parameter=value]

Description

tabblend creates a blended line spectrum of gaussians, bins them, optionally with hanning smoothing and outputs a table that can be compared with observations, or be fitted with tabnllsqfit(1NEMO) .

After a raw spectrum is computed on the grid specified by s=, it can be optionally smoothed using fwhm=, after which it is binned on the grid specified by g=. This binning can be done in a number of ways (e.g. see bin= below). Note that both grids need to be regular (use the notation min:max:step) and min<max. An optional simple (0.5,1,0.5) hanning smoothing can be applied. As last step before output noise can be added.

Parameters

The following parameters are recognized in any order if the keyword is also given:
x=x1,x2,...
X coordinates of the centroid(s) line(s). Multiple coordinates can be given here. There is no default, at least one value needs to be specified here.
a=a1,a2,...
Amplitudes for each line. If not enough values are given, the last value repeats. The number of values should be the same as those in x=. [1]
d=d1,d2,...
FWHM of the lines (FWHM=2.355*sigma). If not enough values are given, the last value repeats. The number of values should be the same as those in x=. [1]
s=min:max:step
Points where to sample the lines. The values need to be regular and increasing. Use Bmode=0 with specified x,a,d,s to look at the raw spectrum. [Default: -16:16:0.01]
g=min:max:step
Points where to lay the grid for binning. The values need to be regular and increasing, these values are the midpoint of their cells, not the edges. (see bin=). [Default: -16:16:1]
fwhm=
If non-zero, smooth the raw points with a gaussian beam with given FWHM. [0]
bin=t|f
Use the simple way of binning by using a fine sample grid and sprinkling them into the bins? Or properly integrate the sample grid onto the bins? The latter prevents edge effect if Sample and Grid are commensurate. Default: t
hanning=t|f
Optional hanning applied to the gridded data. [Default: f]
fft=t|f
Use FFT to compute observed spectrum? (not implemented yet).
rms=
RMS value for the noise added to the spectrum before output. This can be done to either raw (mode=0) or binned (mode=1) spectrum. [Default: 0]
seed=
The usual random seed (see also xrandom(1NEMO) ). [Default: 0]
mode=
Output mode. 0 will output the raw spectrum before smoothing and binning etc. 1=will output the final spectrum, after all binning and noise addition. [Default: 1]

Examples

plotting triplet of gaussians, moderately blended and binned :
  tabblend x=-4,0,2 a=0.5,1,0.5 | tabplot - line=1,1 point=2,0.1
and fitting a single gaussian
  tabblend x=0 d=2.355 | tabnllsqfit - fit=gauss1d
  ### Warning [tabnllsqfit]: No initial estimates for gauss1d, attempting
to get some
  Fitting a+b*exp(-(x-c)^2/(2*d^2)):  
  a= -2.28081e-05 1.99529e-05 
  b= 0.960098 9.51577e-05 
  c= 1.11565e-20 0.000118163
  d= 1.04196 0.000121485
  rms2/chi2= 3.1717e-07
Note the width d=1.04 is about 4% higher than expected due to some moderate binning.

To view a the line and the residuals from the fit:

  tabblend x=0 d=2.355 rms=0.1 | tabnllsqfit - fit=gauss1d out=- | tabplot - 1
2,3 line=1,1 color=2,3

See Also

tabplot(1NEMO) , tabnllsqfit(1NEMO) , tabmath(1NEMO)

Files

NEMO/src/kernel/tab : tabblend.c

Author

Peter Teuben

Update History


21-dec-2011    V0.1 Created    PJT
30-dec-2011    V0.5 added rms to both mode=0 and mode=1    PJT
1-jan-2012    V0.8 added bin=     PJT


Table of Contents