Program: ASTROM Purpose: Determine the sky-projection parameters CRVAL, CDELT, CRPIX and CROTA Category: FITTING, COORDINATES File: astrom.c Author: M.G.R. Vogelaar Keywords: INSET= Give set, subsets: Maximum number of subsets is 1. ** PROSYS= Give projection system 1..10 [header] If there is no reference to a projection system in the header, 'gnomonic (4)' is assumed. You can overrule the default projection with PROSYS= COORDSXY= Give position _h_m_s _d_m_s : [NO MORE COORDS.] This keyword is asked in a loop. A recall file can be used to give the positions. The positions are given in hms dms format e.g.: 12h14m31.08s 47d31m50.3s or in degrees e.g.: 183.6295 47.530639 See also the description. GRIDXY= n: Grid for the n-th position: Give longitude, latitude in grids. If SEARCHBOX= has at least one size greater than 1, this position is the center of a 'search box' in which the position af the local maximum is determined. If a size of the search box is 1, the corresponding user given value of GRIDXY= is returned. SEARCHBOX= Give size of 'search' box: [21 21] Width and height of box in which a maximum must be found. Each position in COORDSXY= must corres- pond to a grid given in GRIDXY= The value given in GRIDXY= is the center of a 'search box' of size SEARCHBOX= In this box the position of the maximum is determined and returned as the wanted grid position. If you want to use the grid position given in GRIDXY= itself, use SEARCHBOX=1 1 ** DISPLAY= Display found and fitted positions: Y/[N] Write a table in the log file with the input physical positions, the found grid positions of the local maximum (in the search box), the (output) fitted grid positions, and the difference between found and fitted grid positions. ===== Keywords asked in the 'fit' loop: ===== (The coordinate parameters are CRVAL, CROTA, CDELT and CRPIX. If a value could be found in the header, then this value will be the default initial estimate for the fit. Else, there is no default.) CRVALX= long. proj. centre: [header value] holds the physical coordinate at the reference pixel location in some units. The units are defined in the non-standard FITS descriptor CUNIT. CRVALY= lat. proj. centre : [header value] CROTA= rotation angle : [header value] Holds the rotation angle in degrees of the actual axis. It is assumed that the spatial latitude axis carries the rotation information. CDELTX= grid size x : [header value] The pixel separation in units specified in the header item CUNIT. Note that CDELT may be negative. CDELTY= grid size y : [header value] CRPIXX= ref. x grid pos. : [header value] CRPIX indicates the location of the reference pixel on an axis. The grid position of the reference pixel is always zero. For this position the physical coordinate is precisely defined in CRVAL. CRPIXY= ref. x grid pos. : [header value] MASK= Give mask for parms.0=fixed,1=free: [default by program] For all parameters where ASTROM could find an value in the header, ** TOLERANCE= Convergence criterion. [0.01] Relative tolerance. Fitting of the function stops when successive iterations fail to produce a decrement in reduced chi-squared less than TOLERANCE. If its value is less than the minimum tolerance possible, it will be set to this value. This means that maximum accuracy can be obtained by setting TOLERANCE=0.0. ** LAB= Mixing parameter: [0.01] Mixing parameter, LAB determines the initial weight of steepest descent method relative to the Taylor method. LAB should be a small value (i.e. 0.01). NEXT= (Q)uit, (U)pdate header and quit, (R)epeat fit: [Q] Fit again with different initial estimates or parameters. The default 'Q" stops the program. 'R' gives you the opportunity to change values and to fit again. i.e. NEXT=R MASK=1 1 1 CROTA=30 'U' stops the program and updates the header with the fitted values for CRVAL, CROTA, CDELT and CRPIX. Additional remarks are stored in the history. REMOVE= Give number(s) of position(s) to remove: [NONE]n Exclude one or more positions by specifying the position number(s) as displayed in the table (DISPLAY=YES). e.g. REMOVE=2:5 will remove entries 2 3 4 and 5 of your array with positions. Description: ASTROM determines coordinate parameters of the (sub)set specified in INSET=. The (sub)set must be 2-dimensional and must have spatial axes only. Your set can have corrupted coordinate parameters like the physical position of the reference pixel (CRVAL), a rotation angle (CROTA), a grid spacing (CDELT) or the position of the reference pixel (CRPIX, the pixel with grid coordinate 0). Note that CRVAL and CRPIX are coupled. To fit these parameters, you need a list of physical positions and the corresponding grids. If the physical position represent sources in your map, then only an approximate grid position is needed. The program creates a box with sizes SEARCHBOX= around your position and will find the position of the local maximum (using the values of the neighbouring pixels and a second degree polynomial). The physical coordinates are given in COORDSXY= You can use a recall file as input. Longitude and latitude are entered in COORDSXY= as two strings. Each string can consist of 3 (or less) numbers separated by a delimiter from the set 'dDhHmMsSrR'. They mean the obvious: the degrees (or hours) are separated by a 'd' ('h') from the minutes which in turn are separated by an 'm' from the seconds. The seconds may be closed by an 's'. Some examples: 120d30m15s ==> 120 + 30/60. + 15/3600. -60d12.5m ==> -( 60 + 12.5/60. ) 12h30 ==> ( 12 + 30/60. ) * 15 12h30s ==> ( 12 + + 30/3600. ) * 15 12.3 ==> 12.3 4r ==> 4 * 180 / pi The grids are entered in GRIDXY= For each physical position there must be a grid. The position input loop is aborted with carriage return. The calculated position can be displayed in the log file if DISPLAY=Y. If you specified all coordinates, you have to enter values for the coordinate parameters. These values are used as initial estimates for the fitting routine. If values could be found in the header of the set, then these values are the defaults. If all parameters are specified, i.e. CRVALX CRVALY= CROTA= CDELTX= CDELTY= CRPIXX= CRPIXY= all have a value, it is possible to set a mask with MASK= Input for this keyword can be 0 or 1, 0 is a fixed parameter and 1 is a free parameter. e.g. MASK=1 1 1 1 1 0 0 means that you specified CRVALX CRVALY= CROTA= CDELTX= and CDELTY= as free parameters and CRPIXX= and CRPIXY= as fixed parameters. The output is a list of values of the fitted parameters and the errors. The fit can be repeated if you give NEXT=R Together with this keyword you can change the initial estimates, the mask or the values for TOLERANCE= and LAB= These keywords are described in the keyword list. If you want to put the fitted values in your header, use NEXT=U. The items will be updated and some history is written like: HISTORY ======= ASTROM,Mon Jun 21 17:26:19 1993 CRPIX2: 257 replaced by 257 The program is ended with NEXT=Q (default). Notes: ....... Example: ASTROM INSET=continuum 0 ASTROM Version 1.0 (Jun 21 1993) Set continuum has 3 axes RA---NCP from -256 to 255 DEC--NCP from -256 to 255 PARAM-MEAN from 0 to 0 No rotation angle in header =========== SKYFIT parameters for set [continuum] =========== longitude projection centre (CRVAL): -176.667 DEGREE latitude projection centre (CRVAL) : 47.3333 DEGREE rotation angle (CROTA) : unknown! grid size x grid (CDELT) : -0.00138889 DEGREE grid size y grid (CDELT) : 0.00188885 DEGREE reference x grid position (CRPIX) : 257 reference y grid position (CRPIX) : 257 Sky system: equatorial, Epoch: 1950.0 Projection system: north celestial pole (WSRT) ASTROM COORDSXY= ASTROM GRIDXY= ASTROM COORDSXY= Read 6 positions ASTROM SEARCHBOX= ASTROM CRVALX= ASTROM CRVALY= ASTROM CROTA= ASTROM CROTA=0 ASTROM CDELTX= ASTROM CDELTY= ASTROM CRPIXX= ASTROM CRPIXY= ASTROM MASK=1 1 1 1 1 ====PARAMETER=====================ESTIMATE==STATUS======FIT============ERROR==== (CRVALX=) long. proj. centre: -176.666700 free -176.668040 +/- 0.0004682 (CRVALY=) lat. proj. centre : 47.333330 free 47.332966 +/- 0.0004559 ( CROTA=) rotation angle : 0.000000 free 0.139005 +/- 0.0807541 (CDELTX=) grid size x : -0.001389 free -0.001391 +/- 0.0000021 (CDELTY=) grid size y : 0.001889 free 0.001878 +/- 0.0000051 (CRPIXX=) ref. x grid pos. : 257.000000 fixed 257.000000 +/- 0.0000000 (CRPIXY=) ref. y grid pos. : 257.000000 fixed 257.000000 +/- 0.0000000 Number of iterations in fit: 2, TOLERANCE=0.01, mixing parameter LAB=0.01 ASTROM NEXT=u ASTROM +++ FINISHED +++ Updates: Jun 15, 1993: VOG, Document created. Aug 23, 1993: VOG, Program changed for new skyfit. New table with DISPLAY=Y Mar 29, 1994: VOG, Extended length of datum string