Utility for Physical Model

Functions

int uves_physmod_stacen (float *p_img, int dimx, int dimy, char meth, int *image, float *xout, float *yout, float *xerr, float *yerr, float *xsig, float *ysig, float *xyval, int *stat)
 Routines used to do Gaussian fit to a line.
static int CGN_NINT (float a)
 finds absolute value of nearest integer
static int Ckapsig (float *val, int nval, int iter, float akap, float *cons, float *rms, int *npts)
 selects a constant mean through a kap*sig clipping
static int MATINV (double(*matrix)[MAXPAR], int nfree)
 calculate the inverse of a matrix
static double ERFCC (double xx)
 returns complementary error function EFC( xx )
static double GAUSFU (double xx, double *gpar)
static void GAUSDE (double xdat, double *gpar, double *deriv)
 evaluates derivatives of function for least squares search with shape of a gaussian distribution
static float FCHIS (double *data, int ndim, int nfree, int mode, double *dfit)
 evaluate reduced chi square for fit to data
static int LSQFIT (double *xdat, double *data, int ndim, double *gpar, float *lamda, double *dfit, double *chisqr, double *sigma)
 least squares fit to a non-linear function
static void Crhox (float *p_img, int *npix, int *image, int *lnew, double *krx)
 compute X-marginal vector KRX.
static void Crhoy (float *p_img, int *npix, int *image, int *lnew, double *kry)
 compute Y-marginal vector KRY.
static int Cserch (double *marg, int ndim, int ign, int *lmin, int *lmax, float *s_cent, float *s_width)
 search a star from a marginal distribution
int uves_physmod_cstacen (char meth, float *p_img, int *npix, int *image, float *xypos, float *xyerr, float *xysig, float *xyval)
 Routines used to do Gaussian fit to a line.

Detailed Description

This module contains functionalities to do a Gaussian fit along X,Y to a line (equivalent of MIDAS cstacen.c)


Function Documentation

int uves_physmod_stacen ( float *  p_img,
int  dimx,
int  dimy,
char  meth,
int *  image,
float *  xout,
float *  yout,
float *  xerr,
float *  yerr,
float *  xsig,
float *  ysig,
float *  xyval,
int *  stat 
)

Routines used to do Gaussian fit to a line.

Parameters:
p_img : input pointer to image
dimx : input image's x dimension
dimy : input image's y dimension
meth : input method of centering: MOM (moment centering) GAU (gaussian centering)
image : input image mapping array
xout : ouput center position x (C indexing)
yout : ouput center position x (C indexing)
xerr : ouput error estimate of xout
yerr : ouput error estimate of yout
xsig : output width of source on x
ysig : output width of source on x
xyval : output central value
stat : return status
Returns:
0 if everything is ok, 1 if crowded, or weak source 2 if no pos. source found 3 if iteration failed

This module contains the following statistic functions:

  • for the moment centering: Ckapsig
  • for the gaussian centering: - Crhox
    • Crhoy
    • Cserch
    • LSQFIT
      • <- GAUSDE <- GAUSFU <- ERFCC
      • <- MATINV
      • <- GAUSFU <- ERFCC
      • <- FCHIS

Performs a Gaussian fit of the intensity distribution obtained by collapsing along X or Y an image within a box.

Definition at line 191 of file uves_physmod_cstacen.c.

References uves_physmod_cstacen().

Referenced by uves_physmod_center_gauss().

static int CGN_NINT ( float  a  )  [static]

finds absolute value of nearest integer

Parameters:
a value to convert

Definition at line 235 of file uves_physmod_cstacen.c.

Referenced by Cserch(), and uves_physmod_cstacen().

static int Ckapsig ( float *  val,
int  nval,
int  iter,
float  akap,
float *  cons,
float *  rms,
int *  npts 
) [static]

selects a constant mean through a kap*sig clipping

Parameters:
val : input values
nval : number of input values
iter : number of iterations (min = 1)
akap : input AKAP * RMS

output:

Parameters:
cons : output derived mean value
rms : output RMS of mean value
npts : output number of points used to derive the mean value
Returns:
status : 0 O.K. : -1 NVAL .LT. 2

Selects a constant mean through a kap*sig clipping:

  • 1.) calculate mean and rms
  • 2.) delete pixels beyond AKAP*RMS from mean
  • 3.) GO TO 1.)

Definition at line 272 of file uves_physmod_cstacen.c.

Referenced by uves_physmod_cstacen().

static int MATINV ( double(*)  matrix[MAXPAR],
int  nfree 
) [static]

calculate the inverse of a matrix

input:

Parameters:
(*matrix) : input matrix to be inverted
nfree : input number of free parameters
Returns:
error status 0 = ok 1 = determinant is zero

The algorithm used is the Gauss-Jordan algorithm described in Stoer, Numerische matematik, 1 Teil.

Definition at line 376 of file uves_physmod_cstacen.c.

Referenced by LSQFIT().

static double ERFCC ( double  xx  )  [static]

returns complementary error function EFC( xx )

Parameters:
xx : input parameter of error function
Returns:
complementary error function EFC( xx )

Factional error everywhere less than 1.2e-7

Definition at line 476 of file uves_physmod_cstacen.c.

Referenced by GAUSFU().

static double GAUSFU ( double  xx,
double *  gpar 
) [static]
Parameters:
xx : input data point of independent variable
gpar : function parameters
Returns:

Definition at line 536 of file uves_physmod_cstacen.c.

References ERFCC().

Referenced by GAUSDE(), and LSQFIT().

static void GAUSDE ( double  xdat,
double *  gpar,
double *  deriv 
) [static]

evaluates derivatives of function for least squares search with shape of a gaussian distribution

Parameters:
xdat : input data point of independent variable
gpar : input parameters of the gaussian distribution
deriv : output derivatives of function
Returns:

Definition at line 574 of file uves_physmod_cstacen.c.

References GAUSFU().

Referenced by LSQFIT().

static float FCHIS ( double *  data,
int  ndim,
int  nfree,
int  mode,
double *  dfit 
) [static]

evaluate reduced chi square for fit to data

Parameters:
data : input data
ndim : dimension of input data
nfree : number of degrees of freedom
mode : determines method of weighting the least-squares fit:

  • 0 = no weighting
  • 1 = with weighting
dfit : output array with the fit for data
Returns:
sum( (y-yfit)**2 / sigma**2 ) / nfree

Definition at line 648 of file uves_physmod_cstacen.c.

Referenced by LSQFIT().

static int LSQFIT ( double *  xdat,
double *  data,
int  ndim,
double *  gpar,
float *  lamda,
double *  dfit,
double *  chisqr,
double *  sigma 
) [static]

least squares fit to a non-linear function

Parameters:
xdat : input array of data points ind. var.
data : input array of data points dep. var.
ndim : input dimension of xdat and data
gpar : in/out function parameters:

  • gpar[0] = data max
  • gpar[1] = position of data max
  • gpar[2] = width of the source
  • gpar[3] = center of window
lamda : in/out proportion of gradient search included
dfit : output array with the fit for data
chisqr,: output reduced chi square for fit
sigma : the probable uncertainty (output)
Returns:
0 (= ok), 1 (= no convertion)

Note: set LAMDA to 0.001 at the beginning of the search

Definition at line 714 of file uves_physmod_cstacen.c.

References FCHIS(), GAUSDE(), GAUSFU(), and MATINV().

Referenced by uves_physmod_cstacen().

static void Crhox ( float *  p_img,
int *  npix,
int *  image,
int *  lnew,
double *  krx 
) [static]

compute X-marginal vector KRX.

Parameters:
p_img : input pointer to 2-D image
npix : input dimension of image
image : (input) contains in pixel units in C notation (0 ...)
lnew : input Y lower/upper limits to the marginal in C notation (0 ...)
krx : output X-marginal vector
Returns:
nothing

For the algorithm description see Stetson, P.B., 1979 Astron. J., 84 1149.

Definition at line 852 of file uves_physmod_cstacen.c.

Referenced by uves_physmod_cstacen().

static void Crhoy ( float *  p_img,
int *  npix,
int *  image,
int *  lnew,
double *  kry 
) [static]

compute Y-marginal vector KRY.

Parameters:
p_img : input pointer to 2-D image
npix : input dimension of image
image : (input) contains in pixel units in C notation (0 ...)
lnew : input Y lower/upper limits to the marginal in C notation (0 ...)
kry : output X-marginal vector
Returns:
nothing

For the algorithm description see Stetson, P.B., 1979 Astron. J., 84 1149.

Definition at line 924 of file uves_physmod_cstacen.c.

Referenced by uves_physmod_cstacen().

static int Cserch ( double *  marg,
int  ndim,
int  ign,
int *  lmin,
int *  lmax,
float *  s_cent,
float *  s_width 
) [static]

search a star from a marginal distribution

Parameters:
marg : input marginal data
ndim : input dimension of MARG
ign : input number of points ignored at each end of KRX ( greater or equal 2)
lmin : output low-side local minimum (in pixels)
lmax : output high-side local minimum (in pixels)
s_cent : output output estimate of the object centre
s_width,: output output estimate of the object width
Returns:
  • 0 if no other star is detected in the field
  • -1 if a brighter star is found on the low side
  • +1 if a brighter star is found on the high side

For the algorithm description see Stetson, P.B., 1979 Astron. J., 84 1149.

Definition at line 997 of file uves_physmod_cstacen.c.

References CGN_NINT().

Referenced by uves_physmod_cstacen().

int uves_physmod_cstacen ( char  meth,
float *  p_img,
int *  npix,
int *  image,
float *  xypos,
float *  xyerr,
float *  xysig,
float *  xyval 
)

Routines used to do Gaussian fit to a line.

Parameters:
meth : input method of centering: MOM (moment centering) GAU (gaussian centering)
p_img : input pointer to image
npix : input number of pixels in image
image : input image size in pixel coordinates (F77 indexing)
xypos : output center position (x,y) (C indexing)
xyerr : output error estimate of xypos (x,y)
xysig : output width of source (x,y)
xyval : output central value
Returns:
  • 0 if everything is ok,
  • 1 if crowded, or weak source
  • 2 if no pos. source found
  • 3 if iteration failed

This module contains the following statistic functions:

  • for the moment centering: Ckapsig
  • for the gaussian centering:
    • Crhox
    • Crhoy
    • Cserch
      • LSQFIT
        • <- GAUSDE <- GAUSFU <- ERFCC
        • <- MATINV
        • <- GAUSFU <- ERFCC
        • <- FCHIS

Performs a Gaussian fit of the intensity distribution obtained by collapsing along X or Y an image within a box.

Definition at line 1211 of file uves_physmod_cstacen.c.

References CGN_NINT(), Ckapsig(), Crhox(), Crhoy(), Cserch(), and LSQFIT().

Referenced by uves_physmod_stacen().


Generated on 8 Mar 2011 for UVES Pipeline Reference Manual by  doxygen 1.6.1