routines to determine the absolute positions

sinfo_new_hat2

calculates the value of a hat function with parameters parlist at the position xdat

Parameters:
xdat position array
parlist parameter list
Returns:
function value of a linear hat function.
Note:
-The parameter list values are:
  1. parlist(0): pos1
  2. parlist(1): pos2
  3. parlist(2): pos3
  4. parlist(3): pos4
  5. parlist(4): background left
  6. parlist(5): background right
  7. parlist(6): intensity left
  8. parlist(7): intensity right This function returns a function with a constant background value for xdat values smaller than pos1, linear increasing between pos1 and pos2, linear between pos2 and pos3, linear decreasing between pos3 and pos4, and constant background value for xdat values greater than pos4.


float sinfo_new_hat2 (float *xdat, float *parlist)

sinfo_new_hat1

calculates the value of a hat function with parameters parlist at the position xdat

Parameters:
xdat position array
parlist parameter list
Returns:
function value of a linear hat function.
Note:
-The parameter list values are:
  1. parlist(0): pos1
  2. parlist(1): pos2
  3. parlist(2): pos3
  4. parlist(3): pos4
  5. parlist(4): background left
  6. parlist(5): background right
  7. parlist(6): intensity left
  8. parlist(7): intensity right

This function returns a function with a constant background value for xdat values smaller than pos1, linear increasing between pos1 and pos1+slopewidth, constant value intensity between pos1+slopewidth and pos2-slopewidth, linear decreasing between pos2-slopewidth and pos2, and constant background value for xdat values greater than pos2.



float sinfo_new_hat1 (float *xdat, float *parlist)

sinfo_new_hat_deriv2

calculates the partial derivatives for a hat function with parameters parlist at position xdat

Parameters:
xdat position array
parlist parameter list
dervs parameter derivatives (accuracies) list
Returns:
nothing (void)
Note:
-The parameter list values are: parlist
  1. parlist[0]: pos1
  2. parlist[1]: pos2
  3. parlist[3]: pos3
  4. parlist[4]: pos4
  5. parlist[5]: background left
  6. parlist[6]: background right
  7. parlist[7]: intensity left
  8. parlist[8]: intensity right -The derivative values of a hat function at position xdat: dervs
  9. dervs[0]: partial derivative by pos1
  10. dervs[1]: partial derivative by pos2
  11. dervs[3]: partial derivative by pos3
  12. dervs[4]: partial derivative by pos4
  13. dervs[5]: partial derivative by background left
  14. dervs[6]: partial derivative by background right
  15. dervs[7]: partial derivative by intensity left
  16. dervs[8]: partial derivative by intensity right


void sinfo_new_hat_deriv2 (float *xdat, float *parlist, float *dervs)

sinfo_new_hat_deriv1

calculates the partial derivatives for a hat function with parameters parlist at position xdat

Parameters:
xdat position array
parlist parameter list
dervs parameter derivatives (accuracies) list
Returns:
nothing (void)
Note:
-The parameter list values are: parlist
  1. parlist[0]: pos1
  2. parlist[1]: pos2
  3. parlist[2]: background1
  4. parlist[3]: background2
  5. parlist[4]: intensity -The derivative values of a hat function at position xdat: dervs
  6. dervs[0]: partial derivative by pos1
  7. dervs[1]: partial derivative by pos2
  8. dervs[2]: partial derivative by background1
  9. dervs[3]: partial derivative by background2
  10. dervs[4]: partial derivative by intensity


void sinfo_new_hat_deriv1 (float *xdat, float *parlist, float *dervs)

sinfo_new_fit_slits1

fits the beginning and end position of the slitlets by using non-linear least square fitting of a hat function

Parameters:
lineImage emission line frame
par fit parameter data structure of fitted lines
sinfo_slit_pos allocated dummy array for the slitlet positions [32][2]
box_length pixel length of the row box within the fit is done
y_box small box in spectral direction within the slitlet may lie.
sinfo_slit_pos (out) beginning and end position of the slitlets to sub-pixel accuracy
Returns:
# 0 if it worked, # -1 if there was no line image given, # -2 if there were no line fit parameters given, # -3 if there was no dummy array for the slit positions allocated # -4 if the given box length is impossible # -5 if the given y box length is impossible # -6 if there were no emission lines found in the first image columns # -7 if not all slitlets could be found # -8 if the least squares fit failed


