Beispiel #1
0
        /// <summary>
        /// 多频段求权重函数
        /// </summary>
        internal List <Dictionary <ResultFile, double> > GetWeight(List <ResultFile> singleRxTypeFile, List <string> midPointFrequencies)
        {
            List <Dictionary <ResultFile, double> > resultFilesWithWeights = new List <Dictionary <ResultFile, double> >();

            foreach (string midPointFrequency in midPointFrequencies)
            {
                Dictionary <ResultFile, double> singleMidPointResultFilesWithWeight = new Dictionary <ResultFile, double>();
                ResultFile baseFile = new ResultFile();
                foreach (ResultFile resultFile in singleRxTypeFile)
                {
                    if (resultFile.FileNameInfo.MidPointFrequency == midPointFrequency)
                    {
                        baseFile = resultFile;
                        break;
                    }
                }
                foreach (ResultFile resultFile in singleRxTypeFile)
                {
                    if (resultFile.FileNameInfo.MidPointFrequency == midPointFrequency)
                    {
                        singleMidPointResultFilesWithWeight.Add(resultFile, 1);
                    }
                    else if (((int.Parse(resultFile.FileNameInfo.MinFrequency) >= int.Parse(baseFile.FileNameInfo.MinFrequency)) &&
                              (int.Parse(resultFile.FileNameInfo.MinFrequency) <= int.Parse(baseFile.FileNameInfo.MaxFrequency))) ||
                             ((int.Parse(resultFile.FileNameInfo.MaxFrequency) >= int.Parse(baseFile.FileNameInfo.MinFrequency)) &&
                              (int.Parse(resultFile.FileNameInfo.MaxFrequency) <= int.Parse(baseFile.FileNameInfo.MaxFrequency))))
                    {
                        double leftside  = Math.Max(int.Parse(resultFile.FileNameInfo.MinFrequency), int.Parse(baseFile.FileNameInfo.MinFrequency));
                        double rightside = Math.Min(int.Parse(resultFile.FileNameInfo.MaxFrequency), int.Parse(baseFile.FileNameInfo.MaxFrequency));
                        double weight    = (rightside - leftside) / (int.Parse(baseFile.FileNameInfo.MaxFrequency)
                                                                     - int.Parse(baseFile.FileNameInfo.MinFrequency));
                        singleMidPointResultFilesWithWeight.Add(resultFile, weight);
                    }
                }
                resultFilesWithWeights.Add(singleMidPointResultFilesWithWeight);
            }
            return(resultFilesWithWeights);
        }