func (self *KSTestFingerprint) calcThreshold(othr *KSTestFingerprint) float64 {
	c := confidenceMappings[self.confidence]
	n := float64(len(self.edf))
	m := float64(len(othr.edf))
	return c * math.Sqrt((n+m)/(n*m))
}
Calculate the critical threshold for this comparision
package kstest
import (
	"math"
	"sort"
	"github.com/nathanielc/morgoth"
	"github.com/nathanielc/morgoth/counter"
)
var confidenceMappings = []float64{
	1.22,
	1.36,
	1.48,
	1.63,
	1.73,
	1.95,
}
type KSTest struct {
	confidence uint
}
func New(confidence uint) *KSTest {
	return &KSTest{
		confidence: confidence,
	}
}
func (self *KSTest) Fingerprint(window *morgoth.Window) morgoth.Fingerprint {
	sort.Float64s(window.Data)
	return &KSTestFingerprint{self.confidence, window.Data}
}
type KSTestFingerprint struct {
	confidence uint
	edf        []float64
}
func (self *KSTestFingerprint) IsMatch(other counter.Countable) bool {
	othr, ok := other.(*KSTestFingerprint)
	if !ok {
		return false
	}
	if self.confidence != othr.confidence {
		return false
	}
	threshold := self.calcThreshold(othr)
	D := calcD(self.edf, othr.edf)
	return D < threshold
}