Extended Functions of SweepLine.py

Make Delaunay Diagram

If you want the Delaunay diagram besides the Voronoi diagra, add a "-D" option.
unix$ SweepLine.py data.txt -D --makeimage
unix$ ds9 data_image.fits -region data_points.reg -region data_Delaunay.reg

Calculate the area of each Voronoi cell

With the "--calarea" option, SweepLine.py calculate the area of each Voronoi cell and save the value in an "area map".

unix$ SweepLine.py data_image.fits --calarea
unix$ ds9 data_image_area.fits -region a.reg -region data_image.reg

The sum of the area values in each cell is 64 (8x8).

Build Pixelated Voronoi Diagram (image input only)

Pixelation of the Voronoi diagram is sometimes useful, which provides you an image mask of the Voronoi tessellation. While building this pixelated Voronoi diagram (PVD), all the pixels enclosed by a Voronoi cell are included into a pixelated Voronoi cell. If one pixel is equally distant from two or more Voronoi sites (i.e., the pixel center falls on an Voronoi edge), it is assigned randomly among the two or more cells. The option is "--calpvd"

unix$ ./SweepLine.py data_image.fits --calpvd
unix$ ds9 data_image_pvd.fits -region data_image.reg

Generate a density map (image input only)

Density is defined as pixel value divided by cell area. With the "--caldst" option, SweepLine.py fills a PVD with the density value. This provides kind of a dynamical-scale smoothing.

unix$ ./SweepLine.py data_image.fits --caldst
unix$ ds9 data_image_dst.fits -region data_image.reg

Note that some on-Voronoi-edge pixels are assigned randomly to a related cell. The density value of such pixel is not randomly selected, it's calculated by averaging the nearest pixels around it.

--size "M,N" (works with events input)

You can manually set the image sizes with this options. The sizes must be larger than the shifted points coordinates.

unix$ ./SweepLine.py data.txt --size "10,15" --makeimage
unix$ ds9 data_image.fits -region data.reg -region data_points.reg

--rmedgepoint (works with --calarea)

Remove points at the image border from the area map. See the example area maps of one same image including and excluding these points. It's clear why these points are useless. Their areas can be enlarged manually with the "--size" option.

--resolution N [0~5] default=3

When you input points as events, the positions, which are regarded as image coordinates by SweepLine.py, can be float value with high accuracy. However it's unpractical if the accuracy is too high. With the "--resolution N" option, the float coordinates will be rounded to N decimal places.

unix$ cat data.txt
-0.5 1.5
1.1 3.3
2.9 5.7
3.1 4.3
5.4 2.6
6.3 3.1
6.3 3.1001

unix$ SweepLine.py data.txt --resolution 3
Voronoi Construction: data
Warning: 1 duplicated points deleted
>> data.reg

unix$ SweepLine.py data.txt --resolution 4
Voronoi Construction: data
>> data.reg

In this example, we add a point "6.3 3.1001" to the end of data.txt. Using --resolution 3, this point will be excluded. While using --resolution 4, it is treated as an independent point.

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