Friend-Of-Friend (FOF), which is also known as percolation.


  EXSdetect_FOF.py inputfile


EXSdetect_FOF.py is an essential part of EXSdetect. It can also be used individually to group correlated points using the FOF method.

Let's say you have a list of points (a catalog). By cross-correlation you find that some of them are connected in the sense of, for example, being located within a linking-distance. Input a file whose first two columns contain the indices of each pair of connected points (friends), EXSdetect_FOF.py will gather all the friends of friends of each point, and divide all the points into groups of friends.


unix$ cat data.txt
#Index	X	Y
1	2	2
2	2	4
3	3	3
4	6	8
5	6	5
6	8	8

Here we have six points with indices of 1-6, as shown with the red numbers in the figure below.

We cross-correlate using a linking-distance of 3, and find 5 pairs of friends, as shown with the green lines in the figure above and listed below in "connections.txt".

unix$ cat connections.txt
#Index1	Index2
1	3
1	2
3	2
4	6
5	4
unix$ EXSdetect_FOF.py connections.txt
#Group	Point
1	1
1	2
1	3
2	4
2	5
2	6

EXSdetect_FOF.py divide the six points into two groups, as shown in the figure below.

Last modified: December 2013

Ha ha~, you know where the web page style is stolen from, if you are a X-ray astronomer. I like the "CIAO" website a lot. Grazie, CIAO. I acknowledge the Chandra X-ray Center (CXC) for their excellent work.

Teng Liu Email: lewtonstein@gmail.com