Table of Contents


tabdist - Compare distances between points in two tables, aka catalog matching


tabdist [parameter=value]


Given two tables, each containing specified column(s) that represent a set of 1D, 2D or 3D points, it will compute the nearest neigbor(s) from each point in the first table to those from the second table.

The output contains the same number of rows as the input number of rows in the first dataset.


The following parameters are recognized in any order if the keyword is also given:
First dataset, an ascii table. No default.
Second dataset, an ascii table. No default. The tables do not need to be of the same length.
Coordinate columns from 1st dataset. 1D, 2D and 3D are currently supported [1,2]
Coordinate columns from 2nd dataset. 1D, 2D and 3D are currently supported [1,2]
Column in first dataset representing the ID name. By default a number between 1 and number of sources is used. [0]
Column in second dataset representing the ID name [0]
Should columns be interpreted as angular (usually RA/DEC)? Only 2D comparisions are allowed here. Units must be radians at the moment. See also tabdms(1NEMO) . Default: false


The X,Y,Z coordinates of a 3 particle plummer sphere are perturbed by a small amount and then compared to the original list. Thus they must match one on one:
% mkplummer - 3 | snapprint - x,y,z > tab11
% tabmath tab11 - ’%1+rang(0,0.01),%2+rang(0,0.01),%3+rang(0,0.01)’ > tab12

First a one dimensional comparison

% tabdist tab12 tab12 1 4
1  0.117073   1  0.122846     0.005773
2 -0.00899587 2 -0.0100997    0.00110383
3 -0.108077   3 -0.0964223    0.0116547
and then a full 3D case:
% tabdist tab12 tab12 1,2,3 4,5,6
1  0.117073  -0.097704 -0.299081   1  0.122846  -0.102288 -0.317648   0.0199768
2 -0.00899587 0.293374  0.12652    2 -0.0100997  0.281876  0.121453   0.0126134

3 -0.108077  -0.19567   0.172561   3 -0.0964223 -0.203288  0.17993    0.0157534
Currently it will display the line number, the coordinate(s) in table1, then the best matching line number and coordinates(s) from table2, and finally the distance.


Currently a brute force (quadratic in N) minimum distance is used.

See Also

tabmath(1NEMO) , tabdms(1NEMO) , comparecats(SIRTF.map2)

k-d Match:




Peter Teuben

Update History

13-Feb-13    V0.1 Created    PJT
13-nov-2013    V0.3 added radec=    PJT
18-nov-2013    V0.4 added id1,id2=    PJT

Table of Contents