Пример #1
0
        private PairData GetPair(PairData source, float[] keyPoint)
        {
            PairData ret    = new PairData();
            int      length = keyPoint.Length;

            float[] valueY = new float[length];
            for (int i = 0; i < length; i++)
            {
                int findedIndex = FindIndex(source.XData, keyPoint[i]);
                valueY[i] = source.YData[findedIndex];
            }

            ret.PairName = source.PairName;
            ret.XData    = keyPoint;
            ret.YData    = valueY;
            return(ret);
        }
Пример #2
0
        private List <PairData> GetIcr()
        {
            if (!_testData.ContainsKey("NEXT") && !_testData.ContainsKey("FEXT") && !_testData.ContainsKey("SDD21"))
            {
                throw new Exception("SDD21,NEXT and FEXT should be test first than ICR");
            }
            else
            {
                List <PairData> mdnext       = _testData.ContainsKey("MDNEXT") ? _testData["MDNEXT"] : GetMdNext();
                List <PairData> mdfext       = _testData.ContainsKey("MDFEXT") ? _testData["MDFEXT"] : GetMdFext();
                List <PairData> sdd21        = _testData["SDD21"];
                int             length21     = sdd21.Count;
                int             lengthMdnext = mdnext.Count;
                int             lengthMdfext = mdfext.Count;
                if (lengthMdfext != lengthMdnext)
                {
                    throw new Exception("mdnext data colomn is:" + lengthMdnext + "mdfext data colomn is:" + lengthMdfext + " error,should be equal");
                }
                if (lengthMdnext * 2 != length21)
                {
                    throw new Exception("sdd21 data colomn is:" + length21 + " error,should be 2 times of mdnext data column");
                }
                List <PairData> ret = new List <PairData>();
                for (int i = 0; i < lengthMdnext; i++)
                {
                    PairData temp = new PairData();
                    temp.XData = mdfext[i].XData;
                    int     points    = temp.XData.Length;
                    float[] tempYdata = new float[points];
                    for (int j = 0; j < points; j++)
                    {
                        tempYdata[j] =
                            (float)(10 * Math.Log10(Math.Pow(10, mdnext[i].YData[j] / 10) +
                                                    Math.Pow(10, mdfext[i].YData[j] / 10)) -
                                    sdd21[i + length21 / 2].YData[j]);
                    }

                    temp.PairName = mdnext[i].PairName;
                    temp.YData    = tempYdata;
                    ret.Add(temp);
                }

                return(ret);
            }
        }
Пример #3
0
        private Dictionary <string, List <PairData> > GetKeyValue(Dictionary <string, float[]> keyPoint)
        {
            Dictionary <string, List <PairData> > testItemData = new Dictionary <string, List <PairData> >();

            foreach (var testItem in keyPoint)
            {
                if (_testData.ContainsKey(testItem.Key))
                {
                    List <PairData> temp             = _testData[testItem.Key];
                    List <PairData> testItemPairData = new List <PairData>();
                    foreach (var pair in temp)
                    {
                        PairData keyPairData = GetPair(pair, testItem.Value);
                        testItemPairData.Add(keyPairData);
                    }
                    testItemData.Add(testItem.Key, testItemPairData);
                }
            }

            return(testItemData);
        }
Пример #4
0
 private void InsertTestData(plotData plotData, string testItem, string pairName)
 {
     if (_testData.ContainsKey(testItem))
     {
         PairData pairData = new PairData();
         pairData.YData    = plotData.yData;
         pairData.XData    = plotData.xData;
         pairData.PairName = pairName;
         _testData[testItem].Add(pairData);
         //cpParams.addStatus(testItem + ":num:" + _testData[testItem].Count);
     }
     else
     {
         List <PairData> temps    = new List <PairData>();
         PairData        pairData = new PairData();
         pairData.YData    = plotData.yData;
         pairData.XData    = plotData.xData;
         pairData.PairName = pairName;
         temps.Add(pairData);
         _testData.Add(testItem, temps);
     }
 }
Пример #5
0
        private List <PairData> GetMdFext()
        {
            if (!_testData.ContainsKey("FEXT"))
            {
                throw new Exception("FEXT should be test first before MDFEXT");
            }
            List <PairData> next   = _testData["FEXT"];
            int             length = next.Count;

            if (length % 3 != 0)
            {
                throw new Exception("Next data colomn is:" + length + " error,should be 12 or its times");
            }
            List <PairData> ret = new List <PairData>();

            for (int i = 0; i < length / 3; i++)
            {
                PairData temp = new PairData();
                temp.XData = next[i * 3].XData;
                int     points    = temp.XData.Length;
                float[] tempYdata = new float[points];
                for (int j = 0; j < points; j++)
                {
                    float tempMd = 0f;
                    for (int k = 0; k < 3; k++)
                    {
                        tempMd = tempMd + (float)Math.Pow(10, next[i * 3 + k].YData[j] / 10);
                    }

                    tempYdata[j] = (float)(10 * Math.Log10(tempMd));
                }

                temp.YData    = tempYdata;
                temp.PairName = next[i * 3].PairName.Remove(2, 1);
                ret.Add(temp);
            }
            return(ret);
        }