next up previous contents
Next: 13. Telescope and CCD Up: Fitsblink 3.13 user manual Previous: 11. Blinking


12. Astrometry

With fitsblink it is possible to measure positions of stars and other point objects and even comets. To do this, it is first necessary to detect objects on the image, then to find a match between the detected stars and stars from a catalog, and to make a mathematical transformation between coordinates of the two sets of stars.

12.1 Detection of stars and other objects

You start star detection of the currently displayed image by choosing the Detect stars item in the Astrometry menu. Detection of stars has two steps: in the first step sky background levels are determined as a function of position inside the image, and in the second step stars are actually counted and their positions and intensities are determined. A list of these quantities, along with a star ID number, is stored in the computer memory. It is possible to store the results of star detection into a file by choosing the Save star list item. Format of the output file is fairly simple: input file name and Julian Day of observation in the first line, followed by a list of stars. For each star, there is a star ID, an x coordinate, a y coordinate and a star intensity. If star matching is performed (see subsection 12.2) successfully Save star list also outputs celestial star coordinates expressed in decimal degrees, position residual and magnitude of the star from the catalog.

Note that the stars which touch the edge of the image are not reported.

Some images are so large that you don't really want to detect objects all over the image. Instead, you may want to do this in a smaller region around the object of interest. For this, just use the middle mouse button to enlarge the desired region. If you detect objects after that, only objects inside this region will be detected.

12.1.1 Parameters

There are eight parameters concerning star detection that can be changed. You can find them in the Astrometry Options window. You can set Sigma above background value, which is a sensitivity threshold expressed in units of standard deviation of the image background level. Typically you will use values between 3.0 and 5.0. The Minimal accepted intensity is a threshold value expressed in pixel intensity units. A star is not detected if its total intensity is less than the minimal accepted intensity. This parameter is less important (and a bit redundant) and you can keep it close to zero. The Minimal star size in pixels is mostly used to prevent detection of hot pixels as stars. Normally you will keep this value equal 2. Stars which contain pixels with value above the Saturation level will be excluded from the coordinate in magnitude fitting procedures.

In certain applications it may be desired that the stars lying close to the image edge are not detected. This can be handled by the Insensitive edge parameter. It defines the number of pixels from each of the image edges where the stars are not reported. Finally, the Background grid size determines the size of grid elements inside which background values are determined. This value should not be too big, otherwise gradients in background level may not be well detected. Also, it should not be too small or background will be affected by bright stars and other objects more than you want. Values between 30 and 50 should be fine for most cases.

Fitsblink knows two methods of astrometry and photometry. In the first, it calculates the centroid and total intensity for all connected pixels which are above the threshold and can be reached from the pixel with the highest intensity.

The second method, which is the default setting, is a variation of the first one and can be conditionally called the aperture astrometry and photometry. Star coordinates are determined as a centroid of pixels which lie above the threshold but also inside a small circle centered around the pixel with the highest intensity. To determine the star intensity, an average of pixel values between the small circle and a larger circle is calculated and used as a background value. This is then multiplied by the number of pixels in the smaller circle which have values above the threshold and subtracted from the total signal inside the smaller circle to get the star intensity. For the astrometry of comets you should always use the aperture astrometry because the other method may yield wrong results due to asymetric coma. For large values (in comparison to star sizes) of the inner circle the aperture astrometry becomes practically identical to the alternative method which only uses pixels with values above some threshold.

12.1.2 Star list format

Here are first few lines from the 98kd3r5.dat file.

