Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

extract/lib/proc_corr.c File Reference

Procedures for correlation of arc rasters and peak fitting. More...

Go to the source code of this file.

Defines

#define DBG_PREFIX   "dbg_corr"
#define TOO_CLOSE   0.1

Functions

int extract_arc (const IMAGE2D *frame, int npix, double **tab)
 Extract central part of arc exposure.

void negate_2D (double **I, int nx, int ny)
 Negate a nx*ny 2D array.

void complex_product_2D (double **AR, double **AI, double **BR, double **BI, int nx, int ny, double **CR, double **CI)
 Compute the complex product C = A * B for nx*ny 2D arrays.

int FFT2D_real (double **in, int nx, int ny, double **outR, double **outI)
 FFT of a nx*ny 2D real dataset.

int iFFT2D_real (double **inR, double **inI, int nx, int ny, double **outR)
 Inverse FFT (real part) of a nx*ny 2D dataset.

int correlation2D (double **A, double **B, int nx, int ny, double **X)
 Compute correlation of nx*ny 2D arrays A and B.

long nllsqfit_2Dgauss (long *mode, long *npts, long *npar, long *ldfj, double *par, double *f, double *fjac, long *nstate, long *iuser, double *user)
int Fit_Xpeak (double **ref_tab, double **cur_tab, int nx, int ny, int winx, int winy, double par[6], double epar[6])


Detailed Description

Procedures for correlation of arc rasters and peak fitting.

Copyright:
(c) 2003 CRAL-Observatoire de Lyon
Date:
Date
2004/09/03 16:08:56
Author:
Yannick Copin <y.copin@ipnl.in2p3.fr>

Author
ycopin
Version:
Revision
1.8
Id
proc_corr.c,v 1.8 2004/09/03 16:08:56 ycopin Exp

Definition in file proc_corr.c.


Define Documentation

#define DBG_PREFIX   "dbg_corr"
 

Prefix for debug files

Definition at line 22 of file proc_corr.c.

Referenced by extract_arc(), Fit_Xpeak(), and main().

#define TOO_CLOSE   0.1
 

Warning distance to boundaries

Definition at line 25 of file proc_corr.c.

Referenced by Fit_Xpeak().


Function Documentation

int extract_arc const IMAGE2D *  frame,
int  npix,
double **  tab
 

Extract central part of arc exposure.

Parameters:
frame Input arc frame
npix Size of the central part
tab Output central part (npix x npix allocated 2D-array)
Returns:
Error status

Definition at line 38 of file proc_corr.c.

References DBG_PREFIX, and dump_2Darray().

Referenced by comp_calibration_offsets(), and main().

void negate_2D double **  I,
int  nx,
int  ny
 

Negate a nx*ny 2D array.

Note:
Replace the NAG routine C06GCF

Definition at line 88 of file proc_corr.c.

Referenced by correlation2D(), and iFFT2D_real().

void complex_product_2D double **  AR,
double **  AI,
double **  BR,
double **  BI,
int  nx,
int  ny,
double **  CR,
double **  CI
 

Compute the complex product C = A * B for nx*ny 2D arrays.

Parameters:
AR Real part of A
AI Imaginary part of A
BR Real part of B
BI Imaginary part of B
nx 
ny Size of the input arrays
CR Real part of C (allocated nx*ny 2D array)
CI Imaginary part of C (allocated nx*ny 2D array)

Definition at line 112 of file proc_corr.c.

Referenced by correlation2D().

int FFT2D_real double **  in,
int  nx,
int  ny,
double **  outR,
double **  outI
 

FFT of a nx*ny 2D real dataset.

Parameters:
in Input real dataset
nx 
ny Size of the input dataset
outR Real part of FFT (allocated nx*ny 2D array)
outI Imaginary part of FFT (allocated nx*ny 2D array)
Returns:
Error status (from C06FUF)
Warning:
Uses NAG routine C06FUF.

Definition at line 141 of file proc_corr.c.

Referenced by correlation2D().

int iFFT2D_real double **  inR,
double **  inI,
int  nx,
int  ny,
double **  outR
 

Inverse FFT (real part) of a nx*ny 2D dataset.

Parameters:
inR 
inI Input complex dataset (inI is returned negated)
nx 
ny Size of the input dataset
outR Real part of iFFT (allocated nx*ny 2D array)
Returns:
Error status (from C06FUF)
Warning:
Uses NAG routine C06FUF.

Definition at line 193 of file proc_corr.c.

References negate_2D().

Referenced by correlation2D().

int correlation2D double **  A,
double **  B,
int  nx,
int  ny,
double **  X
 

Compute correlation of nx*ny 2D arrays A and B.

Parameters:
A Input array (reference)
B Input array
nx 
ny Size of the input arrays
X Correlation (allocated nx*ny 2D array)
Returns:
Error status

Definition at line 251 of file proc_corr.c.

References complex_product_2D(), FFT2D_real(), iFFT2D_real(), and negate_2D().

Referenced by Fit_Xpeak().

long nllsqfit_2Dgauss long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double *  par,
double *  f,
double *  fjac,
long *  nstate,
long *  iuser,
double *  user
 

Single 2D-gaussian fitting procedure (e.g. for the cross-correlation peak). Parameters to be adjusted: position offset (x,y), intensity, dispersion (Sx,Sy) and background level.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Previously known as nllsqfit_Xpeak.

This routine uses a 2D-array oriented array ordering (j is the fastes index). A very similar routine nllsqfit_2DgaussB included in center_gauss::c has an image-oriented array ordering (i is then the fastest index).

Warning:
Not very generic routine. It needs a "dirty trick" on input parameters to pass 2D-sizes to . See Fit_Xpeak for example.

Definition at line 302 of file proc_corr.c.

Referenced by Fit_Xpeak().

int Fit_Xpeak double **  ref_tab,
double **  cur_tab,
int  nx,
int  ny,
int  winx,
int  winy,
double  par[6],
double  epar[6]
 

Compute correlation between 2 arc rasters and fit a 2D-gaussian to the central peak (6 parameters: position offset (x,y), intensity, dispersion (Sx,Sy) and background level), in order to measure relative offsets or focus-quality.

Parameters:
ref_tab Reference 2D-array
cur_tab Input 2D-array (could be a copy of ref. for auto-correlation)
nx 
ny Input arrays size
winx 
winy Fitting window half-width (be sure to fit in input arrays)
par Adjusted parameters
epar Error on adjusted parameters
Returns:
Error status

Definition at line 362 of file proc_corr.c.

References correlation2D(), DBG_PREFIX, dump_2Darray(), nllsqfit_2Dgauss(), and TOO_CLOSE.

Referenced by comp_calibration_offsets(), and main().


Generated on Tue Nov 23 18:04:21 2004 for Snifs by doxygen 1.3.3