This HTML automatically generated with rman for NEMO
Table of Contents

Name

tabint - integrate a sorted table, optionally higher order moments

Synopsis

tabint [parameter=value]

Description

tabint integrates a function Y=F(X) that is defined by a set of (X,Y) points selected from two columns from an ASCII table. The function can either be resampled using a spline interpolation, or directly summed using the trapezoid rule.

See also tabhist(1NEMO) with cumul=t for a visual display, though the cumulative option here can also produce a table for display to check the convergence of the integral.

An optional scale factor can be applied, which folds in any X or Y scaling that might want to be applied. This is particularly useful if you integrate the points themselves (i.e. without giving a step=) but still want to scale the X coordinate.

Optionally the 1st or 2nd moment can be computed (step=, normalize= and cumulative= are then ignored).

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 table file.
No default.
xcol=
Column with X coordinate. If the X coordinates are not increasing, the array will be reversed.
[Default: 1]
ycol=
Column with Y coordinate of function
[Default: 2]
xmin=
if given, value below which data to be discarded
By default it uses the smallest datapoint from the table.
xmax=
if given, value above which data to be discarded
By default it uses the largest datapoint from the table.
step=
Integration step if resampling used.
By default the datapoints themselves are used, but by setting an integration step here, the function is resampled using a spline and numerically integrated that way. See also scale=.
normalize=t|f
Normalize integral. If set, the integral is normalized by the integration interval. An output table contains the cumulative function.
[Default: f]
cumulative=t|f
If set, it will show the invidual cumulative integrations instead. Only implemented for native steps.
[Default: f]
scale=
scale factor to apply to the integral. This is also to use a different step size if integrating the individual points.
[Default: 1]
mom=0|1|2
The moment along the profile. mom=0 is the flux, mom=1 the first moment along the X axis, and mom=2 the dispersion.
[Default: 0]

Examples

Integrating the square function from 0 to 1 to get 1/3:

% nemoinp 0:1:0.1 | tabmath - - ’%1*%1’ | tabint -
0.335
% nemoinp 0:1:0.1 | tabmath - - ’%1*%1’ | tabint - step=0.01
0.33335

Here is an example to compute the line integral of a spectrum where the frequency axis is in GHz, and intensity in Kelvin. We want to get an answer in K.km/s instead. We know the line is (redshifted) around 110.5 GHz, and we take a window of 0.3 GHz around the line:

% tabint rsr.33551.driver.sum.txt xmin=110.5-0.3 xmax=110.5+0.3 scale=c/110.5/1000
8.05

% tabint rsr.33551.driver.sum.txt xmin=110.5-0.3 xmax=110.5+0.3 scale=c/110.5/1000 |\
tabplot - 1 2 line=1,1 point=2,0.1 ycoord=0

recalling that c is in m/s and the requested line integral was requested in km/s.

Caveats

The table needs to be (reverse) sorted in X. A future option might sort, though sort(1) might already work. Here’s an example where the 3rd column is an unsorted X coordinate. The 6th column is the data value:

% sort -n +2 my.tab | tabint - 3 6

perhaps easier

% tabcols my.tab 3,6 | sort -n | tabint -

See Also

tabfilter(1NEMO) , tabhist(1NEMO) , tabmath(1NEMO) , tabnllsqfit(1NEMO) ΒΈ tabpeak(1NEMO) , table(5NEMO)

Files

src/kernel/tab

Author

Peter Teuben

Update History


13-May-05    V0.1 Created    PJT
10-sep-2022    V0.5 added cumulative=    PJT
22-feb-2022    V0.6 added xmin=, xmax=, scale=    PJT
31-jul-2023    V0.7 poor man’s implementation of mom=    PJT
6-apr-2024    V0.9 clarifications    PJT


Table of Contents