Input file name: /home/jure/c/fitsblink/examples/98kd3r5.fts time:2450960.34391204 magfac: 9.261900e+00
    0  203.41  425.36    33891.00 222.426789  0.361885 g      3261330   0.06  11.76
    1  340.29  487.02    21908.00 222.393369  0.289180 g      3261311   0.25  12.39
    2  211.92  187.61     5978.00 222.553614  0.356329 g      3270218   0.30  13.91
    3  198.19  369.38     4965.00 222.456681  0.364424 g      3260027   0.04  14.42
    4   62.06   97.30     4548.00 222.602370  0.435833 g      3270409   0.39  14.39
    5  219.05  256.28     4535.00 222.516947  0.352822 g      3270212   0.35  14.54
    6  339.95  424.35     4317.00 222.426813  0.289095
    7  251.13  269.00     3614.00 222.510037  0.335778 g      3270167   0.44  14.88
    8  332.75   64.76     2965.00 222.618698  0.291394 g      3270098   0.09  15.07
    9  254.19  111.81     1925.00 222.593897  0.333474
   10  172.11  507.79     1681.00 222.382929  0.378920
   11  150.39  232.54     1661.00 222.529874  0.389325 g      3270315   0.67  15.38
   12  161.86  187.89     1255.00 222.553655  0.383020
   13  270.87  423.58      823.00 222.427483  0.325916
In the first line there is the name of the image that was used to produce the star list, the Julian time of the observation and a constant used for the conversion from the intensities to magnitudes. More on this constant in section 12.4. Columns for the other rows have the following meanings:

Star ID for this image;
Star x coordinate;
Star y coordinate;
Star intensity (sum of pixels belonging to a star minus the local background)
Right ascension in decimal degrees.
Declination in decimal degrees
If match with a catalog star is found, a single letter tells catalog which was used. For now g stands for the GSC, u stands for the USNO SA and a stand for the ACT.
A star ID from the catalog.
Residual expressed in arc seconds.
Star magnitude from the catalog.

Only first four columns are always present, columns from 5 on appear only if the coordinate transformation between image and catalog coordinates was successfully made and the matching catalog star was found.

12.1.3 Loading a star list

Star list can also be imported. Choose Load star list item and select the wanted file name. Please note that, if the star list was saved after a successful match with a catalog the first line in the input file contains a constant used for proper calculation of magnitudes. Fitsblink reads star lists it has produced, but it should be an easy exercise to convert any star list to the desired format: you need a star id in the first column, x and ycoordinates in the second and third column and star intensity (not magnitude) in the fourth column.

12.1.4 Right mouse button

After succesfully detecting stars or importing of a star list you can display star coordinates by pointing a cursor to it and pressing the right mouse button.

12.1.5 Non-interactive mode

Extraction of star lists is often desired in a noninteractive mode. It is possible to use fitsblink in such a mode. You need a soft link named starcount (do ln -s fitsblink starcount), which points to the fitsblink program. If you run fitsblink using the name starcount, it will perform star counting on the input image. Command line parameters are:

12.2 Star matching

After the star detection, it is possible to match the detected stars with stars from a star catalog. This is an operation which can easily fail if you do something wrong. You should practice on one of the test images distributed together with the fitsblink program. Parameters needed for star matching (WCS values) can be either read from the FITS file header or input manually by choosing the Edit parameters item from the Astrometry menu. The pixel size values should be correct within few percent. Also, center coordinates should not be off by more than half of the field. The rotation angle usually does not need to be changed because fitsblink finds (or does not find) a match regardless of image orientation (for square pixels).

Figure 3: Edit parameters window.

12.2.1 You need some catalog

