Package wsatools :: Module Statistics
[hide private]

Module Statistics

source code

Statistics package for photometry.


Author: N.J.G. Cross

Organization: WFAU, IfA, University of Edinburgh

Requires: Numpy, math, Scientific

Functions [hide private]
 
biweight(xx, cc)
Calculates the biweight - Beers et al.
source code
 
biweightmui(xx, cc)
Calculates the biweight mui - Beers et al.
source code
 
biweightScale(xx, cc)
Calculates the biweight scale - Beers et al.
source code
 
calcMean(xx)
This calculates the mean
source code
 
calcMAD(xx, minSd) source code
 
calcSd(xx) source code
 
calcSkew(xx) source code
 
centralMoment(data, N) source code
 
chiSq(mag, rms, model, nParam)
This returns the reduced chiSquared and number of degrees of freedom.
source code
 
chiSquare(model, parameters, data) source code
 
clippedHistogram(xx, clip=0, Niter=10, imean=-999999500.0, isd=-999999500.0)
Calculates mean and standard deviation of clipped distribution.
source code
tuple
clippedMADHistogram(xx, clip=0, Niter=10, imed=-999999500.0, imad=-999999500.0, retValues='median,psd', minSd=None)
Calculates mean,median,standard deviation and median absolute deviation of a clipped distribution.
source code
 
firstMomentDist(x, y)
This calculates the mean value of x - sum(xy)/sum(y)
source code
numpy array
gammln(betaArray)
Calculates log(Gamma(beta)).
source code
float
getMinSd(xx)
Calculates minimum standard deviation for a distribution.
source code
list
listCounts(inputList, minCount=None)
This returns the sorted unique values in a list of objects and the number of times this value is listed.
source code
 
MAD(xx, minSd=None)
Median Absolute Deviation
source code
 
maskArray(xx, minV, maxV) source code
 
polynomialModel(param, magArray)
Uses numpy to calculate polynomial model
source code
numpy array
probChisq(chiSqArray, ndofArray, nFinalPoints=10000, maxValueY=5.0)
Calculates the probability that the REDUCED chi-squared of a model is less than a particular value.
source code
numpy array
probGauss(sigmaArray, nFinalPoints=10000, maxValueY=5.0)
Calculates the probability that the abs(sigma) of a standard normal distribution is less than a particular value.
source code
 
Pearson(X, Y)
Calculates the Pearson Correlation Coefficient.
source code
 
scaleError(diffXY, dataS, diffXYErr=[1.0], rangeMin=None, rangeMax=None)
This function divides the data into several bins and finds whether there is a gradient in the data.
source code
 
weightedMean(xx, sig)
?
source code
 
clippedWeightedMean(xx, sig, clip, Niter=5) source code
float
welchStetson(aMag, aSigma, bMag, bSigma)
Calculates the Welch-Stetson statistic (1993, AJ, 105, 1813).
source code
Variables [hide private]
  __package__ = 'wsatools'
Function Details [hide private]

biweight(xx, cc)

source code 

Calculates the biweight - Beers et al. 1990. cc is the tuning constant -- 6.0 (approx 4sigma) is good for the location.

biweightmui(xx, cc)

source code 

Calculates the biweight mui - Beers et al. 1990.

biweightScale(xx, cc)

source code 

Calculates the biweight scale - Beers et al. 1990. cc is the tuning constant -- 9.0 is good for the scale.

clippedMADHistogram(xx, clip=0, Niter=10, imed=-999999500.0, imad=-999999500.0, retValues='median,psd', minSd=None)

source code 

Calculates mean,median,standard deviation and median absolute deviation of a clipped distribution. The distribution is clipped by a certain number of median absolute deviations.

Parameters:
  • xx (list) - The input list or array of values.
  • clip (float) - The number of 'standard deviations for clipping'
  • Niter (int) - The number iterations when clipping
  • imed (float) - starting value for the median BEST NOT TO USE
  • imad (float) - starting value for the MAD BEST NOT TO USE
  • retValues (str) - string describing which values to return
Returns: tuple
tuple of statistical values described in retValues

gammln(betaArray)

source code 

Calculates log(Gamma(beta)). Lanczos approximation. Numerical Recipes. |e|<2e-10. This works for any complex argument with a nonnegative real part

Parameters:
  • betaArray (numpy array) - Array of input values for which the gamma function.
Returns: numpy array
log(Gamma(beta).

getMinSd(xx)

source code 

Calculates minimum standard deviation for a distribution. This is to avoid zero values in the calculation of the median absolute deviation. This looks to see if the data is binned/rounded and if not, it will calculate a minimum based on double precision values

Parameters:
  • xx (numpy array) - array of input values
Returns: float
minimum standard deviation

listCounts(inputList, minCount=None)

source code 

This returns the sorted unique values in a list of objects and the number of times this value is listed. Also selects objects with a minimum count.

Parameters:
  • inputList (list) - The input list of values (each value can be any python object).
  • minCount (int) - The minimum number of occurances of a value for it to be returned
Returns: list
List of unique values and the counts for these values.

probChisq(chiSqArray, ndofArray, nFinalPoints=10000, maxValueY=5.0)

source code 

Calculates the probability that the REDUCED chi-squared of a model is less than a particular value. This is calculated by integrating the area under the chi-squared curve up to this value. Inputs an array of REDUCED chi-squared values and an equivalent array of numbers of degrees-of-freedom for these values.

Parameters:
  • chiSqArray (numpy array) - array of reduced chisq values
  • ndofArray (numpy array) - array of number of degree of freedom values
  • nFinalPoints (int) - number of points in lookup table for integration
  • maxValueY (float) - maximum value to integrate to. The p(ChiSq)~1 here.
Returns: numpy array
array of probabilities

probGauss(sigmaArray, nFinalPoints=10000, maxValueY=5.0)

source code 

Calculates the probability that the abs(sigma) of a standard normal distribution is less than a particular value. This is calculated by integrating the area under the gaussian [N(0,1)] curve up to this value. Inputs an array of standard absolute sigma.

Parameters:
  • sigmaArray (numpy array) - array of abs(sigma) from a N(0,1) gaussian
  • nFinalPoints (int) - number of points in lookup table for integration
  • maxValueY (float) - maximum value to integrate to. The p(ChiSq)~1 here.
Returns: numpy array
array of probabilities

welchStetson(aMag, aSigma, bMag, bSigma)

source code 

Calculates the Welch-Stetson statistic (1993, AJ, 105, 1813). The amount of correlation in the variability between two bandpasses.

Parameters:
  • aMag (numpy.array) - array of ?
  • aSigma (float) - ?
  • bMag (numpy.array) - array of ?
  • bSigma (float) - ?
Returns: float
Welch-Stetson statistic.