Table of Contents

Name

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

Synopsis

tabdist [parameter=value]

Description

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.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in1=
First dataset, an ascii table. No default.
in2=
Second dataset, an ascii table. No default. The tables do not need to be of the same length.
col1=
Coordinate columns from 1st dataset. 1D, 2D and 3D are currently supported [1,2]
col2=
Coordinate columns from 2nd dataset. 1D, 2D and 3D are currently supported [1,2]
id1=
Column in first dataset representing the ID name. By default a number between 1 and number of sources is used. [0]
id2=
Column in second dataset representing the ID name [0]
radec=t|f
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

Examples

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.

Caveat

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

See Also

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

k-d Match: http://arxiv.org/abs/1304.0838

Files

src/kernel/tab/tabdist.c

Author

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