private void EvaluateEndedSequence() { if ((float)_numberOfErrors / TestBlockData.NumberOfTargets > TestBlockData.ErrorThreshold / 100f) { Debug.Log("----Number of errors exceeds error threshold - Restarting current test sequence----"); TestBlockData.Sequences[_sequenceIndex].SequenceOfRepeats++; _sequenceIndex--; _errorThresholdText.enabled = true; ClearInitialTargets(); StopTest(); } else { Debug.Log("----Test Sequence Completed Successfully----"); //Calculate result data for sequence just completed List <double> dxs = new List <double>(); List <double> aes = new List <double>(); for (int i = 0; i < TestBlockData.Sequences[_sequenceIndex].Trials.Count; i++) { DxCalculationSet calcSet = new DxCalculationSet(); TestTrial fromTarget = i == 0 ? TestBlockData.Sequences[_sequenceIndex].Trials[TestBlockData.Sequences[_sequenceIndex].Trials.Count - 1] : TestBlockData.Sequences[_sequenceIndex].Trials[i - 1]; TestTrial toTarget = TestBlockData.Sequences[_sequenceIndex].Trials[i]; calcSet.From = GetTargetSpawnPosition(TestBlockData.Sequences[_sequenceIndex].TargetAmplitude, fromTarget.TargetAngle); calcSet.To = GetTargetSpawnPosition(TestBlockData.Sequences[_sequenceIndex].TargetAmplitude, toTarget.TargetAngle); calcSet.Selection = calcSet.To + toTarget.TargetCenterError; double dx = TestDataHelper.CalculateDeltaX(calcSet); dxs.Add(dx); double a = TestDataHelper.CalculateA(calcSet); if (i == 0) { aes.Add(a + dx); } else { aes.Add(a + dx + dxs[i - 1]); } } TestBlockData.Sequences[_sequenceIndex].Throughput = TestDataHelper.CalculateThroughput(aes, dxs, TestBlockData.Sequences[_sequenceIndex].GetMovementTimes()); TestBlockData.Sequences[_sequenceIndex].CalculateMeanMovementTime(); TestBlockData.Sequences[_sequenceIndex].Errors = _numberOfErrors; TestBlockData.Sequences[_sequenceIndex].CalculateErrorRate(); TestBlockData.Sequences[_sequenceIndex].EffectiveAmplitude = TestDataHelper.Mean(aes); TestBlockData.Sequences[_sequenceIndex].EffectiveTargetWidth = TestDataHelper.CalculateEffectiveWidth(dxs); TestBlockData.Sequences[_sequenceIndex].EffecttiveIndexOfDifficulty = TestDataHelper.CalculateEffectiveDifficultyIndex(aes, TestBlockData.Sequences[_sequenceIndex].EffectiveTargetWidth); StudyManager.Instance.AddLogDetail(TestBlockData, _sequenceIndex); ClearInitialTargets(); StopTest(); } }