VIRCAM Pipeline  2.3.12
Functions
casu_stats

These are support routines used for doing statistics on data arrays. More...

Functions

float casu_med (float *data, unsigned char *bpm, long npts)
 
double casu_dmed (double *data, unsigned char *bpm, long npts)
 
void casu_qmedsig (float *data, unsigned char *bpm, long npts, float thresh, int niter, float lowv, float highv, float *median, float *sigma)
 
void casu_medmad (float *data, unsigned char *bpm, long np, float *med, float *mad)
 
void casu_medmadcut (float *data, unsigned char *bpm, long np, float lcut, float hcut, float *med, float *mad)
 
float casu_mean (float *data, unsigned char *bpm, long npts)
 
double casu_dmean (double *data, unsigned char *bpm, long npts)
 
int casu_meansig (float *data, unsigned char *bpm, long npts, float *mean, float *sig)
 
void casu_medsig (float *data, unsigned char *bpm, long np, float *med, float *sig)
 
int casu_sumbpm (unsigned char *bpm, long npts, int *sumb)
 

Detailed Description

These are support routines used for doing statistics on data arrays.

Author
Jim Lewis, CASU, CASU

Function Documentation

◆ casu_dmean()

double casu_dmean ( double *  data,
unsigned char *  bpm,
long  npts 
)
Name:
casu_dmean
Purpose:
Find the mean of a double array with a possible bad pixel mask
Description:
If a bad pixel mask is not included a straight forward mean is performed on the input data array. If a bad pixel mask is included then the data good data are copied into a temporary array and then the mean is performed. This is a routine for double precision data.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
nptsNumber of pixels in the data
Return values
meanWhen all goes well
CX_MAXDOUBLEif all are flagged as bad
Author
Jim Lewis, CASU

Definition at line 534 of file casu_stats.c.

◆ casu_dmed()

double casu_dmed ( double *  data,
unsigned char *  bpm,
long  npts 
)
Name:
casu_dmed
Purpose:
Find the median of a double array with a possible bad pixel mask
Description:
If a bad pixel mask is not included a straight forward median is performed on the input data array. If a bad pixel mask is included then the data good data are copied into a temporary array and then the median is performed. This is a routine for double precision data.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
nptsNumber of pixels in the data
Return values
medianWhen all goes well
CX_MAXDOUBLEif all are flagged as bad
Author
Jim Lewis, CASU

Definition at line 170 of file casu_stats.c.

Referenced by casu_platesol(), and casu_platexy().

◆ casu_mean()

float casu_mean ( float *  data,
unsigned char *  bpm,
long  npts 
)
Name:
casu_mean
Purpose:
Find the mean of a float array with a possible bad pixel mask
Description:
If a bad pixel mask is not included a straight forward mean is performed on the input data array. If a bad pixel mask is included then the data good data are copied into a temporary array and then the mean is performed. This is a routine for floating point data.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
nptsNumber of pixels in the data
Return values
meanWhen all goes well
CX_MAXFLOATif all are flagged as bad
Author
Jim Lewis, CASU

Definition at line 479 of file casu_stats.c.

Referenced by casu_mkconf().

◆ casu_meansig()

int casu_meansig ( float *  data,
unsigned char *  bpm,
long  npts,
float *  mean,
float *  sig 
)
Name:
casu_meansig
Purpose:
Find the mean and sigma of a floating point array with a possible bad pixel mask
Description:
A straight-forward mean and standard deviation calculation is done. If a bad pixel mask is included, then the flagged pixels are removed from the calculations.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
nptsNumber of pixels in the data
meanThe output mean
sigThe output dispersion
Return values
CASU_OKIf all went well
CASU_WARNIf the variance is negative. Sigma is passed back as CX_MAXFLOAT. Also if all data points are flagged. In that case both the mean and sigma are set to CX_MAXFLOAT.
Author
Jim Lewis, CASU

Definition at line 595 of file casu_stats.c.

Referenced by vircam_difference_image().

◆ casu_med()

