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

extract/lib/stats.c File Reference

Go to the source code of this file.

Functions

void frame_stats (const IMAGE2D *frame, double *mean, double *sigma, double *median, double *sigmed)
 Statistic elements of a frame.

SPECTRUM * array_histo (const double *array, int npts, double min, double max, int nbin)
 Histogram of a (double) vector.

SPECTRUM * subframe_histo (const IMAGE2D *frame, int imin, int imax, int jmin, int jmax, double min, double max, int nbin)
 Histogram of a subframe.

SPECTRUM * frame_histo (const IMAGE2D *frame, double min, double max, int nbin)
 Histogram of a frame.

double histo_threshold (const SPECTRUM *histospec, float frac)
 Invert an histogram.

float median_f (const float x[], int n)
 Float wrapper to statistic (double) function "median".

double mean_sig_f (const float x[], int n, double *mean, double *sigma)
 Statistics (mean+sigma) on float array.

void minmax (const double x[], int n, double *min, double *max, int *imin, int *imax)
 Find the min and max (and associated index) in a double array.

void minmax_f (const float x[], int n, float *min, float *max, int *imin, int *imax)
 Find the min and max (and associated index) in a float array.

int locate_sorted (const double x[], int n, double x0)
 Locate a value in a sorted array.

void invert_indexx (int idx[], int n)
 Compute the rank, i.e. invert the sorting index.

int Fit_polynom2 (float *x, float *y, int npts, int input_deg, int *output_deg, float *coef, float *dy, float *chi2)
 Conversion to double of Fit_polynom.


Function Documentation

void frame_stats const IMAGE2D *  frame,
double *  mean,
double *  sigma,
double *  median,
double *  sigmed
 

Statistic elements of a frame.

Compute statistic elements (mean,dispersion and median, median dispersion if required) of frame. Median and median dispersion are computed if both pointers are non-NULL

Parameters:
frame Input frame
mean Arithmetic mean $\mu$
sigma Arithmetic dispersion $\sigma$: $\sigma^2 = \frac{n\sum p_{ij}^2 - (\sum p_{ij})^2}{n(n-1)}$
median Median $m$ (or NULL if not needed)
sigmed Median dispersion (i.e. median of $|p_{ij}-m|$) (or NULL if not needed)

Definition at line 38 of file stats.c.

Referenced by main().

SPECTRUM* array_histo const double *  array,
int  npts,
double  min,
double  max,
int  nbin
 

Histogram of a (double) vector.

Compute the histogram -- with ~nbin bins between min and max -- of a vector, and return it as a memory spectrum. If nbin>0, there is indeed nbin bins. If nbin<0, there are two extra outer bins for the values outside the range [min,max].

Parameters:
array input (double) vector
npts of size npts
min 
max min and max of the histogram range
nbin number of bins (can be negative, see description)
Returns:
pointer to the histogram memory spectrum

Definition at line 97 of file stats.c.

Referenced by main(), and subframe_histo().

SPECTRUM* subframe_histo const IMAGE2D *  frame,
int  imin,
int  imax,
int  jmin,
int  jmax,
double  min,
double  max,
int  nbin
 

Histogram of a subframe.

Compute the histogram -- with ~nbin bins between min and max -- of subframe [imin,jmin:imax,jmax], and return it as a memory spectrum (see array_histo).

Parameters:
frame input frame
imin 
imax 
jmin 
jmax subframe definition [px]
min 
max min and max of the histogram range
nbin number of bins (can be negative)
Returns:
pointer to the histogram memory spectrum
Warning:
There's no checking for validity of subframe.

Definition at line 166 of file stats.c.

References array_histo().

Referenced by frame_histo(), and plot_set_bkgnd().

SPECTRUM* frame_histo const IMAGE2D *  frame,
double  min,
double  max,
int  nbin
 

Histogram of a frame.

Compute the histogram -- with ~nbin bins between min and max -- of a frame, and return it as a memory spectrum (see array_histo).

Parameters:
frame input frame
min 
max min and max of the histogram range
nbin number of bins (can be negative)
Returns:
pointer to the histogram memory spectrum

Definition at line 205 of file stats.c.

References subframe_histo().

Referenced by main().

double histo_threshold const SPECTRUM *  histospec,
float  frac
 

Invert an histogram.

According to the histogram stored in the input spectrum, computes the threshold so that a given fraction of the population is below.

Parameters:
histospec input histogram spectrum, as computed from frame_histo
frac fraction of the population that should be below
Returns:
threshold

Definition at line 227 of file stats.c.

Referenced by main(), and plot_set_bkgnd().

float median_f const float  x[],
int  n
 

Float wrapper to statistic (double) function "median".

Parameters:
x float array
n nb of points
Returns:
(float)median

Definition at line 260 of file stats.c.

Referenced by main().

double mean_sig_f const float  x[],
int  n,
double *  mean,
double *  sigma
 

Statistics (mean+sigma) on float array.

Parameters:
x float array
n nb of points
mean arithmetic mean
sigma arithmetic dispersion (n-1)
Returns:
mean
Note:
Similar to gsl_stats_mean and gsl_stats_sd_m

Definition at line 291 of file stats.c.

Referenced by main().

void minmax const double  x[],
int  n,
double *  min,
double *  max,
int *  imin,
int *  imax
 

Find the min and max (and associated index) in a double array.

Parameters:
x input array
n size of input array
min minimum value of the input array
max maximum value of the input array
imin index of the minimum value
imax index of the maximum value
Note:
Similar to gsl_stats_minmax_index

Definition at line 322 of file stats.c.

Referenced by main().

void minmax_f const float  x[],
int  n,
float *  min,
float *  max,
int *  imin,
int *  imax
 

Find the min and max (and associated index) in a float array.

Parameters:
x input array
n size of input array
min minimum value of the input array
max maximum value of the input array
imin index of the minimum value
imax index of the maximum value
Note:
Similar to gsl_stats_minmax_index

Definition at line 348 of file stats.c.

Referenced by main(), and select_mpup_sharpest_smooth().

int locate_sorted const double  x[],
int  n,
double  x0
 

Locate a value in a sorted array.

Parameters:
x input array (monotonely sorted)
n input array length
x0 target value
Returns:
Index i (in -1,n-1) such that x[i] <= x0 < x[i+1]
Note:
Log_2(n) algorithm adapted from locate of NRC.

Definition at line 372 of file stats.c.

void invert_indexx int  idx[],
int  n
 

Compute the rank, i.e. invert the sorting index.

At input, idx has been computed (by e.g. indexx) according to an external array such as array[idx[i]] is in increasing order. At output, idx contains the rank of array[i], i.e. idx_new[idx_old[i]] = i.

Parameters:
idx Sorting/ranking index
n Size of the array

Definition at line 404 of file stats.c.

Referenced by main().

int Fit_polynom2 float *  x,
float *  y,
int  npts,
int  input_deg,
int *  output_deg,
float *  coef,
float *  dy,
float *  chi2
 

Conversion to double of Fit_polynom.

Routine Fit_polynom in IFU_C_mathlibs-6.1/C_libs/math/least_sq/misc_routines.c makes its internal computations in float, which is unsifficient.

Definition at line 449 of file stats.c.

Referenced by main().


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