int sinfo_new_fit_slits1 (cpl_image *lineImage, FitParams **par, float **sinfo_slit_pos, int box_length, float y_box)

sinfo_new_fit_slits

fits the beginning and end position of the slitlets by using non-linear least square fitting of a hat function

Parameters:
lineImage emission line frame
par fit parameter data structure of fitted lines
sinfo_slit_pos allocated dummy array for the slitlet positions [32][2]
box_length pixel length of the row box within the fit is done
y_box small box in spectral direction within the slitlet may lie.
slope_width width of linear slope of the hat function, must be positive
sinfo_slit_pos beginning and end position of the slitlets to sub-pixel accuracy
Returns:
# 0 if it worked, # -1 if there was no line image given, # -2 if there were no line fit parameters given, # -3 if there was no dummy array for the slit positions # allocated # -4 if the given box length is impossible # -5 if the given y box length is impossible # -6 if the given width of the linear slope is wrong # -7 if there were no emission lines found in the first image columns # -8 if not all slitlets could be found # -9 if the least squares fit failed


int sinfo_new_fit_slits (cpl_image *lineImage, FitParams **par, float **sinfo_slit_pos, int box_length, float y_box, float slope_width)

sinfo_new_fit_slits2

fits the beginning and end position of the slitlets by using non-linear least square fitting of a step function fits a step function to the slitlet edges exposed and indicated by the brightest emission lines.

Parameters:
lineImage emission line frame
par fit parameter data structure of fitted lines
sinfo_slit_pos allocated dummy array for the slitlet positions [32][2]
box_length pixel length of the row box within the fit is done
y_box small box in spectral direction within the slitlet may lie.
diff_tol maximum tolerable difference of the resulting fit position with respect to the expected position. If difference is greater the expected position is taken.
sinfo_slit_pos beginning and end position of the slitlets to sub-pixel accuracy # 0 if it worked, # -1 if there was no line image given, # -2 if there were no line fit parameters given, # -3 if there was no dummy array for the slit positions # allocated # -4 if the given box length is impossible # -5 if the given y box length is impossible # -6 if the given difference tolerance is too small # -7 if there were no emission lines found in the first image columns # -8 if not all slitlets could be found

fits the beginning and end position of the slitlets by using non-linear least square fitting of a step function fits a step function to the slitlet edges exposed and indicated by the brightest emission lines. To achieve this, the fit parameters are used to find the brightest emission line and to get its position for each column. The least squares fit is done by using a box bigger than the size of one slitlet and divides the box into two parts for both edges within the fit function is shifted.



int sinfo_new_fit_slits2 (cpl_image *lineImage, FitParams **par, float **sinfo_slit_pos, int box_length, float y_box, float diff_tol)

sinfo_new_edge()

input: position array xdat, parameter list parlist, number of parameters in the list npar

Parameters:
ndat number of data elements The parameters are:
parlist(0) pos1
parlist(1) pos2
parlist(2) intensity left
parlist(3) intensity right
Returns:
function value of a linear slope function that means a function with a constant intensity value for xdat values smaller than pos1, linear increasing between pos1 and pos2, constant intensity value for xdat values greater than pos2 calculates the value of a slope function with parameters parlist at the position xdat


float sinfo_new_edge (float *xdat, float *parlist)

sinfo_new_edge_deriv()

calculates the partial derivatives for a slope function with parameters parlist at position xdat

Parameters:
xdat position array
parlist parameter list
dervs parameter derivatives (accuracies) list
Returns:
nothing (void)
Note:
-The parameter list values are: parlist
  1. parlist[0]: pos1
  2. parlist[1]: pos2
  3. parlist[2]: intensity left
  4. parlist[3]: intensity right -The derivative values of a hat function at position xdat: dervs
  5. dervs[0]: partial derivative by pos1
  6. dervs[1]: partial derivative by pos2
  7. dervs[2]: partial derivative by intensity left
  8. dervs[3]: partial derivative by intensity right


void sinfo_new_edge_deriv (float *xdat, float *parlist, float *dervs)

