Program: reswri
Purpose: RESWRI derives the kinematical parameters from the observed
velocity field by fitting tilted-rings to the velocity field
and fits harmonic terms after convergence of the ROTCUR part of
code. RESWRI uses the 1 sigma error-field to calculate its
errors.
Category: CALCULATION, DYNAMICS, ROTATION CURVES, VELOCITY FIELDS
File: reswri.c
Author: K.G. Begeman
ROTCUR modified to RESWRI by R.H.M Schoenmakers
Keywords:
INSET= Set (and subset) of observed velocity field.
** INSET2= Input set (and subset) of total HI field.
OUTSET= Output set (and subset) of residual of residual: [none]
BOX= Select area of velocity field [entire velocity field].
BUNIT= If the map units are not found in the header, they must be
supplied by the user [KM/S].
RADII= Give central radii of concentric rings. Maximum number of rings
is 512. Units are arcsec.
WIDTHS= Give width of rings. If number of widths is less than the
number of radii, the last supplied width will be used for the
rest of the rings. Units are arcsec.
VSYS= Give initial estimate of systemic velocity in km/s.
VROT= Initial estimate(s) rotation velocity(ies) in km/s.
If the number of rotation velocities is less than the number
of rings, the last supplied rotation velocity will be used
for the rest of the rings.
VEXP= Initial estimate(s) expansion velocity(ies) in km/s [0.0].
If the number of expansion velocities is less than the number
of rings, the last supplied expansion velocity will be used
for the rest of the rings.
PA= Initial estimate(s) position angle(s) in degrees.
If the number of position angles is less than the number
of rings, the last supplied position angle will be used
for the rest of the rings.
INCL= Initial estimate(s) inclination(s) in degrees.
If the number of inclinations is less than the number
of rings, the last supplied inclination will be used
for the rest of the rings.
CENTRE= Initial estimates of centre of rotation in any coordinates.
FREEANGLE= Free angle around minor axis: [0.0]
Angle around minor axis in degrees within which radial
velocities are discarded. For RESWRI this value is
usually 0.0.
SIDE= Which half of the velocity field should be used in the
fitting [RECEDING and APPROACHING half].
WEIGHT= Weighting function: [UNIFORM]
For RESWRI always use UNIFORM !!
There are three weighting functions available: the
UNIFORM weighting function, were all points in a
ring have equal weights, the [COSINE] weighting function,
were each point in a ring is weighted with |cos(theta)|,
and the COS-SQUARED weighting function, were each point is
weighted with cos(theta)^2.
FIXED= Which parameter(s) should be kept fixed [NONE]. The parameters
are named VSYS, VROT, PA, INCL, XPOS and YPOS. If you don't
want to fit the inclination and the systemic velocity, you
should type: INCL VSYS. If a fit is wanted to only one half of
the velocity field the parameters VSYS, XPOS and YPOS are
automatically kept fixed.
** TOLERANCE= Tolerance of least-squares fitting [0.001].
FILENAME= Name of text file to save results [reswri**]. Default the
name of the file is equal to the name of the table.
FILECOEFF= Filename kinematic harmonic coeff.: [coefficients.txt]
File on disk with kinematic harmonic coefficients.
FILEHICOEF= Filename surface density harmonic coeff.: [hicoef.txt]
File on disk with surface density harmonic coefficients.
Prompted only if INSET2= was specified.
Description: This program does a least-squares-fitting with errors on the value
of v(x,y) to the function:
v(x,y) = VSYS + VROT * cos(theta) * sin(INCL)
+ VEXP * sin(theta) * sin(INCL)
- (x-XPOS) * sin(PA) + (y-YPOS) * cos(PA)
with: cos(theta) = -------------------------------------------
r
- (x-XPOS) * cos(PA) - (y-YPOS) * sin(PA)
and: sin(theta) = ---------------------------------------------
r * cos(INCL)
Here v(x,y) denotes the radial velocity at rectangular sky
coordinates x and y, VSYS the systemic velocity, VROT the
rotational velocity, VEXP the expansion velocity, INCL the
inclination angle and theta the azimuthal distance from the
major axis in the plane of the galaxy. Theta is a function of
the inclination (INCL) and the position angle (PA) of the
major axis. XPOS and YPOS denote the position of the rotation
centre.
This program will fit for each ring the parameters VSYS, VROT,
VEXP, INCL, PA, XPOS and YPOS.
Note that the position angle (PA) of the major axis is
defined as the angle, taken in anti-clockwise direction
between the north direction on the sky and the major axis of
the receding half of the galaxy.
When this fitting procedure has converged, the program fits a
basis a(0) + SUM(i=1,fitdeg) a(i)cos(i*theta) + b(i)sin(i*theta)
to the points with angle theta and velocity v(x,y).
The code uses a singular value decomposition fitting routine
to do this (taken from Numerical Recipes, Press et al.).
Notes: The results of the fitting are saved in a GDS table reswri**,
where ** is a number from 1 to 99. If table reswri99 is
already present, table reswri00 will be used. The results
are also stored in a file named reswri.** or as defined
by the user (keyword FILENAME=).
Note also that the parts of the code between
"================================="
-type of comments have been added by RHS to the original
ROTCUR-code.
Example: reswri
reswri Version 1.2 (Nov 24 1998)
RESWRI INSET=drop 2 inset2=drop 1
Set drop has 3 axes
RA-NCP from -134 to 115
DEC-NCP from -116 to 135
PARAM-GAUSSFIT from 1 to 11
Set drop has 3 axes
RA-NCP from -134 to 115
DEC-NCP from -116 to 135
PARAM-GAUSSFIT from 1 to 11
RESWRI BOX=
BOX range for set drop :
RA-NCP from -134 to 115
DEC-NCP from -116 to 135
RESWRI OUTSET=martintest
Set martintest has 3 axes
RA-NCP from -134 to 115
DEC-NCP from -116 to 135
PARAM-GAUSSFIT from 2 to 2
RESWRI VSYS=600
RESWRI VROT=150
RESWRI VROT=
RESWRI VEXP=
RESWRI PA=216
RESWRI PA=
RESWRI INCL=70
RESWRI INCL=
RESWRI CENTRE=8 -9
RESWRI FREEANGLE=
RESWRI SIDE=
RESWRI WEIGHT=
RESWRI FIXED=vexp xpos ypos
RESWRI FITORDER=9
RESWRI FILECOEFF=
RESWRI OVERWRITE=y
RESWRI FILEHICOEFF=
RESWRI OVERWRITE=y
RESWRI FILEHICOEFF=
RESWRI OVERWRITE=y
radius of ring: 80.00 arcsec
iter. systemic rotation position incli- points sigma
number velocity velocity angle nation velocity
0 600.00 150.00 216.00 70.00 102 212.
1 789.76 29.35 254.30 53.84 165 31.0
2 766.41 41.63 255.90 44.94 196 21.0
3 763.00 36.60 253.60 56.48 166 20.6
4 763.08 36.61 253.69 56.45 168 20.5
5 763.08 36.61 253.69 56.45 168 20.5
........
RESWRI wrote kinematic harmonic coeff. in file [coefficients.txt]
RESWRI wrote surface density harmonic coeff. in file [hicof.txt]
RESWRI FILENAME=
Results will be stored in TABLE reswri00 and FILE reswri.00
The output file in FILECOEFF= (default coefficients.txt) is an
ASCII file with the following columns:
radius(arcsec) c0, error c0,
c1, error c1, s1, error s1,
c2, error c2, s2, error s2,
c3, error c3, s3, error s3, etc...
All c and s values are in Km/s. Use your own plot program
(GPLOT, sm, etc.) to visualize this data.
Updates: Jul 17, 1992: KGB, Document created.
Mar 20, 1993: KGB, fitting one half of vfield repaired.
Mar 23, 1993: KGB, fitting of expansion velocities.
Jan 13, 1994: KGB, keyword FILENAME= added.
May 20, 1994: VOG, MAXRING increased from 60 to 512
Feb 15, 1995: RHS, Fitting of higher order harmonic terms
Nov 24, 1998: RHS, Added fitting of harmonic terms
and renamed modified ROTCUR to RESWRI.
Nov 24, 1998: VOG, Installed RESWRI with new filename
keywords FILECOEFF= and FILEHICOEFF=
Apr 15, 2009: VOG, -Changed definition of nint() to use
floor() for the nearest integer.
Change was necessary for consistency
with other coordinate routines.
-Change '|' to '||' in if statement