} // FELTWithSprTemplate()

        /// <summary>
        /// Edits the passed events to adjust start and end locations to position of maximum score
        /// Also correct the scores because we want the max match for a template
        /// Also correct the time scale
        /// </summary>
        /// <param name="matchEvents"></param>
        /// <param name="callName"></param>
        /// <param name="templateDuration"></param>
        /// <param name="sonogramDuration"></param>
        public static void AdjustEventLocation(List <AcousticEvent> matchEvents, string callName, double templateDuration, double sonogramDuration)
        {
            Log.WriteLine("# ADJUST EVENT LOCATIONS");
            Log.WriteLine("# Event: " + callName);
            foreach (AcousticEvent ae in matchEvents)
            {
                Log.WriteLine("# Old  event frame= {0} to {1}.", ae.Oblong.RowTop, ae.Oblong.RowBottom);
                ae.Name      = callName;
                ae.TimeStart = ae.Score_TimeOfMaxInEvent;
                ae.TimeEnd   = ae.TimeStart + templateDuration;
                if (ae.TimeEnd > sonogramDuration)
                {
                    ae.TimeEnd = sonogramDuration;                                // check for overflow.
                }
                ae.Oblong          = AcousticEvent.ConvertEvent2Oblong(ae);
                ae.Score           = ae.Score_MaxInEvent;
                ae.ScoreNormalised = ae.Score / ae.Score_MaxPossible;  // normalised to the user supplied threshold
                Log.WriteLine("# New event time = {0:f2} to {1:f2}.", ae.TimeStart, ae.TimeEnd);
                Log.WriteLine("# New event frame= {0} to {1}.", ae.Oblong.RowTop, ae.Oblong.RowBottom);
            }
        }