This HTML automatically generated with rman for NEMO
Table of Contents

Name

tabpeak - find peaks in a table

Synopsis

tabpeak [parameter=value]

Description

tabpeak finds local maxima (and/or minima) and fit a local paraboloid, return the location and value of the peaks, or valleys. See also tablsqfit(1NEMO) and ccdmom(1NEMO) for more advanced versions of peak finding.

The default is to search for local 3 point extrema. Using edge= one can force it away from the edge, and using pmin= one can increase the minimum number of points that need to be in the extreme.

For noisy data tabsmooth(1NEMO) can be useful to get more robust estimates of the peaks.

tabpeak can also be a useful tool to determine lines in a spectrum and pass them to lineid(1NEMO)

Parameters

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.
in=
Input file name, in table(5NEMO) format.
No default
xcol=
X-Column
[1]
ycol=
Y-column
[2]
clip=
Only consider points above this value
[0]
delta=
If a positive value is used, single peaks larger than this value on either side of this peak are reported.
[0]
pmin=
[EXPERIMENTAL] Require the peak to contain at least pmin points. By default, only 3 are required, in which case a polynomial is fit (though this is an exact fit). By setting this higher, more points are required to be part of a peak which is then required to be monotonously decreasing.
[1]
edge=
Number of points near the edge to skip for a peak finder. For the simplest 3-point peak finder this should be at least 1.
[1]
valley=t|f
Also fit valleys, in which case the signal has to be below -clip.
[f]
mean=t|f
Use intensity weighted mean ?
[f]
npeak=
extract the Nth peak (N>0). If npeak=0, no extraction done. Other keywords will be ignored if a peak is ectracted for further analysis.
[0]
epeak=
expand around the N-th peak extracted by npeak>0 by this factor. By default the segment around a peak is defined until the first point away from the peak will increase again.
[1]
nmax=
max size if a pipe
[100000]

Caveats

Only fits location of peaks, does not attempt to find the width, like a gaussian fit would do.

Examples

The peak in a simple paraboloid:

nemoinp 1:3 | tabmath - - "-(2.2-%1)**2+10" | tabpeak -
2.200000 10.000000

Here is a pipeline extracting the first peak, fitting a gaussian to it, and plotting the data and residuals (in the PGPLOT driver the data will be in red, the residuals in green, and the fit in blue):

tabpeak spec.tab | tabnllsqfit - fit=gauss1d out=- | tee fit.log |\
tabcomment - | tabplot - 1 2,3,4 color=2,3,4 line=1,1
cat fit.log

Finding single peaks by setting an appropriate delta (related to a robust dispersion of the differences of the data):

tabtrend L1157-B1_109989__1.bstats.tab 2 | tabhist - robust=t
...
Robust Mean Disp : 1.52724e-05 0.00640417

tabpeak L1157-B1_109989__1.bstats.tab delta=0.05
# X Y Ypeak Delta Delta
166.000000 1.591776 0.083979 0.087718 0.080239
286.000000 26.544859 25.062155 25.063228 25.061082
452.000000 1.838022 0.324911 0.324182 0.325639
...
3524.000000 1.520718 0.229133 0.229248 0.229019
3810.000000 0.427400 -0.871551 0.870384 0.872717

See Also

tablsqfit(1NEMO) , tabnllsqfit(1NEMO) , tabtrend(1NEMO) , tabhist(1NEMO) , tabplot(1NEMO) , tabsmooth(1NEMO) , lineid(1NEMO) , table(5NEMO)

Author

Peter

Teuben

Update History


28-May-2013    V0.1 Created    PJT
30-may-2013    V0.2 added valley=    PJT
23-mar-2022    V0.4 added pmin=    PJT
25-mar-2022    V0.5 added edge=    PJT
23-jan-2023    V0.7 added npeak, epeak=    PJT
25-may-2023    0.8 added delta=    PJT


Table of Contents