OPERA
1.0
Open source echelle spectrograph reduction pipeline
|
Statistics library. More...
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "libraries/operaStats.h"
Namespaces | |
namespace | operaStats |
Functions | |
float | operaArrayMean (unsigned np, const float *array) |
Calculate arithmetic mean of float array. | |
float | operaArrayWeightedMean (unsigned np, const float *array, const float *weigh) |
Calculate weighted mean of float array. | |
float | operaArrayAvgSigClip (unsigned np, const float *array, unsigned nsig) |
Calculate average of array clipped by nsig x sdtdev of original array. | |
float | operaArraySig (unsigned np, const float *array) |
Calculate standard deviation around mean of array. | |
float | operaArrayWeightedSig (unsigned np, const float *array, const float *weigh) |
Calculate weighted standard deviation of weighted mean of array. | |
float | operaArrayMedian (unsigned np, const float *array) |
This function non-destructively finds the median of an array. | |
float | operaArrayMedSig (unsigned np, const float *array, float median) |
Calculate median deviation of float array. | |
float | operaArrayMaxValue (unsigned np, const float *array) |
Find maximum value of float array. | |
float | operaArrayMinValue (unsigned np, const float *array) |
Find minimum value of float array. | |
void | operaArrayHeapSort (unsigned np, float *arr) |
This function destructively heap sorts an array. | |
void | operaArrayIndexSort (unsigned np, const float *array, unsigned *sindex) |
This function sorts a float array in increasing order using index association (doesn't change original array) | |
float | operaUniformRand (float xcen, float xmin, float xmax) |
This function produces a random number with uniform distribution. | |
float | operaGaussRand (float xcen, float sig) |
This function produces a random number with normal distribution. | |
unsigned | operaCountPixels (unsigned np, const float *array, float minvalue, float maxvalue) |
Count number of elements in array lying between minvalue and maxvalue. | |
Variables | |
static int | verbose = 0 |
Statistics library. | |
static int | debug = 0 |
Statistics library.
float operaArrayAvgSigClip | ( | unsigned | np, |
const float * | array, | ||
unsigned | nsig | ||
) |
Calculate average of array clipped by nsig x sdtdev of original array.
float operaArrayAvgSigClip(unsigned np, const float *array, unsigned nsig)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
nsig | is an unsigned for size for which data is clipped in sigma units |
void operaArrayHeapSort | ( | unsigned | np, |
float * | arr | ||
) |
This function destructively heap sorts an array.
void operaArrayHeapSort(unsigned np, float *arr)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
void operaArrayIndexSort | ( | unsigned | np, |
const float * | array, | ||
unsigned * | sindex | ||
) |
This function sorts a float array in increasing order using index association (doesn't change original array)
void operaArrayIndexSort(unsigned n, const float *x, unsigned *sindex)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
sindex | is an unsigned pointer for the index association of the sorted array |
float operaArrayMaxValue | ( | unsigned | np, |
const float * | array | ||
) |
Find maximum value of float array.
float operaArrayMaxValue(unsigned np, const float *array)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
float operaArrayMean | ( | unsigned | np, |
const float * | array | ||
) |
Calculate arithmetic mean of float array.
float operaArrayMean(unsigned np, const float *array)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
float operaArrayMedian | ( | unsigned | np, |
const float * | array | ||
) |
This function non-destructively finds the median of an array.
float operaArrayMedian(unsigned np, const float *array)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
float operaArrayMedSig | ( | unsigned | np, |
const float * | array, | ||
float | median | ||
) |
Calculate median deviation of float array.
float operaArrayMedSig(unsigned np, const float *array, float median)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
median | is a float input for the median of array |
float operaArrayMinValue | ( | unsigned | np, |
const float * | array | ||
) |
Find minimum value of float array.
float operaArrayMinValue(unsigned np, const float *array)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
float operaArraySig | ( | unsigned | np, |
const float * | array | ||
) |
Calculate standard deviation around mean of array.
float operaArraySig(unsigned np, const float *array)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
float operaArrayWeightedMean | ( | unsigned | np, |
const float * | array, | ||
const float * | weigh | ||
) |
Calculate weighted mean of float array.
float operaArrayWeightedMean(unsigned np, const float *array, const float *weigh)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
weigh | is a float pointer with weights |
float operaArrayWeightedSig | ( | unsigned | np, |
const float * | array, | ||
const float * | weigh | ||
) |
Calculate weighted standard deviation of weighted mean of array.
float operaArrayWeightedSig(unsigned np, const float *array, const float *weigh)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
weigh | is a float pointer with weights |
unsigned operaCountPixels | ( | unsigned | np, |
const float * | array, | ||
float | minvalue, | ||
float | maxvalue | ||
) |
Count number of elements in array lying between minvalue and maxvalue.
operaCountPixels(unsigned np, const float *array, float minvalue, float maxvalue)
np | is an unsigned for the number of elements in array |
array | is a float pointer with data |
minvalue | is a float for the minimum value to count an element |
maxvalue | is a float for the maximum value to count an element |
float operaGaussRand | ( | float | xcen, |
float | sig | ||
) |
This function produces a random number with normal distribution.
float operaGaussRand(float xcen, float sig)
xcen | is a float to define the center of the distribution |
sig | is a float to define the spread of the distribution (symmetric) |
float operaUniformRand | ( | float | xcen, |
float | xmin, | ||
float | xmax | ||
) |
This function produces a random number with uniform distribution.
float operaUniformRand(float xcen, float xmax, float xmin)
xcen | is a float for the center of the distribution |
xmin | is a float to define the lower limit of the distribution (rand > xcen - xmin) |
xmax | is a float to define the higher limit of the distribution (rand < xcen + xmax) |