sinfo_new_lsqfit_edge

Least square fit of a function to a set of data points

Parameters:
xdat position, coordinates of data points. xdat is 2 dimensional: XDAT ( XDIM, NDAT )
xdim dimension of fit
ydat data points
wdat weights for data points
ndat number of data points
fpar on input contains initial estimates of the parameters for non-linear fits, on output the fitted parameters.
epar contains estimates of the errors in fitted parameters
mpar logical mask telling which parameters are free (non-zero) and which parameters are fixed (0)
npar number of function parameters ( free + fixed )
tol relative tolerance. sinfo_lsqfit_edge stops when successive iterations fail to produce a decrement in reduced chi-squared less than tol. If tol is less than the minimum tolerance possible, tol will be set to this value. This means that maximum accuracy can be obtained by setting tol = 0.0.
its maximum number of iterations
lab 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). lab can only be zero when the partial derivatives are independent of the parameters. In fact in this case lab should be exactly equal to zero.
Returns:
returns number of iterations needed to achieve convergence according to tol. When this number is negative, the fitting was not continued because a fatal error occurred: # -1 too many free parameters, maximum is 32 # -2 no free parameters # -3 not enough degrees of freedom # -4 maximum number of iterations too small to obtain a solution which satisfies tol. # -5 diagonal of sinfo_matrix contains elements which are zero # -6 determinant of the coefficient sinfo_matrix is zero # -7 square root of a negative number

this is a routine for making a least-squares fit of a function to a set of data points. The method used is described in: Marquardt, J.Soc.Ind.Appl.Math. 11. 431 (1963). This method is a mixture of the steepest descent method and the Taylor method.



int sinfo_new_lsqfit_edge (float *xdat, int *xdim, float *ydat, float *wdat, int *ndat, float *fpar, float *epar, int *mpar, int *npar, float *tol, int *its, float *lab)

sinfo_new_fit_slits_edge()

Parameters:
lineImage emission line frame
par fit parameter data structure of fitted lines
sinfo_slit_pos allocated dummy array for the slitlet positions [32][4]
box_length pixel length of the row box within the fit is done
y_box small box in spectral direction within the slitlet may lie.
diff_tol maximum tolerable difference of the resulting fit position with respect to the expected position. If difference is greater the expected position is taken.
Returns:
sinfo_slit_pos beginning and end position of the slitlets to sub-pixel accuracy # 0 if it worked, # -1 if there was no line image given, # -2 if there were no line fit parameters given, # -3 if there was no dummy array for the slit positions allocated # -4 if the given box length is impossible # -5 if the given y box length is impossible # -6 if the given difference tolerance is too small # -7 if there were no emission lines found in the first image columns # -8 if not all slitlets could be found fits the beginning and end position of the slitlets by using non-linear least square fitting of a hat function fits a step function to the slitlet edges exposed and indicated by the brightest emission lines. To achieve this, the fit parameters are used to find the brightest emission line and to get its position for each column. The least squares fit is done by using a box smaller than the size of two slitlets


int sinfo_new_fit_slits_edge (cpl_image *lineImage, FitParams **par, float **sinfo_slit_pos, int box_length, float y_box, float diff_tol)

sinfo_new_fit_slits_boltz_with_estimate()

Parameters:
lineImage emission line frame
sinfo_slit_pos estimation array for the slitlet positions [min32][2]
box_length pixel length of the row box within the fit is done
y_box small box in spectral direction within the slitlet may lie.
low_pos 
high_pos pixel positions in spectral direction between which the line should be located.
Returns:
sinfo_slit_pos beginning and end position of the slitlets to sub-pixel accuracy 0 if it worked, -1 if it failed, fits the beginning and end position of the slitlets by using non-linear least square fitting of a Boltzmann function fits a Boltzmann function to the slitlet edges exposed and indicated by the brightest emission lines. The slitlet is searched within user given positions. The least squares fit is done by using a box smaller than the size of two slitlets


int sinfo_new_fit_slits_edge_with_estimate (cpl_image *lineImage, float **sinfo_slit_pos, int box_length, float y_box, float diff_tol, int low_pos, int high_pos)

Detailed Description

of the slitlets out of an emission line frame


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