Browse Source

上传 布鲁克xray采集后进行归一化操作

cxs 1 month ago
parent
commit
a66999b603
1 changed files with 7 additions and 6 deletions
  1. 7 6
      OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs

+ 7 - 6
OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs

@@ -69,13 +69,13 @@ namespace OTSModelSharp.ServiceCenter
         {
          var eleChemistry =  partWithXrayInfo.GetXray().GetElementQuantifyData();
             Dictionary<string, List<double>> eleInfoDic = new Dictionary<string, List<double>>();
-            bool hasRepeatEle = false;
+            //process the repeat ele problem
             foreach (var ele in eleChemistry)
             {
                 if (eleInfoDic.ContainsKey(ele.GetName()))//contain repeat data;
                 {
                     eleInfoDic[ele.GetName()].Add(ele.GetPercentage());
-                    hasRepeatEle = true;
+                    //hasRepeatEle = true;
                 }
                 else
                 {
@@ -86,9 +86,9 @@ namespace OTSModelSharp.ServiceCenter
 
 
             }
-            if (hasRepeatEle)
-            {
+           //normalization
                 Dictionary<string, double> resultInfo = new Dictionary<string, double>();
+                double sumvalue = 0;
                 foreach (var eleInfo in eleInfoDic)
                 {
                     double newPercentData=0;
@@ -97,17 +97,18 @@ namespace OTSModelSharp.ServiceCenter
                         newPercentData += p;
                     }
                     newPercentData = newPercentData / eleInfo.Value.Count;
+                    sumvalue += newPercentData;
                     resultInfo.Add(eleInfo.Key, newPercentData);              
                 }
                 foreach (var e in eleChemistry)
                 {
-                    e.SetPercentage(resultInfo[e.GetName()]);
+                    e.SetPercentage(resultInfo[e.GetName()]/sumvalue);
                 
                 }
                 partWithXrayInfo.GetXray().SetElementQuantifyData(eleChemistry);
 
 
-            }
+            
 
 
         }