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

extract/lib/proc_max.c File Reference

Misc. procedures used by find_max. More...

Go to the source code of this file.

Defines

#define x(i)   (line.maxima[i].xcoord)

Functions

int search_extrema (double line[], int npts, int imin[], double fmin[], int imax[], double fmax[], int *nlmin)
 Look for extrema (one minimum + one maximum) in current line.

int search_pack (double line[], int *curpeak, int imax[], int nmax, double threshold, int *packpb, int *packpe)
 Look for next pack of peak in current line.

int locate_peak (max_lines line, double x)
 Locate a peak in a sorted max line from its position.

int find_nearest_peak (Maxima_Set *maxset, int iline, float x)
 Find nearest peak in a given line of a maxima set.

int find_nearest_max (Maxima_Set *maxset, float x, float y, int *iline, int *ipeak)
 Find nearest line and peak in the maxima set.

int open_max (char *maxname, Maxima_Set *maxset)
 Open a max file.

int pup_get_maxdata (Maxima_Set *maxset, float xpup, float ypup, float lbdapup, SnifsOptics *optics, float pixsize, double lstep, double *lbda[], double *dx[], double *sigma[])
 Associate lens number and max data.


Detailed Description

Misc. procedures used by find_max.

Copyright:
(c) 2003 CRAL-Observatoire de Lyon
Date:
Fri Mar 19 16:01:43 2004
Author:
Yannick Copin <y.copin@ipnl.in2p3.fr>

Author
ycopin
Version:
Revision
1.16
Id
proc_max.c,v 1.16 2005/04/20 16:08:02 ycopin Exp

Definition in file proc_max.c.


Define Documentation

#define x  )     (line.maxima[i].xcoord)
 

Referenced by find_nearest_max(), find_nearest_peak(), Fit_polynom2(), Fit_Xpeak(), geoPSF(), globalPSF(), grating_backward(), grating_forward(), grism_backward(), grism_forward(), inside_plot_limits(), invert_camcoll(), locate_peak(), locate_sorted(), main(), mean_sig_f(), median_f(), minmax(), minmax_f(), nllsqfit_gaussian(), nllsqfit_localPSF(), nllsqfit_localPSFn(), nllsqfit_lorentz(), nllsqfit_mpupgeo(), nllsqfit_NNgaussian(), nllsqfit_quad(), plot_array_err(), plot_max(), plot_set_limits(), RD_frame_interp(), read_spectra_refcoord(), refraction(), rotate_coord(), rotation_2D(), save_mpupgeo_par(), snifs_optics_backward(), snifs_optics_forward(), snifs_optics_test_forward(), and xdisp_profile().


Function Documentation

int search_extrema double  line[],
int  npts,
int  imin[],
double  fmin[],
int  imax[],
double  fmax[],
int *  nlmin
 

Look for extrema (one minimum + one maximum) in current line.

Parameters:
line Current line
npts Nb of points in current line
imin Minima indices
fmin Minima fluxes
imax Maxima indices
fmax Maxima fluxes
nlmin Nb of minima found
Returns:
Nb of maxima found
Warning:
imin and imax contain the extrema indices, not the coord.

Definition at line 38 of file proc_max.c.

Referenced by main().

int search_pack double  line[],
int *  curpeak,
int  imax[],
int  nmax,
double  threshold,
int *  packpb,
int *  packpe
 

Look for next pack of peak in current line.

Parameters:
line Current line
curpeak Current peak (will be updated)
imax Maxima indices
nmax Nb of maxima in current line
threshold 
packpb Index of 1st peak in pack
packpe Index of last peak in pack
Returns:
nb of peaks in current pack (0 if no more pack)

Definition at line 85 of file proc_max.c.

References FMX_TOOFAR, and SNIFS_INTERSP.

Referenced by main().

int locate_peak max_lines  line,
double  x
 

Locate a peak in a sorted max line from its position.

Parameters:
line Input max line (monotingly sorted, assumed non-empty)
x Target value
Returns:
Index i (in -1,nb_max-1) such that line.maxima[i].xcoord <= x < ...[i+1]
Note:
Log_2(n) algorithm adapted from locate_sorted
Warning:
In some case, the xcoord of the max line are not strictly increasing!

Definition at line 125 of file proc_max.c.

References x.

Referenced by find_nearest_peak().

int find_nearest_peak Maxima_Set *  maxset,
int  iline,
float  x
 

Find nearest peak in a given line of a maxima set.

Parameters:
maxset Input maxima set
iline Input line
x Input coordinate
Returns:
Peak index (in 0..n-1)
Note:
Input line is supposed to have a peak, i.e. maxset->line[iline].nb_max > 0

Definition at line 159 of file proc_max.c.

References locate_peak(), and x.

Referenced by find_nearest_max().

Here is the call graph for this function:

int find_nearest_max Maxima_Set *  maxset,
float  x,
float  y,
int *  iline,
int *  ipeak
 

Find nearest line and peak in the maxima set.

Parameters:
maxset Input maxima set
x 
y Input coordinates
iline 
ipeak Nearest max. point is maxset->line[iline].maxima[ipeak]
Returns:
Status OK || UNKNOWN

Definition at line 191 of file proc_max.c.

References find_nearest_peak(), and x.

Referenced by nllsqfit_mask(), and pup_get_maxdata().

Here is the call graph for this function:

int open_max char *  maxname,
Maxima_Set *  maxset
 

Open a max file.

Parameters:
maxname Name of the max file
maxset Max structure
Returns:
Error status

Definition at line 222 of file proc_max.c.

Referenced by main().

int pup_get_maxdata Maxima_Set *  maxset,
float  xpup,
float  ypup,
float  lbdapup,
SnifsOptics optics,
float  pixsize,
double  lstep,
double *  lbda[],
double *  dx[],
double *  sigma[]
 

Associate lens number and max data.

Parameters:
maxset Input maxima set
xpup 
ypup Mpup coordinates [px]
lbdapup Mpup ref. wavelength [AA]
optics Snifs optics
pixsize Pixel size [mm]
lstep Lambda step (from optics->filter.inf_util to optics->filter.sup_util)
lbda Lambda where max positions have been found (array to be freed)
dx Corresponding offset (max - computed position) (array to be freed)
sigma Corresponding max local PSF sigma (array to be freed)
Returns:
Number of max points associated to that lens
Warning:
This is a tricky task to make the association between the lenses and the max quantities... Some ad-hoc criteria on maximal distance to max position and/or X-disp. sigma are applied (see e.g. MAX_XDISPSIG_B).

Definition at line 262 of file proc_max.c.

References BLUE_CHANNEL, SnifsOptics::channel, SnifsOptics::filter, find_nearest_max(), MAX_XDISPSIG_B, MAX_XDISPSIG_R, MIN_XDISPSIG_B, MIN_XDISPSIG_R, SNIFS_INTERSP, snifs_optics_CCD2MLA(), and snifs_optics_MLA2CCD().

Referenced by main().

Here is the call graph for this function:


Generated on Thu Oct 27 00:00:06 2005 for Snifs by doxygen 1.3.5