private bool Offset_Item(Spectrum_TableItem item, float f, out float v)
        {
            bool b = true;

            //频率落在节点上
            if (Math.Abs(f - item.f) < 0.0001f)
            {
                v = item.v;
            }

            //频率落在节点的前一个区间
            else if (((f - item.f1) > 0.0001f) &&
                     ((item.f - f) > 0.0001f))
            {
                v = Offset_Linear(item, f, 0);
            }

            //频率落在节点后一个区间
            else if (((f - item.f) > 0.0001f) &&
                     ((item.f2 - f) > 0.0001f))
            {
                v = Offset_Linear(item, f, 1);
            }

            else
            {
                v = 0.0f;
                b = false;
            }

            return(b);
        }
        private float Offset_Linear(Spectrum_TableItem item, float f, int section)
        {
            float a = (item.v2 - item.v) / (item.f2 - item.f);

            float b = (item.v * item.f2 - item.v2 * item.f) / (item.f2 - item.f);

            return(a * f + b);
        }
        internal void LoadSettings()
        {
            string s  = "";
            string s1 = "";
            string s2 = "";

            tItems = new List <Spectrum_TableItem>();

            tItem = new Spectrum_TableItem();

            System.IO.StreamReader textReader = new System.IO.StreamReader(fileName);

            Spectrum_TableItem tItem_temp;

            //加载补偿项
            while (!textReader.EndOfStream)
            {
                s = (textReader.ReadLine()).Trim();

                if (String.IsNullOrEmpty(s))
                {
                    continue;
                }

                s1 = IniFile.GetItemFrom(s, 0, 2);

                s2 = IniFile.GetItemFrom(s, 1, 2);

                try
                {
                    tItem_temp = new Spectrum_TableItem();

                    tItem_temp.f = Convert.ToSingle(s1);
                    tItem_temp.v = Convert.ToSingle(s2);
                    tItems.Add(tItem_temp);
                } catch (System.InvalidCastException)
                {
                }
            }

            textReader.Close();

            textReader.Dispose();

            Processing();

            if (tItems.Count > 0)
            {
                tItem.f1 = tItems[0].f1;
                tItem.v1 = tItems[0].v1;
                tItem.f  = tItems[0].f;
                tItem.v  = tItems[0].v;
                tItem.f2 = tItems[0].f2;
                tItem.v2 = tItems[0].v2;
            }
            else
            {
                tItem.f1 = float.MaxValue;
                tItem.v1 = float.MinValue;
                tItem.f  = float.MaxValue;
                tItem.v  = float.MinValue;
                tItem.f2 = float.MaxValue;
                tItem.v2 = float.MinValue;
            }
        }