Ejemplo n.º 1
0
        private float calcHeightWidth(TransCon compconu, TransCon compconl, int offsetu, int offsetl, bool inverseu, bool inversel, float nsteps, float peakpos, float peakheight)
        {
            // outComp width : determine at set height
            float width;
            float wheight = 0.6065f * peakheight;
            float pos1 = peakpos;
            float pos2 = peakpos;
            float cu, cl;
            float con;
            float lastcon = 0;

            for (int i = (int)peakpos; i > 0; i--)
            {
                cu  = compconu.getNormCon(i, offsetu, inverseu);
                cl  = compconl.getNormCon(i, offsetl, inversel);
                con = cu + cl;
                if (con < wheight && i != peakpos)
                {
                    // interpolate
                    pos1 = Util.calcCorX(i + 1, i, lastcon, con, wheight);
                    break;
                }
                lastcon = con;
            }
            for (int i = (int)peakpos; i < nsteps; i++)
            {
                cu  = compconu.getNormCon(i, offsetu, inverseu);
                cl  = compconl.getNormCon(i, offsetl, inversel);
                con = cu + cl;
                if (con < wheight && i != peakpos)
                {
                    // interpolate
                    pos2 = Util.calcCorX(i - 1, i, lastcon, con, wheight);
                    break;
                }
                lastcon = con;
            }
            width = 2 * Math.Abs(pos2 - pos1);
            return(width);
        }
Ejemplo n.º 2
0
        private float calcSlopeWidth(TransCon compconu, TransCon compconl, int offsetu, int offsetl, bool inverseu, bool inversel, float nsteps, float peakpos)
        {
            // outComp width : look for slopes closest to max outComp value
            float width;
            float pos1 = peakpos;
            float pos2 = peakpos;
            float maxpos = peakpos;
            float maxpos0 = peakpos;
            float maxcon = 0;
            float maxcon0 = 0;
            float cu, cl;
            float con;
            float con0 = 0;
            float dcon, maxdcon;

            maxdcon = 0;
            for (int i = (int)peakpos; i > 0; i--)
            {
                cu  = compconu.getNormCon(i, offsetu, inverseu);
                cl  = compconl.getNormCon(i, offsetl, inversel);
                con = cu + cl;
                if (i != peakpos)
                {
                    dcon = con0 - con;
                    if (dcon > maxdcon)
                    {
                        maxdcon = dcon;
                        maxcon  = con;
                        maxcon0 = con0;
                        maxpos  = i;
                        maxpos0 = i + 1;
                    }
                }
                con0 = con;
            }
            // extrapolate slope (y = 0)
            pos1 = Util.calcCorX(maxpos0, maxpos, maxcon0, maxcon, 0);

            maxdcon = 0;
            for (int i = (int)peakpos; i < nsteps; i++)
            {
                cu  = compconu.getNormCon(i, offsetu, inverseu);
                cl  = compconl.getNormCon(i, offsetl, inversel);
                con = cu + cl;
                if (i != peakpos)
                {
                    dcon = con0 - con;
                    if (dcon > maxdcon)
                    {
                        maxdcon = dcon;
                        maxcon  = con;
                        maxcon0 = con0;
                        maxpos  = i;
                        maxpos0 = i - 1;
                    }
                }
                con0 = con;
            }
            // extrapolate slope (y = 0)
            pos2 = Util.calcCorX(maxpos0, maxpos, maxcon0, maxcon, 0);

            width = Math.Abs(pos2 - pos1);
            return(width);
        }