aa

Basic Function of SweepLine.py


You can provide the coordinates of points (Voronoi sites) in two ways, either in terms of a coordinates list or an image. If the input file has a suffix of ".fits", it is taken as a FITS format image. Or else, it is regarded as an ASCII plain-text file, which contains the coordinates of points in its first two columns.

For example the points are contained in the file "data.txt"

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

Run SweepLine.py with "--makeimage" option, which tells SweepLine.py to generate an image which contains the input points, in order to check the result easily.

unix$ SweepLine.py data.txt --makeimage

The basic function of SweepLine.py is to construct the Voronoi diagram, which is composed of lines. The lines can be single-endpoint rays at the image border. However, SweepLine.py confines them to the box domain of the image. Therefore, all the lines have two endpoints, which are easy to plot in a figure. The lines which are described by four values (a pair of endpoints) are presented in a ds9 manner. In this example, Voronoi diagram is saved in "data.reg".

With the "--makeimage" option, two addition files "data_image.fits" and "data_points.reg" are generated, in order to visualize the result with ds9. The header of "data_image.fits" is as follows:

BITPIX  =                  -64 / array data type
NAXIS   =                    2 / number of array dimensions
NAXIS1  =                    8
NAXIS2  =                    8
OFFSETX =                  0.5
OFFSETY =                    0
Check the result with ds9.
unix$ ds9 data_image.fits -region data_points.reg -region data.reg

The circles are the input points, however the coordinates are transfered from C-fromat to Fortran-format and shifted to the range of [0,imagesize].

X_input + OFFSETX + 1 = Y_ds9
Y_input + OFFSETY + 1 = X_ds9

"data_image.fits" is a 8x8 image, in which point positions are rounded to integers.

Then, use the "data_image.fits" as an input to show how the FITS-input mode works.

unix$ SweepLine.py data_image.fits
unix$ ds9 data_image.fits -region data_image.reg

The pattern is different because the input Voronoi sites are different, which have integer positions.


Last modified: December 2013
logo

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