float casu_med ( float *  data,
unsigned char *  bpm,
long  npts 
)
Name:
casu_med
Purpose:
Find the median of a float array with a possible bad pixel mask
Description:
If a bad pixel mask is not included a straight forward median is performed on the input data array. If a bad pixel mask is included then the data good data are copied into a temporary array and then the median is performed. This is a routine for floating point data.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
nptsNumber of pixels in the data
Return values
medianWhen all goes well
CX_MAXFLOATif all are flagged as bad
Author
Jim Lewis, CASU

Definition at line 89 of file casu_stats.c.

Referenced by casu_imcombine(), casu_matchxy(), casu_medmad(), casu_medmadcut(), casu_medsig(), vircam_grout(), and vircam_jmp_interleave().

◆ casu_medmad()

void casu_medmad ( float *  data,
unsigned char *  bpm,
long  np,
float *  med,
float *  mad 
)
Name:
casu_medmad
Purpose:
Find the median and median absolute deviation in a data array
Description:
The median of an array is found, taking into account any flagged values. An array of absolute deviations is created and the median is found of that array.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
npNumber of pixels in the data
medThe output median
madThe output median absolute deviation
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 347 of file casu_stats.c.

References casu_med().

Referenced by casu_defringe(), casu_genbpm(), casu_matchstds(), vircam_destripe(), vircam_difference_image(), and vircam_genbpm().

◆ casu_medmadcut()

void casu_medmadcut ( float *  data,
unsigned char *  bpm,
long  np,
float  lcut,
float  hcut,
float *  med,
float *  mad 
)
Name:
casu_medmadcut
Purpose:
Find the median and median absolute deviation in a data array with a high and/or low cut
Description:
The median of an array is found, taking into account any flagged values and any values outside a low and high data value cut. An array of absolute deviations is created and the median is found of that array.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
npNumber of pixels in the data
lcutLower value for data window
hcutUpper value for data window
medThe output median
madThe output median absolute deviation
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 406 of file casu_stats.c.

References casu_med().

Referenced by vircam_destripe().

◆ casu_medsig()

void casu_medsig ( float *  data,
unsigned char *  bpm,
long  np,
float *  med,
float *  sig 
)
Name:
casu_medsig
Purpose:
Find the median and sigma about that median.
Description:
The median of an array is found, taking into account any flagged values. The sigma is then worked out about the median.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask or NULL
npNumber of pixels in the data
medThe output median
sigThe output sigma
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 672 of file casu_stats.c.

References casu_med().

Referenced by casu_genbpm(), and vircam_genbpm().

◆ casu_qmedsig()

void casu_qmedsig ( float *  data,
unsigned char *  bpm,
long  npts,
float  thresh,
int  niter,
float  lowv,
float  highv,
float *  median,
float *  sigma 
)
Name:
casu_qmedsig
Purpose:
Find a "quick" median and sigma of a floating point array with a bad pixel mask, with lower and upper cuts and with clipping.
Description:
Data outside the data window and data flagged in the bad pixel mask are removed from further consideration. The remaining data are histogrammed in 1 adu bins. A number of iterations are used to find the median and sigma by finding the meidan in the histogram and its quartiles, then using these in conjunction with user defined clipping thresholds to define new estimates.
Language:
C
Parameters
dataInput data
bpmInput bad pixel mask
nptsNumber of pixels in the data
threshClipping threshold
niterNumber of clipping iterations
lowvLower value for data window
highvUpper value for data window
medianThe output median
sigmaThe output dispersion
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 258 of file casu_stats.c.

Referenced by casu_pawsky_minus(), vircam_destripe(), vircam_jmp_skycor(), and vircam_mosaic().

◆ casu_sumbpm()

int casu_sumbpm ( unsigned char *  bpm,
long  npts,
int *  sumb 
)
Name:
casu_sumbpm
Purpose:
Get the sum from a bad pixel mask
Description:
Sum all the values in a bad pixel mask. This is useful for telling how many pixels are bad.
Language:
C
Parameters
bpmInput bad pixel mask
nptsNumber of pixels in the bpm
sumbThe output sum
Return values
CASU_OKAlways
Author
Jim Lewis, CASU

Definition at line 738 of file casu_stats.c.