public static List<PointF> ABP_Rhythm (Patient _P, float _Amplitude) {
            VaryAmplitude_Random (0.1f, ref _Amplitude);

            return Plotting.Concatenate (new List<PointF> (),
                Plotting.Stretch (Dictionary.ABP_Default, _P.GetPulsatility_Seconds),
                _Amplitude);
        }
        public static List<PointF> RR_Rhythm (Patient _P, bool _Inspire) {
            float _Portion = 0.1f;

            List<PointF> thisBeat = new List<PointF> ();
            Plotting.Concatenate (ref thisBeat, Plotting.Line (ResolutionTime, _Portion, 0.3f * (_Inspire ? 1 : -1), Plotting.Last (thisBeat)));
            Plotting.Concatenate (ref thisBeat, Plotting.Line (ResolutionTime, _Portion, 0f, Plotting.Last (thisBeat)));
            return thisBeat;
        }
        public static List<PointF> ECG_Isoelectric__Atrial_Flutter (Patient _P, Lead _L) {
            int Flutters = (int)System.Math.Ceiling (_P.GetHR_Seconds / 0.16f);

            List<PointF> thisBeat = new List<PointF> ();
            for (int i = 1; i < Flutters; i++)
                thisBeat = Plotting.Concatenate (thisBeat, ECG_P (_P, _L, 0.16f, .08f, 0f, Plotting.Last (thisBeat)));
            return thisBeat;
        }
        public static List<PointF> PCW_Rhythm (Patient _P, float _Amplitude) {
            DampenAmplitude_IntrathoracicPressure (_P, ref _Amplitude);
            DampenAmplitude_EctopicBeat (_P, ref _Amplitude);

            return Plotting.Concatenate (new List<PointF> (),
                Plotting.Stretch (Dictionary.PCW_Default, _P.GetHR_Seconds),
                _Amplitude);
        }
        public static List<PointF> SPO2_Rhythm (Patient _P, float _Amplitude) {
            VaryAmplitude_Random (0.1f, ref _Amplitude);
            DampenAmplitude_EctopicBeat (_P, ref _Amplitude);
            DampenAmplitude_PulsusAlternans (_P, ref _Amplitude);
            DampenAmplitude_PulsusParadoxus (_P, ref _Amplitude);

            return Plotting.Concatenate (new List<PointF> (),
                Plotting.Stretch (Dictionary.SPO2_Rhythm, _P.GetHR_Seconds),
                _Amplitude);
        }
        public static List<PointF> ICP_Rhythm (Patient _P, float _Amplitude) {
            DampenAmplitude_EctopicBeat (_P, ref _Amplitude);
            VaryAmplitude_Random (0.1f, ref _Amplitude);

            return Plotting.Concatenate (new List<PointF> (),
                Plotting.Stretch (  // Lerp to change waveform based on intracranial compliance due to ICP
                    Dictionary.Lerp (Dictionary.ICP_HighCompliance, Dictionary.ICP_LowCompliance,
                        Math.Clamp (Math.InverseLerp (15, 25, _P.ICP), 0, 1)),    // ICP compliance coefficient
                    _P.GetHR_Seconds),
                _Amplitude);
        }
        public static List<PointF> ECG_Complex__QRST_Aberrant_3 (Patient _P, Lead _L) {
            float lerpCoeff = Math.Clamp (Math.InverseLerp (30, 160, _P.HR)),
                QRS = Math.Lerp (0.12f, 0.26f, 1 - lerpCoeff),
                QT = Math.Lerp (0.25f, 0.6f, 1 - lerpCoeff);

            List<PointF> thisBeat = new List<PointF> ();
            thisBeat = Plotting.Concatenate (thisBeat, ECG_Q (_P, _L, QRS / 3, 0.1f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_R (_P, _L, QRS / 6, -0.7f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_J (_P, _L, QRS / 6, -0.6f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_ST (_P, _L, ((QT - QRS) * 2) / 5, 0.1f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_T (_P, _L, ((QT - QRS) * 3) / 5, 0.3f, 0f, Plotting.Last (thisBeat)));
            return thisBeat;
        }
 public static List<PointF> IABP_ABP_Rhythm (Patient _P, float _Amplitude) {
     if (!_P.Cardiac_Rhythm.HasPulse_Ventricular)
         return Plotting.Concatenate (new List<PointF> (),
             Plotting.Stretch (Dictionary.IABP_ABP_Nonpulsatile, _P.GetHR_Seconds),
             _Amplitude);
     else if (_P.Cardiac_Rhythm.AberrantBeat)
         return Plotting.Concatenate (new List<PointF> (),
             Plotting.Stretch (Dictionary.IABP_ABP_Ectopic, _P.GetHR_Seconds),
             _Amplitude);
     else
         return Plotting.Concatenate (new List<PointF> (),
             Plotting.Stretch (Dictionary.IABP_ABP_Default, _P.GetHR_Seconds),
             _Amplitude);
 }
        public static List<PointF> CVP_Rhythm (Patient _P, float _Amplitude) {
            VaryAmplitude_Random (0.1f, ref _Amplitude);
            DampenAmplitude_IntrathoracicPressure (_P, ref _Amplitude);
            DampenAmplitude_EctopicBeat (_P, ref _Amplitude);

            if (_P.Cardiac_Rhythm.HasPulse_Atrial && !_P.Cardiac_Rhythm.AberrantBeat)
                return Plotting.Concatenate (new List<PointF> (),
                    Plotting.Stretch (Dictionary.CVP_Atrioventricular, _P.GetHR_Seconds),
                    _Amplitude);
            else
                return Plotting.Concatenate (new List<PointF> (),
                    Plotting.Stretch (Dictionary.CVP_Ventricular, _P.GetHR_Seconds),
                    _Amplitude);
        }
        public static List<PointF> ECG_Complex__QRST_SVT (Patient _P, Lead _L) {
            float _Length = _P.GetHR_Seconds;
            float lerpCoeff = Math.Clamp (Math.InverseLerp (160, 240, _P.HR)),
                        QRS = Math.Lerp (0.05f, 0.12f, 1 - lerpCoeff),
                        QT = Math.Lerp (0.22f, 0.36f, 1 - lerpCoeff);

            List<PointF> thisBeat = new List<PointF> ();
            thisBeat = Plotting.Concatenate (thisBeat, ECG_Q (_P, _L, QRS / 4, -0.1f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_R (_P, _L, QRS / 4, 0.9f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_S (_P, _L, QRS / 4, -0.3f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_J (_P, _L, QRS / 4, -0.1f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_ST (_P, _L, ((QT - QRS) * 1) / 5, -0.06f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_T (_P, _L, ((QT - QRS) * 2) / 5, 0.15f, 0.06f, Plotting.Last (thisBeat)));
            thisBeat = Plotting.Concatenate (thisBeat, ECG_T (_P, _L, ((QT - QRS) * 2) / 5, 0.08f, 0f, Plotting.Last (thisBeat)));
            return thisBeat;
        }
        public static List<PointF> ECG_Complex__QRST_VF (Patient _P, Lead _L, float _Amp) {
            float _Length = _P.GetHR_Seconds,
                    _Wave = _P.GetHR_Seconds / 2f,
                    _Amplitude = (float)(Math.RandomDouble (0.3f, 0.6f) * _Amp);

            List<PointF> thisBeat = new List<PointF> ();
            while (_Length > 0f) {
                thisBeat = Plotting.Concatenate (thisBeat, Plotting.Curve (ResolutionTime, _Wave, _Amplitude, 0f, Plotting.Last (thisBeat)));

                // Flip the sign of amplitude and randomly crawl larger/smaller, models the
                // flippant waves in v-fib.
                _Amplitude = 0 - (float)Math.Clamp (Math.RandomDouble (_Amplitude - 0.1f, _Amplitude + 0.1f), -1f, 1f);
                _Length -= _Wave;
            }
            return thisBeat;
        }
 private static List<PointF> ECG_S (Patient p, Lead l, float _L, float _mV, PointF _S) {
     return Plotting.Line (ResolutionTime, _L, _mV * baseLeadCoeff [(int)l.Value, (int)WavePart.S]
         * axisLeadCoeff [(int)p.Cardiac_Axis.Value, (int)l.Value, (int)AxisPart.S], _S);
 }
 public static List<PointF> IABP_Balloon_Rhythm (Patient _P, float _Amplitude) {
     return Plotting.Concatenate (new List<PointF> (),
         Plotting.Stretch (Dictionary.IABP_Balloon_Default, _P.GetHR_Seconds * 0.6f),
         _Amplitude);
 }
 public static List<PointF> ETCO2_Rhythm (Patient _P) {
     return Plotting.Concatenate (new List<PointF> (),
         Plotting.Stretch (Dictionary.ETCO2_Default, _P.GetRR_Seconds_E));
 }
 public static List<PointF> Flat_Line (float _Length, float _Isoelectric) {
     return Plotting.Line (ResolutionTime, _Length, _Isoelectric, new PointF (0, _Isoelectric));
 }
 private static List<PointF> ECG_TP (Patient p, Lead l, float _L, float _mV, PointF _S) {
     return Plotting.Line (ResolutionTime, _L, _mV + baseLeadCoeff [(int)l.Value, (int)WavePart.TP], _S);
 }
 private static List<PointF> ECG_T (Patient p, Lead l, float _L, float _mV, float _mV_End, PointF _S) {
     return Plotting.Peak (ResolutionTime, _L, (_mV * baseLeadCoeff [(int)l.Value, (int)WavePart.T]) + p.T_Elevation [(int)l.Value], _mV_End, _S);
 }
 private static List<PointF> ECG_J (Patient p, Lead l, float _L, float _mV, PointF _S) {
     return Plotting.Line (ResolutionTime, _L, (_mV * baseLeadCoeff [(int)l.Value, (int)WavePart.J]) + p.ST_Elevation [(int)l.Value], _S);
 }
 public static List<PointF> ECG_CPR_Artifact (Patient _P, Lead _L) {
     return Plotting.Concatenate (new List<PointF> (),
         Plotting.Multiply (
             Plotting.Stretch (Dictionary.ECG_CPR_Artifact, _P.GetHR_Seconds),
         baseLeadCoeff [(int)_L.Value, (int)WavePart.QRST]));
 }
 public static List<PointF> ECG_Pacemaker (Patient _P, Lead _L) {
     return Plotting.Concatenate (new List<PointF> (),
         Plotting.Multiply (Plotting.Convert (Dictionary.ECG_Pacemaker),
         baseLeadCoeff [(int)_L.Value, (int)WavePart.QRST]));
 }