Creates a 2-dimensional template mesh for linearly-changing mismatch ellipses. More...
Creates a 2-dimensional template mesh for linearly-changing mismatch ellipses.
This test program creates a template mesh for a parameter space with an arbitrary mismatch metric. The following option flags are accepted:
outfile
. If absent, no output is written. psfile
, using plot flags flags
(see below). If absent, no plot is made. debug
. If absent, a debug level of zero is used. mismatch
, maximum number of mesh points to nmax
and the maximum estimated number of columns to cmax
. If mismatch
is not in the range (0,1], it is taken to be 1. If nmax
or cmax
is non-positive, it is ignored (no maximum). If this option is not given, -m 1 0 0 is assumed. x1
,y1
) and (x2
,y2
) from the origin. If absent, the region is taken to be a unit square. a
and b
units, and the angle from the \( x \) -axis to the first principal axis is c
radians. If absent, -e 0.1 0.05 1 is assumed. a
, b
, and c
(above) to dadx
, dbdx
, and dcdx
, respectively. If absent, the rates are taken to be zero. a
, b
, and c
(above) to dady
, dbdy
, and dcdy
, respectively. If absent, the rates are taken to be zero. The test program reads the input arguments and creates a parameter structure *params
to be passed to LALCreateTwoDMesh(). In particular, it computes the domain of the parameter space, and defines functions and parameter lists to compute the range in \( y \) at any \( x \) , and the metric at any point \( (x,y) \) . If PostScript output is requested, it is generated using LALPlotTwoDMesh(), using the value of the command-line number flags
to set the plotting parameters. Each of these functions is discussed below.
x1
\( =x_1 \) , x2
\( =x_2 \) , y1
\( =y_1 \) , and y2
\( =y_2 \) . The parameter space is then defined to be a parallelogram with one corner on the origin, and two sides defined by vectors \( (x_1,y_1) \) and \( (x_2,y_2) \) . Without loss of generality we assume that \( x_1<x_2 \) . The functions defining the boundaries are denoted \( y_{a,b}(x) \) , and we make no assumption about their signs or relative order. The algorithm used then depends on the signs of \( x_1 \) and \( x_2 \) .If \( x_1=x_2=0 \) , then the parameter space is singular, and no mesh need be generated.
If \( x_1=0 \) and \( x_2\neq0 \) , then the domain is \( [0,x_2] \) , and the boundary functions are:
\begin{eqnarray} y_a(x) & = & y_2x/x_2\\ y_b(x) & = & y_1 + y_2x/x_2 \end{eqnarray}
If \( x_2=0 \) and \( x_1\neq0 \) , then the domain is \( [x_1,0] \) , and the above equations for \( y_{a,b}(x) \) simply have 1 and 2 reversed.
If \( x_1 \) and \( x_2 \) have the same sign, then the domain is \( [0,x_1+x_2] \) if \( x_1 \) and \( x_2 \) are positive, and \( [x_1+x_2,0] \) otherwise. The boundary functions are:
\begin{eqnarray} y_a(x) & = & \left\{\begin{array}{c@{\qquad}c} y_1x/x_1 & x\mathrm{~between~}0\mathrm{~and~}x_1 \\ y_1 + y_2(x-x_1)/x_2 & x\mathrm{~between~}x_1\mathrm{~and~}x_1+x_2 \end{array}\right.\\ y_b(x) & = & \left\{\begin{array}{c@{\qquad}c} y_2x/x_2 & x\mathrm{~between~}0\mathrm{~and~}x_2 \\ y_2 + y_1(x-x_2)/x_1 & x\mathrm{~between~}x_2\mathrm{~and~}x_1+x_2 \end{array}\right. \end{eqnarray}
If \( x_1 \) and \( x_2 \) have opposite sign, the domain is \( [x_1,x_2] \) if \( x_1<0 \) , and \( [x_2,x_1] \) otherwise. The boundary functions are:
\begin{eqnarray} y_a(x) & = & \left\{\begin{array}{c@{\qquad}c} y_1x/x_1 & x\mathrm{~between~}0\mathrm{~and~}x_1 \\ y_2x/x_2 & x\mathrm{~between~}0\mathrm{~and~}x_2 \end{array}\right.\\ y_b(x) & = & \left\{\begin{array}{c@{\qquad}c} y_1 + y_2(x-x_1)/x_2 & x\mathrm{~between~}x_1\mathrm{~and~}x_1+x_2 \\ y_2 + y1(x-x_2)/x_1 & x\mathrm{~between~}x_2\mathrm{~and~}x_1+x_2 \end{array}\right. \end{eqnarray}
The main program sorts the input parameters so that \( x_1\leq x_2 \) , stores them in a 4-dimensional array, and assigns a void
pointer to that array. It also computes the domain. The routine LALTwoDRangeTest() takes a value of \( x \) and the void
pointer, computes the values of \( y_a(x) \) and \( y_b(x) \) according to the algorithm above, sorts them, and returns them ordered from lower to higher.
a
, b
, c
, dadx
, dbdx
, and dcdx
, stores them in a 9-dimensional array, and assigns a void
pointer to it. The routine LALTwoDMetricTest() takes a position \( (x,y) \) and the void
pointer, and computes the `‘local’' value of the principal axis \( a= \) a
\( +x\times \) dadx
\( +y\times \) dady
, and similarly for \( b \) and \( c \) . If that ellipse corresponds to the \( m_\mathrm{thresh} \) mismatch level contour, then the eigenvalues of the corresponding metric are \( \lambda_1=m_\mathrm{thresh}/a^2 \) and \( \lambda_2=m_\mathrm{thresh}/b^2 \) . The metric components are thus: \begin{eqnarray} g_{xx} & = & \lambda_1\cos^2(c) + \lambda_2\sin^2(c) \;,\\ g_{yy} & = & \lambda_1\sin^2(c) + \lambda_2\cos^2(c) \;,\\ g_{xy} \quad = \quad g_{yx} & = & (\lambda_1-\lambda_2)\cos(c)\sin(c) \;. \end{eqnarray}
The routine assumes that the values of \( a \) , \( b \) , and \( c \) refer to an \( m_\mathrm{thresh}=1 \) mismatch ellipse. It computes and returns \( g_{xx} \) , \( g_{yy} \) , and \( g_{xy} \) in a 3-dimensional array.flags
is an unsigned integer whose lowest-order bits contain parameters to be passed to LALPlotTwoDMesh(). The bits and their meanings are: If mesh points are to be plotted, they will be filled circles \( 1/72'' \) (1~point) in diameter. The parameter space will be rotated so that the longer of the diagonals of the parallelogram will be vertical, and scaled to fit on one \( 8.5''\times11'' \) page. That is, if \( ||(x_1+x_2,y_1+y_2)||\geq||(x_1-x_2,y_1-y_2)|| \) , the rotation angle of the coordinate axes will be \( \theta=\pi/2-\arctan\!2(y_1+y_2,x_1+x_2) \) , or \( \theta=\pi/2-\arctan\!2(y_2-y_1,x_2-x_1) \) otherwise. We note that the function \( \arctan\!2(y,x) \) returns the argument of the complex number \( x+iy \) in the range \( [-\pi,\pi] \) .
Definition in file TwoDMeshTest.c.
Go to the source code of this file.
Macros | |
Error Codes | |
#define | TWODMESHTESTC_ENORM 0 |
#define | TWODMESHTESTC_ESUB 1 |
#define | TWODMESHTESTC_EARG 2 |
#define | TWODMESHTESTC_EBAD 3 |
#define | TWODMESHTESTC_EMEM 4 |
#define | TWODMESHTESTC_EFILE 5 |
#define | TWODMESHTESTC_EMETRIC 6 |
#define | TWODMESHTESTC_MSGENORM "Normal exit" |
#define | TWODMESHTESTC_MSGESUB "Subroutine failed" |
#define | TWODMESHTESTC_MSGEARG "Error parsing arguments" |
#define | TWODMESHTESTC_MSGEBAD "Bad argument value" |
#define | TWODMESHTESTC_MSGEMEM "Memory allocation error" |
#define | TWODMESHTESTC_MSGEFILE "Could not open file" |
#define | TWODMESHTESTC_MSGEMETRIC "Axis length is zero or negative within specified region" |
#define TWODMESHTESTC_ENORM 0 |
Definition at line 202 of file TwoDMeshTest.c.
#define TWODMESHTESTC_ESUB 1 |
Definition at line 203 of file TwoDMeshTest.c.
#define TWODMESHTESTC_EARG 2 |
Definition at line 204 of file TwoDMeshTest.c.
#define TWODMESHTESTC_EBAD 3 |
Definition at line 205 of file TwoDMeshTest.c.
#define TWODMESHTESTC_EMEM 4 |
Definition at line 206 of file TwoDMeshTest.c.
#define TWODMESHTESTC_EFILE 5 |
Definition at line 207 of file TwoDMeshTest.c.
#define TWODMESHTESTC_EMETRIC 6 |
Definition at line 208 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGENORM "Normal exit" |
Definition at line 210 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGESUB "Subroutine failed" |
Definition at line 211 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGEARG "Error parsing arguments" |
Definition at line 212 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGEBAD "Bad argument value" |
Definition at line 213 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGEMEM "Memory allocation error" |
Definition at line 214 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGEFILE "Could not open file" |
Definition at line 215 of file TwoDMeshTest.c.
#define TWODMESHTESTC_MSGEMETRIC "Axis length is zero or negative within specified region" |
Definition at line 216 of file TwoDMeshTest.c.