To do star matching, you need at least one of the supported star catalogs. Currently fitsblink reads GSC 1.1, USNO-SA 1.0 and ACT catalogs. First two are distributed on CD-ROM and must be obtained separately. It is possible to download the ACT catalog from the WWW page. However, to use this catalog with fitsblink, you must make a special reduced binary version with the makeact program. This program is distributed together with fitsblink. Follow the instructions in the README file to make binary version of the catalog. Only V magnitudes from the ACT catalog are used. There is a deficiency in using the ACT catalog, however. It only has relatively bright stars, up to magnitude $\approx$ 11. In many cases, all these stars will be saturated and therefore a bad reference. A solution around this, which combined the abundance of GSC stars and accuracy of ACT catalog, is a catalog called GSC-ACT. You can prepare this catalog by yourself if you have GSC 1.1 and obtain a conversion program from (

You need to mount the catalog containing CD-ROMs somewhere in the directory structure of your computer and make sure that you are allowed to read it. You choose the catalogs and set their paths in a window which appears after you choose the Catalogs item from the Astrometry menu (fig. 4).

Alternatively, you can copy these catalogs to your hard disk. In a case of GSC, it is possible to use a nice feature of the CFITSIO library that it automatically searches for the file.gz if it doesn't find file. You can compress all .gsc files and save some disk space. A single line Unix command which will do this is

find ./ -name ``*.gsc'' -exec gzip {} \;

Figure 4: Catalogs window.

12.2.2 How it works

Matching subroutine uses constellations of stars from star lists extracted from both the CCD image and the catalog. In the initial phase, it only uses a subset of bright stars from both sets. For each star in this subset it forms a constellation using the nearest stars from the subset. Then it tries to find a constellation of stars from the catalog which completely or partly matches the reference constellation. Each attempt of matching is given a value which indicates a level of similarity between the reference constellation and the constellation under investigation. The maximum value that can be achieved is n(n+1)/2, where n is the number you type in Number of stars in constellation field of the Astrometry options form. This number is never actually reached because stars from the CCD image never exactly match stars from the catalogue.

If the match is successful, a transformation between the coordinate systems is calculated and results of matching are presented in a window. It is possible to write the newly calculated WCS values directly into the FITS header (see also non-interactive mode). In this case a new FITS keyword will be added to the header: MATCHED = T. Update of FITS headers is only possible for the noncompressed images, because the CFITSIO library does not write the compressed images yet.

Figure 5: Display of input and calculated WCS coordinates.

12.2.3 Higher order plate solutions

Images with a large field of view will most likely have considerable distortions from the tangent projection which is normally used in calculating image coordinates from the celestial coordinates. If only a bilinear transformation is used for matching of catalog and image coordinates of the reference stars, the object positions will exhibit a position-dependent systematic error. This effect can be removed by using polynomials of two variables of an order higher than 1 for the transformation between the calculated and observed object positions.

Fitsblink allows a use of polynomials of two variables up to the 5th order. It is not very likely one would need this. but it will be demonstrated here that the 4th order is necessary for some real-life images.

Some caution is needed when higher order polynomials are used. The problem is that with a sufficient number of coefficients used in the transformation you can reduce the residuals to zero. This may give you a false impression about the accuracy of your astrometry while in reality the results will be worse than if using only a linear fit. The table shows how many coefficients are used to transform one coordinate for different orders of polynomials:

Order of polynomial Number of coefficients
1 3
2 6
3 10
4 15
5 21

The actual number of coefficients is twice the above numbers because you have to transform both x and y coordinates. To avoid accidental use of too high an order of polynomials, fitsblink takes care to fall back to lower order polynomials automatically. when the number of reference stars is not big enough. The rule for this was chosen rather arbitrarilly: the number of reference stars must be at least two times the number of coefficients used in transformation.

Let's look at an example how to check if your images have higher order distortions which have to be compensated for by using higher order plate constants.

Take a larger number of images and run fitsblink either in interactive or batch mode, first to detect stars and then to match them with a catalog. If your images already contain at least approximately correct WCS values (keywords CTYPE, CRVAL, CRPIX, CDELT and CROT), it is better and faster to make a small batch file which will process all of the images automatically. Such a file might look like this:


# Replace the right side of the following line with
# a path your catalogs

# erases the result file

for a in *.fts; do 

# Create a name of the star list file
b=`basename $a .fts`.dat
# Count the stars using "aperture" mode
# -s 5    ---  threshold
# -n 3.0  ---  radius of the inner circle
# -o 12.0 ---  radius of the outer circle
# -m 30   ---  size of the unit square inside which background is determined
starcount -l log.dat -s 5 -n 3.0 -o 12.0 -m 30 $a

# Make a match with the GSC catalog
# -f $b   ---  $b contains the name of the star list file
# -o 1    ---  1st order polynomials used for fitting
# -e 3    ---  allowed difference in star positions in initial fitting (in pixels)
# -m 12   ---  a minimal constellation value to be accepted
# -D 10   ---  a minimal distance between stars in constellation
# -b 200  ---  number of bright stars used for initial catalog matching
# -n 15   ---  number of stars in constellation
# -r 4    ---  maximal residual for the final matching (in arc seconds)
# -i 100  ---  maximal allowed ratio of intensities (not magnitudes)
#              between the stars from catalog and image
# -c      ---  two -c switches supply a path to the catalog
catalog -f $b -o 1 -e 3 -m 12 -D 10 -b 200 -n 15 -r 4 -i 100 \
    -c gscn:$gscn -c gscs:$gscs 

#  From the output file extract only lines which contain identification
#  with a catalog stars.  Also, calculate magnitudes from the intensities
awk 'NR==1{split($0, a, ":");mf=a[4];l10=1/log(10)}NR>1&&NF==10\
	{printf "%s %5.2f\n", $0, 2.5*(mf-log($4)*l10)}' $b >>results.dat

The above script will first measure star positions, make a match with the GSC catalog and extract the objects which were matched to the catalog object.

Using the gnuplot program you can plot the following information for the file results.dat.

Residuals as a function of the x coordinate on the detector:

gnuplot> plot 'results.dat' using 2:9

Residuals as a function of the y coordinate on the detector:

gnuplot> plot 'results.dat' using 3:9

Observed magnitudes as a function of catalog magnitudes:

gnuplot> plot 'results.dat' using 10:11

If you observer a position dependence of the residuals, like in fig. 6, try to increase the order of fitting and see what happens.

Figures 6 and 7 represent an x coordinate dependence of residuals for 96 images taken with the LONEOS system (59-cm, f/1.8 telescope, 1.6$\times$1.6 degrees FOV) with linear fitting and corrected residuals after order of polynomials was increased to 4. We see clearly that the coordinate dependence vanishes after the higher order fitting is applied.

Figure 6: Residuals of star positions as a function of x coordinates with a linear fit between the CCD and catalog coordinates.

Figure 7: Residuals of star positions as a function of x coordinates with the fourth order fit between the CCD and catalog coordinates.

12.2.4 What if matching fails?

There may be many reasons why matching between star lists extracted from a CCD image and a catalog fails. They are the following:

If you are reasonably sure about the correctness of the star field coordinates as well as the pixel size(s) and you still can not get a match, try the following in Astrometry options form:

Decrease Minimal value to accept constellation. This helps if you don't have enough stars either on the CCD image or in the catalog. If you decrease this value too much, you will get a lot of false matches and the coordinate transformation you will get will be wrong.
Increase Number of bright stars in initial matching. This may help if the CCD field and the catalog field only partially overlap or if you get a lot of spurious objects near some bright star or star cluster. Increasing this number too much may increase processing time dramatically.
Increase Number of stars in constellation. Bigger constellations are more likely to have some stars in common. Increases processing time. Do not use more than 20 stars.
Increasing Maximal positional error in pixels will treat incorrect pixel sizes but also increase matching time and possibly cause false matches.

Do the above parameter adjustment in the order as described here. As your despair increases, start to combine changes of different parameters until you finally get a match.

12.2.5 Non-interactive mode

Star matching with a catalog can be done also in a command line mode. By making a link catalog which points to fitsblink it is possible to run fitsblink with a command catalog. Output file name will be made automatically by stripping off whatever follows the last ``.'' in the image file name and replacing it by an extension dat. Some attention is required here because there are chances that the output .dat file gets the same name as the input .dat file. This may not be desired in some cases. A possible solution for this is to rename the input .dat file.

Here is a command line useful for the example image 98kd3r5.fts:

catalog -f 98kd3r5.dat -a 222.5 -d 0.366 -w 1.92 -h 1.92 \
	-c gscn:/cdrom -x 356 -y 541
The backslash above means continuation of the command line. Please note again that the center coordinates are specified in DECIMAL degrees. Default values for catalog matching are the same as in the interactive mode. As in the interactive mode, it is not possible to write the WCS values into the header (the -W option) if the image file is compressed. Note that the -c option may be used many times to possibly include different catalogs.

12.3 Astrometry

Finally! You successfully made all of the previous steps and you want to do astrometry of the asteroid you just imaged. Go to the Astrometry menu and choose the Do astrometry item. When inside the image, cursor shape will change from a box to a cross. Now point to some of the objects (red circles) and click left button on it. You will be asked for the object designation. When you enter it and click on the OK button, a window with the report suitable for sending to MPC (Minor Planet Center) will appear. At this point you can either send the report immediatelly or proceed with further astrometry. Coordinates are for the equinox J2000.

12.3.1 Simultaneous astrometry of the same object on many images

This is a rather specialized feature of fitsblink and it assumes that you somehow process the images in the search for moving or other interesting objects. Of course, part of the processing (object detection, astrometry and photometry) can be performed by fitsblink in a noninteractive mode but you will need some program of your own which will detect the objects of interest.

However, if you make an .inp file which contains marker positions which match object positions from the files produced by fitsblink, you can do a simultaneous astrometry and photometry of all objects with the same consecutive number in the .inp file. To test this, go to the examples/ directory and run fitsblink -i 98kd3r5-98kd3r6.inp. Click with the right button on the asteroid and write J98K03D in the object name field. Then press ont the Auto astr. button. The report window will not even appear, but you can check what happened by selecting the Mail results from the Astrometry menu. You should get the the same output as in the fig. 9.

12.4 Photometry

Along with the object positions, their brightnesses are also of interest. This value, as well as the position, can only be determined after the matching with stars from the catalog. The method of matching is rather simple: magnitudes mc of stars from the catalog are converted to ``intensities'' Ic using a formula

Ic=10-0.4 mc.

A factor of proportionality, mf, between the observed and catalogued magnitudes is found and used to convert the measured intensities, Io, to magnitudes, mo, using a formula

$m_o = 2.5 (m_f-\log_{10}I_o).$

This method has a certain deficiency because it assumes perfect linearity of the CCD detector. In reality, this is not the case. Most notably, brighter stars are typically saturated. One way around this is to exclude stars which saturate already in the matching routine. Heavily saturated stars, which also cause blooming (streaks in vertical direction), are either not detected by the star detection routine or have wrong positions so they will most likely be excluded from the fit automatically. An example how does a relation between measured and catalogued magnitudes look like, is shown in fig. 8. Note that the stars brighter than magnitude 12.8 were saturated on these images (LONEOS) and also that the filters used to produce the catalog anf the images were not the same.

Figure 8: Comparison of catalogued and measured magnitudes.

12.5 Asteroids

Fitsblink has a convenient feature which lets you both identify the asteroids and show the locations of all the asteroids in the displayed image. For this you need access to the services of a program called asteroid_server. This is possible either over the Internet or locally. There are currently no plans for the public release of this program, however you can use the service provided over the Internet. For the availability please check

After you establish your account for the server, you should write the server address, your id and the largest magnitude of asteroids that should be shown into the appropriate fields of the Asteroids tabfolder in the Settings window. This information (along with your IP address which is transmitted automatically) is needed to connect to the server.

12.6 Sending a report

The report window is used for editing and sending astrometry positions to the MPC. It is shown in fig. 9

Figure 9: Astrometry report window.

Sending astrometry reports to MPC requires certain format. Fitsblink writes information about the measurement in this format. Additionally, you have to give some basic information about you and about the measurement. If this information is present in the header of the image file or in the .fitsblinkrc file, it will be inserted in the message if you press the Insert header button. Otherwise you will have to type this information by yourself. You can use the Send astrometry report form as a primitive line editor and add additional information to the file which will be sent. When you press the Send button and comfirm your decision, the message is sent to whatever addresses you wrote into To: and CC: fields. So, be careful with this.

12.7 Settings

The following default settings can be written into file $HOME/.fitsblinkrc by fitsblink and then read at the start-up time.

Figure 10: Catalog paths: these are the places where the supported catalogs can be found.

Figure 11: Observatory settings: Observatory code, observer name(s), telescope name and size and instrument type.

Figure 12: Display settings: color or grey level, delay between blinking images, autolevel parameter and dimensions of the image window.

Figure 13: Mail defaults.

Figure 14: Telescope control commands.

Figure 15: Camera control commands.

Figure 16: Default parameters for star detection routines.

Figure 17: Default parameters for catalog matching routines.

Figure 18: Help system.

Figure 19: Asteroid settings.

next up previous contents
Next: 13. Telescope and CCD Up: Fitsblink 3.13 user manual Previous: 11. Blinking
Jure Skvarc