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

incl/libsnifs.h File Reference

Project-wide function prototyping and define. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void banner_snifs (void)
 Goodbye banner, to be called by atexit.

void init_snifs (char *cvsname, char *cvsversion)
 Snifs-specific initialisation.

float read_exptime (void *anyfile)
 Read exposure time descriptor (defaulted to -1) from open file.

float read_airmass (void *anyfile)
 Read AIRMASS descriptor (defaulted to -1) from open file.

float check_airmass (char *arcname, float cal_airmass, char *objname, float obj_airmass)
 Check airmass consistency between two exposures.

long RD_2col (TABLE *table, int col1, double *data1, int col2, double *data2)
 Read two identified columns from an open table.

int read_2columns (char *tablename, char *col1name, char *col2name, int fclass, double **array1, double **array2)
 Read two real columns from a table.

int read_fluxref_table (char *tablename, char *lbdacolname, char *fluxcolname, double **lbda, double **flux, char *flxunits, char *rescolname, double **specres)
 Read reference flux table.

int read_lbdaref_table (char *tablename, char *lbdaname, char *flagname, float **lbda, float lbda_inf, float lbda_sup)
 Read selected reference wavelengthes from a Reference wavelength table.

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 (const int idx[], int n)
 Compute the rank, i.e. invert the sorting index.

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

void filter_med_array (float array[], int npts, int radius, float f_array[])
 Median filter on float array.


Detailed Description

Project-wide function prototyping and define.

Copyright:
(c) 2004 IPNL
Date:
Date
2005/10/05 22:44:29
Author:
Yannick Copin <y.copin@ipnl.in2p3.fr>

Author
ycopin
Version:
Revision
1.9
Id
libsnifs.h,v 1.9 2005/10/05 22:44:29 ycopin Exp

Definition in file libsnifs.h.


Function Documentation

void banner_snifs void   ) 
 

Goodbye banner, to be called by atexit.

Definition at line 29 of file misc.c.

Referenced by init_snifs().

void init_snifs char *  cvsname,
char *  cvsversion
 

Snifs-specific initialisation.

Parameters:
cvsname CVS-name (in the standard form "$Name: $")
cvsversion CVS-revision (in the standard form "$Revision: 1.8 $")
The init_snifs will call set_version with properly parsed CVS-strings. It should be called just before the standard init_session.

Definition at line 53 of file misc.c.

References banner_snifs().

Referenced by main().

Here is the call graph for this function:

float read_exptime void *  anyfile  ) 
 

Read exposure time descriptor (defaulted to -1) from open file.

Deprecated:
The spectrographic channel exposure time keyword EXPTIME is 10s too long wrt. real exposure time (as can be read from photometric channel). We therefore use the keyword EFFTIME which has to be correct.

Definition at line 93 of file misc.c.

References EFFTIME.

Referenced by main().

float read_airmass void *  anyfile  ) 
 

Read AIRMASS descriptor (defaulted to -1) from open file.

Definition at line 122 of file misc.c.

References AIRMASS.

Referenced by comp_calibration_offsets(), and main().

float check_airmass char *  arcname,
float  cal_airmass,
char *  objname,
float  obj_airmass
 

Check airmass consistency between two exposures.

Parameters:
arcname Arc name
cal_airmass Arc airmass (<0 if unset)
objname Object name
obj_airmass Object airmass (<0 if unset)
Returns:
Zenithal distance (or -1 if cannot be computed)

Definition at line 152 of file misc.c.

Referenced by main().

long RD_2col TABLE *  table,
int  col1,
double *  data1,
int  col2,
double *  data2
 

Read two identified columns from an open table.

Routine used to read the contents of two identified columns (which can contain either DOUBLE or FLOAT data) and to store them into two DOUBLE arrays.

Parameters:
table Input table (previously open)
col1 First column index
data1 First storage array (previously allocated to table.row)
col2 Second column index (or 0 if none)
data2 Second storage array (previously allocated to table.row)
Returns:
Effective number of lines read or error status.

Definition at line 101 of file external.c.

Referenced by read_2columns(), and read_fluxref_table().

int read_2columns char *  tablename,
char *  col1name,
char *  col2name,
int  fclass,
double **  array1,
double **  array2
 

Read two real columns from a table.

The routine open the table, check its fclass if needed, read the two named columns, store the result in internally allocated DOUBLE arrays (to be freed latter), and close the table.

Parameters:
tablename Input table
col1name First column name
col2name Second column name
fclass Fclass to be tested (if >0)
array1 Pointer to the array for the first column (to be freed)
array2 Pointer to the array for the second column (to be freed)
Returns:
Number of points in data arrays or error status

Todo:
Could be generalized to any number of columns if needed.

Definition at line 170 of file external.c.

References RD_2col().

Referenced by main().

Here is the call graph for this function:

int read_fluxref_table char *  tablename,
char *  lbdacolname,
char *  fluxcolname,
double **  lbda,
double **  flux,
char *  flxunits,
char *  rescolname,
double **  specres
 

Read reference flux table.

The routine open the reference flux table, check fclass=TBL_FLUX_REF, apply selection if any, read the two named columns (typically LAMBDA and FLUX), store the result in internally allocated DOUBLE arrays (to be freed latter), and close the table.

Parameters:
tablename Input table
lbdacolname Wavelength column name
fluxcolname Flux column name
lbda Pointer to the wavelength array (locally allocated, to be freed)
flux Pointer to the reference flux array (locally allocated, to be freed)
flxunits Flux units (string of length lg_units+1 previously allocated)
rescolname Spectral resolution column name (or NULL)
specres Pointer to the spectral resolution array (or NULL) (locally allocated, to be freed)
Returns:
Number of points in output arrays (<0 if error)
Note:
See Reference flux table description for column formats.

Definition at line 238 of file external.c.

References FLXUNITS, and RD_2col().

Referenced by main().

Here is the call graph for this function:

int read_lbdaref_table char *  tablename,
char *  lbdaname,
char *  flagname,
float **  lbda,
float  lbda_inf,
float  lbda_sup
 

Read selected reference wavelengthes from a Reference wavelength table.

The routine open the wavelength reference table, apply selection if any, read the two named columns (typically LAMBDA and MASK or CALIB), store the result in internally allocated FLOAT array (to be freed latter), and close the table.

Parameters:
tablename Input table name
lbdaname Wavelength column name
flagname Flag column name
lbda Pointer to the output wavelength array (locally allocated)
lbda_inf Minimal wavelength
lbda_sup Maximal wavelength
Returns:
Number of lines selected (<0 if error)
Note:
See Reference wavelength table description for column formats.

Definition at line 343 of file external.c.

Referenced by main().

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 41 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 100 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 169 of file stats.c.

References array_histo().

Referenced by frame_histo(), and plot_set_bkgnd().

Here is the call graph for this function:

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 208 of file stats.c.

References subframe_histo().

Referenced by main().

Here is the call graph for this function:

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 230 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 263 of file stats.c.

References x.

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 294 of file stats.c.

References x.

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 325 of file stats.c.

References x.

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 351 of file stats.c.

References x.

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 375 of file stats.c.

References x.

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 407 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 makes its internal computations in float, which is unsufficient.

Definition at line 452 of file stats.c.

References x.

Referenced by main().

void filter_med_array float  array[],
int  npts,
int  radius,
float  f_array[]
 

Median filter on float array.

Parameters:
array Input array
npts Size of input array
radius Half-width of filtering window
f_array Output median-filtered array

Definition at line 584 of file stats.c.

Referenced by compute_mean_spec().


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