/// <summary>
        /// Calculates the Peak Current related values
        /// </summary>
        /// <param name="pointsAroundPeakToAverage">Number of points around the absolute peak to average together (Default: 0)</param>
        private void CalculatePeakCurrent(int pointsAroundPeakToAverage)
        {
            // Calculate the (absolute) Peak Current DataPoint
            DataPoint absolutePeakCurrentDataPoint = this.AbsoluteWaveform.Maximum();

            List <DataPoint> absWfmDataPoints = this.AbsoluteWaveform.DataPoints.ToList();
            int peakIndex      = absWfmDataPoints.IndexOf(absolutePeakCurrentDataPoint);
            int peakStartIndex = Math.Max(0, peakIndex - pointsAroundPeakToAverage);
            int peakStopIndex  = Math.Min(absWfmDataPoints.Count - 1, peakIndex + pointsAroundPeakToAverage);
            List <DataPoint> peakDataPoints = new List <DataPoint>();

            for (int i = peakStartIndex; i <= peakStopIndex; i++)
            {
                peakDataPoints.Add(absWfmDataPoints[i]);
            }

            Waveform peakWaveform = new Waveform(peakDataPoints);
            double   peakCurrent  = peakWaveform.Average();

            if (!this.WaveformIsPositivePolarity)
            {
                peakCurrent *= -1.0;
            }

            // Extract the Peak Current value
            this.PeakCurrentValue     = peakCurrent;
            this.PeakCurrentDataPoint = new DataPoint(absolutePeakCurrentDataPoint.X, peakCurrent);

            // Determine the min and max allowed values for the Peak Current to be passing
            Tuple <double, double, double> nomMinMaxPeakCurrent = CDMJS002WaveformCharacteristics.PeakCurrentNominalMinMax(this.SignedVoltage, this.IsLargeTarget, this.OscilloscopeIsHighBandwidth);

            this.PeakCurrentAllowedMinimum = nomMinMaxPeakCurrent.Item2.InvertValueIfNegativePolarity(this.WaveformIsPositivePolarity);
            this.PeakCurrentAllowedMaximum = nomMinMaxPeakCurrent.Item3.InvertValueIfNegativePolarity(this.WaveformIsPositivePolarity);

            // Determine if the Peak Current is passing
            this.PeakCurrentIsPassing = DoubleRangeExtensions.BetweenInclusive(this.PeakCurrentAllowedMinimum, this.PeakCurrentAllowedMaximum, this.PeakCurrentValue);
        }