public void CalculateHypothesisTestResults() { // Only perform these calculations if files have been processed and a pair of files (marked and unmarked) are available bool IsDirty = false; bool HasValues = false; HypothesisTest ht = new HypothesisTest(); ProcessCapturePackets pcp = new ProcessCapturePackets(); int markedFileCount = pcp.GetProcessedFilesCountMarked(); int unmarkedFileCount = pcp.GetProcessedFilesCountUnmarked(); ht = pcp.GetHypothesisTestResults(); if (ht != null) { HasValues = ht.HasValues; } //if (markedFileCount >= 1 && unmarkedFileCount >= 1 && (markedFileCount + unmarkedFileCount) % 2 == 0) if (markedFileCount >= 1 && unmarkedFileCount >= 1) { // Get mean of means test results HypothesisTest htMeans = new HypothesisTest(); //htMeans = GetMeansHypothesisTestResult(); MeansHypothesisTest mht = new MeansHypothesisTest(_TrimZeroPacketIntervals); htMeans = mht.GetHypothesisTestResult(); ht.MeansTestResult = htMeans.MeansTestResult; ht.MeanOfMeansVariance = htMeans.MeanOfMeansVariance; ht.MeansVarianceStandardDeviation = htMeans.MeansVarianceStandardDeviation; if(AnalysisConfiguration.HypothesisTestType == HypothesisTestType.MeansTest && htMeans.MeansTestResult) { AnalysisConfiguration.FoundCoresidentVm = true; } else { AnalysisConfiguration.FoundCoresidentVm = false; } if (AnalysisConfiguration.HypothesisTestType == HypothesisTestType.KsTestStep) { // Get the K-S test results (using step function between probability data points) HypothesisTest htKsStep = new HypothesisTest(); //htKsStep = GetKsStepHypothesisTestResult(); KsStepHypothesisTest ksht = new KsStepHypothesisTest(); htKsStep = ksht.GetHypothesisTestResult(); ht.KsStatistic = htKsStep.KsStatistic; ht.MaxCpdVariance = htKsStep.MaxCpdVariance; ht.KsTestResult = htKsStep.KsTestResult; ht.HasValues = true; IsDirty = true; if(htKsStep.KsTestResult) { AnalysisConfiguration.FoundCoresidentVm = true; } else { AnalysisConfiguration.FoundCoresidentVm = false; } } //else else if(AnalysisConfiguration.HypothesisTestType == HypothesisTestType.KsTestLinear) { // Default: Get the K-S test results (using linear extrapolation between probability data points) HypothesisTest htKsLinear = new HypothesisTest(); //htKsLinear = GetKsLinearHypothesisTestResult(); KsLinearHypothesisTest klht = new KsLinearHypothesisTest(); htKsLinear = klht.GetHypothesisTestResult(); ht.KsStatistic = htKsLinear.KsStatistic; ht.MaxCpdVariance = htKsLinear.MaxCpdVariance; ht.KsTestResult = htKsLinear.KsTestResult; ht.HasValues = true; IsDirty = true; if (htKsLinear.KsTestResult) { AnalysisConfiguration.FoundCoresidentVm = true; } else { AnalysisConfiguration.FoundCoresidentVm = false; } } } else if(!HasValues) { // Default values - only if we haven't previously calculated hypothesis test results ht.MeanOfMeansVariance = 0; ht.MeansVarianceStandardDeviation = 0; ht.MeansTestResult = false; ht.KsTestResult = false; ht.HasValues = false; IsDirty = true; } if (IsDirty) { // Save the test results pcp.DeleteHypothesisTestResults(); pcp.InsertHypothesisTestResults(ht); } }