/// <summary> /// Calculate the passband in the range of ndB dropped from the loss of specified wavelength /// </summary> /// <param name="CentralWavelength">The wavelength of the reference point</param> /// <param name="DropdB"></param> /// <returns> /// Tuple. /// item1: point on the left side of ITU /// item2: point on the right side of ITU /// item3: passband /// </returns> Tuple <Point, Point, double> CalPassBand(double CentralWavelength, double DropdB) { // get the point adjacents to the ITU var pointRef = FindPointByWavelength(CentralWavelength); // the IL used to calculate passband var targeIL = pointRef.Y + DropdB; // get the points before the ITU var pointsBeforeITU = InsertionLoss.Reverse().SkipWhile(p => p.X > pointRef.X); // get the point locates at the left side of the ITU var pointLeftITU = pointsBeforeITU.SkipWhile(p => p.Y < targeIL).First(); // get the points after the ITU var pointsAfterITU = InsertionLoss.SkipWhile(p => p.X < pointRef.X); // get the point locates at the right side of the ITU var pointRightITU = pointsAfterITU.Reverse().SkipWhile(p => p.Y > targeIL).First(); return(new Tuple <Point, Point, double>(pointLeftITU, pointRightITU, pointRightITU.X - pointLeftITU.X)); }
Point FindPointByWavelength(double Wavelength) { return(InsertionLoss.SkipWhile(a => a.X < Wavelength).ElementAt(0)); }