From 42f94fbe76dd04c0cf00904f3188d7ba683dfb83 Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Tue, 11 Feb 2025 11:48:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=87=AA=E5=BB=BA?= =?UTF-8?q?=E5=8F=B0=E7=AB=99=E8=83=BD=E8=B0=B1=20=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E4=B8=AD=E6=B1=82=E9=9D=A2=E7=A7=AF=E7=9A=84=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=9B=E8=A7=A3=E5=86=B3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=83=BD=E9=87=8F=E5=88=BB=E5=BA=A6=E6=9B=B4=E6=96=B0=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E5=88=86=E6=9E=90=E4=B9=8B=E5=90=8E=E8=83=BD=E9=87=8F?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/spectrum/Sample_C_Analysis.java | 1 - .../org/jeecg/common/util/SelfBaseUtil.java | 85 ++++++++++++------- setup/SelfParameter.xml | 4 +- 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java index cf27e583..f9d47c25 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java @@ -272,7 +272,6 @@ public class Sample_C_Analysis { finalReportPath.append(spectrumPathProperties.getRootPath()); // finalReportPath.append(File.separator); finalReportPath.append(spectrumPathProperties.getSaveFilePath()); - finalReportPath.append(File.separator); finalReportPath.append(spectrumPathProperties.getArrPath()); finalReportPath.append(File.separator); finalReportPath.append(this.spectrumFileRelativePath); diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/SelfBaseUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/SelfBaseUtil.java index e15aa602..65046377 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/SelfBaseUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/SelfBaseUtil.java @@ -863,37 +863,58 @@ public class SelfBaseUtil extends AbstractLogOrReport { } // 没有峰信息 核素=未识别 不计算活度浓度 if (!nuclideParam.containsKey("area")) { - double left = 0, right = 0; + double left = 0, right = 0, energy = 0, fwhm = 0; List counts = null; + PHDFile phd = null; // 固定能量范围,半高宽 switch (nuclideName) { case "Xe131M": - left = 29.7 - (0.737 * 1.25); - right = 29.7 + (0.737 * 1.25); - counts = phdFiles[0].getSpec().getCounts(); + phd = phdFiles[0]; +// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), +// nuclideMap.get(nuclideName).getEnergy()) * 1.25; +// left = 29.7 - fwhm; +// right = 29.7 + fwhm; break; case "Xe133M": - left = 29.7 - (0.737 * 1.25); - right = 29.7 + (0.737 * 1.25); - counts = phdFiles[1].getSpec().getCounts(); + phd = phdFiles[1]; +// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), nuclideMap.get(nuclideName).getEnergy()); +// left = 29.7 - fwhm; +// right = 29.7 + fwhm; break; case "Xe133": - left = 81 - (0.781 * 1.25); - right = 81 + (0.781 * 1.25); - counts = phdFiles[2].getSpec().getCounts(); + phd = phdFiles[2]; +// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), nuclideMap.get(nuclideName).getEnergy()); +// left = 81 - fwhm; +// right = 81 + fwhm; break; case "Xe135": - left = 249.8 - (0.916 * 1.25); - right = 249.8 + (0.916 * 1.25); - counts = phdFiles[3].getSpec().getCounts(); + phd = phdFiles[3]; +// left = 249.8 - fwhm; +// right = 249.8 + fwhm; break; } + energy = nuclideMap.get(nuclideName).getEnergy(); + counts = phd.getSpec().getCounts(); + fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), energy) * 1.25; + // 能量转化为道址 + // 能量转化道址公式参数 + List userEnerParaP = phd.getUsedEnerPara().getP(); + // 使用gamma公式将能量转换为道址 + List energyList = Lists.newLinkedList(); + energyList.add(energy - fwhm); + CalValuesOut etc = CalValuesHandler.energyToChannel(energyList, userEnerParaP); + long lc = Math.round(etc.counts.get(0)); + + energyList = Lists.newLinkedList(); + energyList.add(energy + fwhm); + etc = CalValuesHandler.energyToChannel(energyList, userEnerParaP); + long rc = Math.round(etc.counts.get(0)); // 通过道址将这个范围的计数求和 - List gFittingPara = EnergySpectrumHandler.GetFileFittingPara(phdFiles[0].getUsedEnerKD().getG_energy(), + /*List gFittingPara = EnergySpectrumHandler.GetFileFittingPara(phdFiles[0].getUsedEnerKD().getG_energy(), phdFiles[0].getUsedEnerKD().getCentroid_channel()); double lc = gFittingPara.get(0) + gFittingPara.get(1) * left + gFittingPara.get(2) * Math.sqrt(left); - double rc = gFittingPara.get(0) + gFittingPara.get(1) * right + gFittingPara.get(2) * Math.sqrt(right); + double rc = gFittingPara.get(0) + gFittingPara.get(1) * right + gFittingPara.get(2) * Math.sqrt(right);*/ // 面积=计数总和:通过能量卡一个范围,将范围内的计数加和 int area = 0; for (int i = (int)lc; i <= (int) rc; i++) { @@ -918,31 +939,23 @@ public class SelfBaseUtil extends AbstractLogOrReport { public static double getBetaAnalyseBaseLineCount(PHDFile phd, String nuclideName, Double energy) { double baseLineCount = 0; // 得到baseline count范围 - double fwhm = 0; List vBase = phd.getVBase(); - // fwhm公式参数 - ParameterInfo m_curParam = phd.getMapResoPara().get(phd.getUsedEner()); // 能量转化道址公式参数 List userEnerParaP = phd.getUsedEnerPara().getP(); - // 公式参数 - int p_size = m_curParam.getP().size()-1; - if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) { - fwhm = m_curParam.getP().get(1) + energy * m_curParam.getP().get(2); - for(int i=3; i<=p_size; i++) { - fwhm += (Math.pow(energy, (i-1)) * m_curParam.getP().get(i)); - } - fwhm = Math.pow(fwhm, 0.5); - } + // 计算半高宽 + // fwhm公式参数 + ParameterInfo m_curParam = phd.getMapResoPara().get(phd.getUsedReso()); + double fwhm = getFwhm(m_curParam, energy); // 通过energy带入到FHWM公式中,将结果energy转化channel,加减1.25之后取这个范围之内的baseline进行加和 List energyList = Lists.newLinkedList(); - energyList.add(energy - (fwhm - Math.pow(fwhm, 1.25))); + energyList.add(energy - (fwhm * 1.25)); // 使用gamma公式将能量转换为道址 CalValuesOut energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP); long begin = Math.round(energyToChannel.counts.get(0)); Console.log("nuclide:{},energy:{},fwhmL:{},beginChannel:{}",nuclideName, energy, (fwhm - Math.pow(fwhm, 1.25)), begin); energyList = Lists.newLinkedList(); - energyList.add(energy + (fwhm + Math.pow(fwhm, 1.25))); + energyList.add(energy + (fwhm * 1.25)); energyToChannel = CalValuesHandler.energyToChannel(energyList, userEnerParaP); long end = Math.round(energyToChannel.counts.get(0)); Console.log("nuclide:{},energy:{},fwhmR:{},endChannel:{}",nuclideName, energy, (fwhm + Math.pow(fwhm, 1.25)), end); @@ -954,6 +967,20 @@ public class SelfBaseUtil extends AbstractLogOrReport { return baseLineCount; } + public static Double getFwhm(ParameterInfo m_curParam, Double energy) { + Double fwhm = 0.0; + // 公式参数 + int p_size = m_curParam.getP().size()-1; + if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) { + fwhm = m_curParam.getP().get(1) + energy * m_curParam.getP().get(2); + for(int i=3; i<=p_size; i++) { + fwhm += (Math.pow(energy, (i-1)) * m_curParam.getP().get(i)); + } + fwhm = Math.pow(fwhm, 0.5); + } + return fwhm; + } + static StringBuilder reportContent = null; protected static EnergySpectrumStruct sampleStruct = null; protected static EnergySpectrumStruct qcStruct = null; diff --git a/setup/SelfParameter.xml b/setup/SelfParameter.xml index 886f5c8a..c8b2cfc8 100644 --- a/setup/SelfParameter.xml +++ b/setup/SelfParameter.xml @@ -1,8 +1,8 @@ - - + + \ No newline at end of file