// Finds potential matches in ProjectHandler NMRRefResults, adds them to matches
    public override void DetermineMatches()
    {
        ProjectReview projHandler = FindObjectOfType <ProjectReview>();

        matches.Clear();

        if (projHandler.NMRRefs.Count > 0)
        {
            List <NMRRefResults> acceptableMatches = new List <NMRRefResults>();

            foreach (NMRRefResults NMRRef in projHandler.NMRRefs)
            {
                if (this.ReturnMatchAccuracyWithReferenceSet(NMRRef) > NMRRef.accuracyRequirement)
                {
                    acceptableMatches.Add(NMRRef);
                }
            }

            int           numOfTopPicksFound = 0;
            float         tempMatchRating    = 0;
            NMRRefResults tempTopRef         = null;

            while ((numOfTopPicksFound < defaultNumOfRefsToShow) && (acceptableMatches.Count > 0))
            {
                foreach (NMRRefResults NMRRef in acceptableMatches)
                {
                    float rating = ReturnMatchRatingWithReferenceSet(NMRRef);

                    if (rating > tempMatchRating)
                    {
                        tempMatchRating = rating;
                        tempTopRef      = NMRRef;
                    }
                }

                if (tempTopRef && !matches.Contains(tempTopRef))
                {
                    matches.Add(tempTopRef);
                }

                acceptableMatches.Remove(tempTopRef);
                tempMatchRating = 0;
                tempTopRef      = null;
                numOfTopPicksFound++;
            }
        }
    }
    public float ReturnMatchAccuracyWithReferenceSet(NMRRefResults otherSet)
    {
        int   numOfMatches           = 0;
        float peakMatchAccuracyTotal = 0;

        foreach (NMRPeak peak in maxima)
        {
            foreach (NMRRefPeak refPeak in otherSet.maxima)
            {
                if (Mathf.Abs(peak.shift - refPeak.shift) < otherSet.shiftTolerance)
                {
                    numOfMatches++;
                    float acc = 1 - Mathf.Abs(1 - peak.intensity / refPeak.intensity);
                    peakMatchAccuracyTotal += acc;
                }
            }
        }

        return(peakMatchAccuracyTotal * 100.0f / numOfMatches);
    }
 public float ReturnMatchRatingWithReferenceSet(NMRRefResults otherSet)
 {
     return(ReturnMatchAccuracyWithReferenceSet(otherSet) - otherSet.accuracyRequirement);
 }