stats

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateNoise

func EstimateNoise(data []float32, width int32) float32

Estimate the level of gaussian noise on a natural image. From J. Immerkær, “Fast Noise Variance Estimation”, Computer Vision and Image Understanding, Vol. 64, No. 2, pp. 300-302, Sep. 1996

func FastApproxBoundedMAD

func FastApproxBoundedMAD(data []float32, location float32, lowBound, highBound float32, numSamples int) float32

Calculates fast approximate median of absolute differences of the (presumably large) data by subsampling the given number of values and taking the MAD of that.

func FastApproxBoundedMedian

func FastApproxBoundedMedian(data []float32, lowBound, highBound float32, samples []float32) float32

Calculates fast approximate median of the (presumably large) data by subsampling the given number of values and taking the median of that. Uses provided samples array as scratchpad

func FastApproxBoundedQn

func FastApproxBoundedQn(data []float32, lowBound, highBound float32, samples []float32) float32

Calculates fast approximate Qn scale estimate of the (presumably large) data by subsampling the given number of pairs and taking the first quartile of that.

func FastApproxBoundedStdDev

func FastApproxBoundedStdDev(data []float32, location float32, lowBound, highBound float32, numSamples int) float32

Calculates fast approximate median of the (presumably large) data by subsampling the given number of values and taking the median of that.

func FastApproxMAD

func FastApproxMAD(data []float32, location float32, samples []float32) float32

Calculates fast approximate median of absolute differences of the (presumably large) data by subsampling the given number of values and taking the MAD of that.

func FastApproxMedian

func FastApproxMedian(data []float32, samples []float32) float32

Calculates fast approximate median of the (presumably large) data by subsampling the given number of values and taking the median of that. Uses provided samples array as scratchpad

func FastApproxQn

func FastApproxQn(data []float32, samples []float32) float32

Calculates fast approximate Qn scale estimate of the (presumably large) data by subsampling the given number of pairs and taking the first quartile of that. Original paper http://web.ipac.caltech.edu/staff/fmasci/home/astro_refs/BetterThanMAD.pdf Original n*log n implementation technical report https://www.researchgate.net/profile/Christophe_Croux/publication/228595593_Time-Efficient_Algorithms_for_Two_Highly_Robust_Estimators_of_Scale/links/09e4150f52c2fcabb0000000/Time-Efficient-Algorithms-for-Two-Highly-Robust-Estimators-of-Scale.pdf Sampling approach appears to be mine

func FastApproxSigmaClippedMedianAndQn

func FastApproxSigmaClippedMedianAndQn(data []float32, sigmaLow, sigmaHigh float32, epsilon float32, numSamples int) (location, scale float32)

Returns a rapid robust estimation of location and scale. Uses a fast approximate median based on randomized sampling, iteratively sigma clipped with a fast approximate Qn based on random sampling. Exits once the absolute change in location and scale is below epsilon.

func FastApproxStdDev

func FastApproxStdDev(data []float32, location float32, numSamples int) float32

Calculates fast approximate median of the (presumably large) data by subsampling the given number of values and taking the median of that.

func GetModeStdDevFromHistogram

func GetModeStdDevFromHistogram(bins []int32, min, max float32) (mode, stdDev float32, err error)

Calculates the mode and the standard deviation of the given histogram

func GetModeStdDevFromPerceptualHistogram

func GetModeStdDevFromPerceptualHistogram(bins []int32, min, max float32) (mode float32, err error)

Calculates the mode and the standard deviation of the given histogram

func GetPeak

func GetPeak(bins []int32, min, max float32) (x, y float32)

Returns the location and the value of the histogram peak

func GetPerceptualHistogramPeak

func GetPerceptualHistogramPeak(bins []int32, min, max float32) (x, y float32)

Returns the location and the value of the histogram peak

func HalfSampleMode

func HalfSampleMode(data []float32) float32

Returns the half sample mode of the data, an estimator for the mode. Does not modify data. Turned out not to be that robust after all, not using this. From Bickel and Fruehwirth 2006, https://arxiv.org/ftp/math/papers/0505/0505419.pdf

func HalfSampleModeSorted

func HalfSampleModeSorted(data []float32) float32

Returns the half sample mode of the data, an estimator for the mode. Does not modify data. Prerequisite: data is sorted. Turned out not to be that robust after all, not using this. From Bickel and Fruehwirth 2006, https://arxiv.org/ftp/math/papers/0505/0505419.pdf

func Histogram

func Histogram(data []float32, min, max float32, bins []int32)

Calculate histogram of data between min and max into given bins

func HistogramScaleLoc

func HistogramScaleLoc(data []float32, min, max float32, numBins uint32) (loc, scale float32)

Calculate scale and location based on histogram

func IKSS

func IKSS(data []float32, epsilon float32, e float32) (location, scale float32)

Returns the iterative k-sigma estimators of locations and scale

func LinearRegression

func LinearRegression(xs, ys []float32) (slope, intercept, xmean, xstddev, ymean, ystddev float32)

Calculate linear regression for xs and ys

func MeanStdDev

func MeanStdDev(xs []float32) (mean, stdDev float32)

func PerceptualHistogram

func PerceptualHistogram(data []float32, min, max float32, bins []int32)

Calculate histogram of data between min and max into given bins

func SigmaClippedMedianAndMAD

func SigmaClippedMedianAndMAD(data []float32, sigmaLow, sigmaHigh float32) (median, mad float32)

Returns the sigma clipped median of the data. Does not change the data.

Types

type LSEstimatorMode

type LSEstimatorMode int

Enumerated type for location and scale estimator modes

const (
	LSEMeanStdDev LSEstimatorMode = iota
	LSEMedianMAD
	LSEIKSS
	LSESCMedianQn
	LSEHistogram
)
var LSEstimator LSEstimatorMode = LSESCMedianQn

Global mode selection for location and scale estimation FIXME: Need to still remove this global

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Statistics on data arrays, calculated on demand

func NewStats

func NewStats(d []float32, w int32) *Stats

func NewStatsForChannel

func NewStatsForChannel(hcl []float32, w int32, ch, numCh int) *Stats

func NewStatsWithMMM

func NewStatsWithMMM(d []float32, w int32, min, max, mean float32) *Stats

func (*Stats) Clear

func (s *Stats) Clear()

func (*Stats) FreeData

func (s *Stats) FreeData()

func (*Stats) Location

func (s *Stats) Location() float32

func (*Stats) Max

func (s *Stats) Max() float32

func (*Stats) Mean

func (s *Stats) Mean() float32

func (*Stats) Min

func (s *Stats) Min() float32

func (*Stats) Noise

func (s *Stats) Noise() float32

func (*Stats) Scale

func (s *Stats) Scale() float32

func (*Stats) SetData

func (s *Stats) SetData(d []float32)

func (*Stats) StdDev

func (s *Stats) StdDev() float32

func (*Stats) String

func (s *Stats) String() string

Pretty print Stats stats to string. Lazily prints only values available

func (*Stats) StringEager

func (s *Stats) StringEager() string

func (*Stats) UpdateCachedWith

func (s *Stats) UpdateCachedWith(multiplier, offset float32)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL