fix: 增加自建台站qc刻度 重新分析 接口

This commit is contained in:
xiaoguangbin 2025-02-18 09:23:33 +08:00
parent 42f94fbe76
commit 1419eaf562
3 changed files with 199 additions and 174 deletions

View File

@ -843,8 +843,8 @@ public class SelfBaseUtil extends AbstractLogOrReport {
// 半衰期 // 半衰期
nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString()); nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString());
// baseline 计数这里使用的energy是固定的 从配置文件中取出 // baseline 计数这里使用的energy是固定的 从配置文件中取出
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
nuclideParam.put("lcConst", "2.33"); nuclideParam.put("lcConst", "2.33");
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
for (PeakInfo info : vPeak) { for (PeakInfo info : vPeak) {
double energy = info.energy; double energy = info.energy;
// 找匹配roi范围的 energy // 找匹配roi范围的 energy

View File

@ -44,11 +44,10 @@ import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
public class SelfStationUtil extends SelfBaseUtil { public class SelfStationUtil extends SelfBaseUtil {
@Autowired @Autowired
private FTPUtil ftpUtil; private FTPUtil ftpUtil;
public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, String systemType, Map<String, Object> map) { public static void loadFile(SelfStationData selfStationData, Integer sampleId, String status, String systemType, Map<String, Object> map) {
try { try {
EnergySpectrumStruct struct = null; EnergySpectrumStruct struct = null;
if (systemType.equals("sample")) { if (systemType.equals("sample")) {
@ -155,7 +154,7 @@ public class SelfStationUtil extends SelfBaseUtil {
selfStationData.setRoiGBoundaryStop(bgBoundary.ROI_G_Boundary_stop); selfStationData.setRoiGBoundaryStop(bgBoundary.ROI_G_Boundary_stop);
//根据范围1划分 范围1对应的折线图 //根据范围1划分 范围1对应的折线图
Map<String, Object> gammaByROI = this.getGammaByROI(systemType, roiBBoundaryStart, roiBBoundaryStop, selfStationData); Map<String, Object> gammaByROI = getGammaByROI(systemType, roiBBoundaryStart, roiBBoundaryStop, selfStationData);
map.putAll(gammaByROI); map.putAll(gammaByROI);
//统计散点图 //统计散点图
//横坐标 beta-gamma //横坐标 beta-gamma
@ -262,7 +261,22 @@ public class SelfStationUtil extends SelfBaseUtil {
} }
} }
public Map<String, Object> getGammaByROI(String systemType, List<Integer> roiBBoundaryStart, List<Integer> roiBBoundaryStop, public static BgBoundary getCalcBgBoundary(EnergySpectrumStruct struct, List<Double> gEnergy, List<Double> bEnergy) {
CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, struct.g_centroid_channel);
calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bEnergy, struct.b_channel);
calcBgBoundaryParam.b_energy = bEnergy;
calcBgBoundaryParam.b_channel = struct.b_channel;
calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
calcBgBoundaryParam.g_energy = gEnergy;
calcBgBoundaryParam.ROI_B_start_x1 = struct.POI_B_x1;
calcBgBoundaryParam.ROI_B_stop_x2 = struct.POI_B_x2;
calcBgBoundaryParam.ROI_G_start_y1 = struct.POI_G_y1;
calcBgBoundaryParam.ROI_G_stop_y2 = struct.POI_G_y2;
return EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam);
}
public static Map<String, Object> getGammaByROI(String systemType, List<Integer> roiBBoundaryStart, List<Integer> roiBBoundaryStop,
SelfStationData selfStationData) { SelfStationData selfStationData) {
selfStationData.setRoiBBoundaryStart(roiBBoundaryStart); selfStationData.setRoiBBoundaryStart(roiBBoundaryStart);
@ -651,30 +665,30 @@ public class SelfStationUtil extends SelfBaseUtil {
* @param struct beta谱数据 * @param struct beta谱数据
* @param sampleVueData 存储数据实体 * @param sampleVueData 存储数据实体
*/ */
public void createGamma(String path, String sampleFileName, EnergySpectrumStruct struct, SelfStationVueData sampleVueData){ public static void createGamma(String path, String sampleFileName, EnergySpectrumStruct struct, SelfStationVueData sampleVueData){
// 根据ROI生成四个Gamma谱文件, 文件命名为Beta名称后面_ROI_x.PHD // 根据ROI生成四个Gamma谱文件, 文件命名为Beta名称后面_ROI_x.PHD
String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD"; String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD";
// 创建Gamma文件 // 创建Gamma文件
this.createGammaFile(path, gammaOneName, struct, sampleVueData.getROIOneCounts()); createGammaFile(path, gammaOneName, struct, sampleVueData.getROIOneCounts());
String gammaTwoName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_2.PHD"; String gammaTwoName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_2.PHD";
this.createGammaFile(path, gammaTwoName, struct, sampleVueData.getROITwoCounts()); createGammaFile(path, gammaTwoName, struct, sampleVueData.getROITwoCounts());
String gammaThreeName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_3.PHD"; String gammaThreeName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_3.PHD";
this.createGammaFile(path, gammaThreeName, struct, sampleVueData.getROIThreeCounts()); createGammaFile(path, gammaThreeName, struct, sampleVueData.getROIThreeCounts());
String gammaFourName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_4.PHD"; String gammaFourName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_4.PHD";
this.createGammaFile(path, gammaFourName, struct, sampleVueData.getROIFourCounts()); createGammaFile(path, gammaFourName, struct, sampleVueData.getROIFourCounts());
// Gamma文件内容转换为PHD实体 // Gamma文件内容转换为PHD实体
sampleVueData.setROIOneFileName(gammaOneName); sampleVueData.setROIOneFileName(gammaOneName);
sampleVueData.setROIOnePHDFile(this.createGammaPHD(struct, gammaOneName, path, sampleVueData.getROIOneCounts())); sampleVueData.setROIOnePHDFile(createGammaPHD(struct, gammaOneName, path, sampleVueData.getROIOneCounts()));
sampleVueData.setROITwoFileName(gammaTwoName); sampleVueData.setROITwoFileName(gammaTwoName);
sampleVueData.setROITwoPHDFile(this.createGammaPHD(struct, gammaTwoName, path, sampleVueData.getROITwoCounts())); sampleVueData.setROITwoPHDFile(createGammaPHD(struct, gammaTwoName, path, sampleVueData.getROITwoCounts()));
sampleVueData.setROIThreeFileName(gammaThreeName); sampleVueData.setROIThreeFileName(gammaThreeName);
sampleVueData.setROIThreePHDFile(this.createGammaPHD(struct, gammaThreeName, path, sampleVueData.getROIThreeCounts())); sampleVueData.setROIThreePHDFile(createGammaPHD(struct, gammaThreeName, path, sampleVueData.getROIThreeCounts()));
sampleVueData.setROIFourFileName(gammaFourName); sampleVueData.setROIFourFileName(gammaFourName);
sampleVueData.setROIFourPHDFile(this.createGammaPHD(struct, gammaFourName, path, sampleVueData.getROIFourCounts())); sampleVueData.setROIFourPHDFile(createGammaPHD(struct, gammaFourName, path, sampleVueData.getROIFourCounts()));
} }
/** /**

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.service.impl; package org.jeecg.modules.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
@ -49,6 +50,7 @@ import org.jeecg.modules.exception.AnalyseException;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper; import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.native_jni.CalValuesHandler; import org.jeecg.modules.native_jni.CalValuesHandler;
import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.BgBoundary;
import org.jeecg.modules.native_jni.struct.CalValuesOut; import org.jeecg.modules.native_jni.struct.CalValuesOut;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.*; import org.jeecg.modules.service.*;
@ -4022,7 +4024,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
result.error500("Load basic file information first!"); result.error500("Load basic file information first!");
return result; return result;
} }
map = BetaGammaAnalyzeCurrentProcess(analyseData, betaDataFile); map = BetaGammaAnalyzeCurrentProcess(analyseData, userName, selfStationData);
result.setSuccess(true); result.setSuccess(true);
result.setResult(map); result.setResult(map);
} else if ("AllSpectrum".equals(analyseData.getApplyType())) { } else if ("AllSpectrum".equals(analyseData.getApplyType())) {
@ -4034,19 +4036,19 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
return result; return result;
} }
private Map<String, Object> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, BetaDataFile betaDataFile) { private Map<String, Object> BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, String userName, SelfStationData selfStationData) {
//声明一个map 缓存xeData计算后的结果 //声明一个map 缓存xeData计算后的结果
Map<String, Object> xeMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
try { try {
//存储重新分析字段的实体类
SpectrumGroup spectrum_group = new SpectrumGroup(); BetaDataFile betaDataFile = selfStationData.getBetaDataFile();
//获取计算参数 EnergySpectrumStruct struct = selfStationData.getSampleStruct();
List<SeriseData> betaList = new LinkedList<>(); SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
List<String> betaFittingPara = new LinkedList<>();
List<String> betaFittingParaToUi = new LinkedList<>(); PHDFile phdOne = sampleVueData.getROIOnePHDFile();
List<SeriseData> gammaList = new LinkedList<>(); PHDFile phdTwo = sampleVueData.getROITwoPHDFile();
List<String> gammaFittingPara = new LinkedList<>(); PHDFile phdThree = sampleVueData.getROIThreePHDFile();
List<String> gammaFittingParaToUi = new LinkedList<>(); PHDFile phdFour = sampleVueData.getROIFourPHDFile();
//判断是否对beta页面进行过分析 //判断是否对beta页面进行过分析
if (analyseData.isBetaEnergyValid()) { if (analyseData.isBetaEnergyValid()) {
//如果进行过分析 则将当前beta用于分析的新的数据 赋值到最终使用的数组 //如果进行过分析 则将当前beta用于分析的新的数据 赋值到最终使用的数组
@ -4056,30 +4058,42 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
betaDataFile.setBetaFittingPara(betaDataFile.getBetaFittingParaNow()); betaDataFile.setBetaFittingPara(betaDataFile.getBetaFittingParaNow());
betaDataFile.setBetaFittingParaToUi(betaDataFile.getBetaFittingParaToUiNow()); betaDataFile.setBetaFittingParaToUi(betaDataFile.getBetaFittingParaToUiNow());
betaDataFile.setBetaNewEnergyList(betaDataFile.getBetaNewEnergyListNow()); betaDataFile.setBetaNewEnergyList(betaDataFile.getBetaNewEnergyListNow());
//将新的数组封装到各自的数组中
betaList = betaDataFile.getBetaList();
betaFittingPara = betaDataFile.getBetaFittingPara();
betaFittingParaToUi = betaDataFile.getBetaFittingParaToUi();
}
//封装重新计算的数据
List<Double> beCal = new LinkedList<>();
beCal.add(Double.valueOf(betaFittingParaToUi.get(0)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(1)));
beCal.add(Double.valueOf(betaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.b_e_cal = beCal;
List<Double> bc2e = new LinkedList<>();
bc2e.add(Double.valueOf(betaFittingPara.get(0)));
bc2e.add(Double.valueOf(betaFittingPara.get(1)));
bc2e.add(Double.valueOf(betaFittingPara.get(2)));
spectrum_group.b_c2e = bc2e;
if (analyseData.isSampleData()) {
betaDataFile.setBBetaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaNewEnergyList())) {
betaDataFile.setSampleBetaEnergyList(betaDataFile.getBetaNewEnergyList());
xeMap.put("sampleBetaEnergyData", betaDataFile.getBetaNewEnergyList());
}
} }
// 接收算法计算得到的公式的数据
List<Double> fittingParas = betaDataFile.getBetaFittingParaNow().stream()
.map(Double::parseDouble)
.collect(Collectors.toList());
List<Double> newEnergyList = EnergySpectrumHandler.GetFileFittingData(struct.b_channel, fittingParas);
BgBoundary bgBoundary = SelfStationUtil.getCalcBgBoundary(struct, struct.g_energy, newEnergyList);
//根据范围1划分 范围1对应的折线图
Map<String, Object> gammaByROI = SelfStationUtil.getGammaByROI("sample",
bgBoundary.ROI_B_Boundary_start, bgBoundary.ROI_B_Boundary_stop, selfStationData);
SelfStationVueData sampleData = selfStationData.getSampleVueData();
String path = StrUtil.subBefore(selfStationData.getSampleTmpPath(), StringPool.SLASH, true);
String sampleFileName = selfStationData.getSampleFileName();
// SelfStationUtil.createGamma(path, sampleFileName, struct, sampleVueData);
String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD";
String gammaTwoName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_2.PHD";
String gammaThreeName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_3.PHD";
String gammaFourName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_4.PHD";
// Gamma文件内容转换为PHD实体
sampleVueData.setROIOneFileName(gammaOneName);
sampleVueData.setROIOnePHDFile(SelfStationUtil.createGammaPHD(struct, gammaOneName, path, sampleVueData.getROIOneCounts()));
sampleVueData.setROITwoFileName(gammaTwoName);
sampleVueData.setROITwoPHDFile(SelfStationUtil.createGammaPHD(struct, gammaTwoName, path, sampleVueData.getROITwoCounts()));
sampleVueData.setROIThreeFileName(gammaThreeName);
sampleVueData.setROIThreePHDFile(SelfStationUtil.createGammaPHD(struct, gammaThreeName, path, sampleVueData.getROIThreeCounts()));
sampleVueData.setROIFourFileName(gammaFourName);
sampleVueData.setROIFourPHDFile(SelfStationUtil.createGammaPHD(struct, gammaFourName, path, sampleVueData.getROIFourCounts()));
} }
phdOne = sampleVueData.getROIOnePHDFile();
phdTwo = sampleVueData.getROITwoPHDFile();
phdThree = sampleVueData.getROIThreePHDFile();
phdFour = sampleVueData.getROIFourPHDFile();
//判断是否对gamma页面进行过分析 //判断是否对gamma页面进行过分析
if (analyseData.isGammaEnergyValid()) { if (analyseData.isGammaEnergyValid()) {
//如果缓存数据不为空 且对gamma进行了计算 将当前gamma的计算结果赋值到最终的结果数组 进行新的分析使用 //如果缓存数据不为空 且对gamma进行了计算 将当前gamma的计算结果赋值到最终的结果数组 进行新的分析使用
@ -4088,136 +4102,126 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
betaDataFile.setGammaFittingPara(betaDataFile.getGammaFittingParaNow()); betaDataFile.setGammaFittingPara(betaDataFile.getGammaFittingParaNow());
betaDataFile.setGammaFittingParaToUi(betaDataFile.getGammaFittingParaToUiNow()); betaDataFile.setGammaFittingParaToUi(betaDataFile.getGammaFittingParaToUiNow());
betaDataFile.setGammaNewEnergyList(betaDataFile.getGammaNewEnergyListNow()); betaDataFile.setGammaNewEnergyList(betaDataFile.getGammaNewEnergyListNow());
gammaList = betaDataFile.getGammaList();
gammaFittingPara = betaDataFile.getGammaFittingPara(); // 接收算法计算得到的公式的数据
gammaFittingParaToUi = betaDataFile.getGammaFittingParaToUi(); List<Double> fittingParas = betaDataFile.getGammaFittingParaNow().stream()
} .map(Double::parseDouble)
List<Double> geCal = new LinkedList<>(); .collect(Collectors.toList());
geCal.add(Double.valueOf(gammaFittingParaToUi.get(0)));
geCal.add(Double.valueOf(gammaFittingParaToUi.get(1))); List<Double> newEnergyList = EnergySpectrumHandler.GetFileFittingData(struct.g_centroid_channel, fittingParas);
geCal.add(Double.valueOf(gammaFittingParaToUi.get(2)));
spectrum_group.BgCalPara.g_e_cal = geCal; this.updateGammaEnergy(newEnergyList, phdOne, phdTwo, phdThree, phdFour);
List<Double> gc2e = new LinkedList<>();
gc2e.add(Double.valueOf(gammaFittingPara.get(0)));
gc2e.add(Double.valueOf(gammaFittingPara.get(1)));
gc2e.add(Double.valueOf(gammaFittingPara.get(2)));
spectrum_group.g_c2e = gc2e;
if (analyseData.isSampleData()) {
betaDataFile.setBGammaEnergyValidSample(true);
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaNewEnergyList())) {
betaDataFile.setSampleGammaEnergyList(betaDataFile.getGammaNewEnergyList());
xeMap.put("sampleGammaEnergyData", betaDataFile.getGammaNewEnergyList());
}
}
}
//判断是否勾选了sample
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
File sampleTmp = null;
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
sampleTmp = new File(betaDataFile.getSampleTmpPath());
} }
// 根据公式更新对应#energy道址数据 fix:20240918 }
// CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam(); // 获取当前角色的颜色配置
// calcBgBoundaryParam.g_e_cal = spectrum_group.BgCalPara.g_e_cal; Map<String, String> colorMap = sysUserColorService.initColor(userName);
// calcBgBoundaryParam.b_e_cal = spectrum_group.BgCalPara.b_e_cal;
// calcBgBoundaryParam.b_energy = struct.b_electron_energy;
// calcBgBoundaryParam.b_channel = struct.b_channel;
// calcBgBoundaryParam.g_channel = struct.g_centroid_channel;
// calcBgBoundaryParam.g_energy = struct.g_energy;
// calcBgBoundaryParam.ROI_B_start_x1 = struct.POI_B_x1;
// calcBgBoundaryParam.ROI_B_stop_x2 = struct.POI_B_x2;
// calcBgBoundaryParam.ROI_G_start_y1 = struct.POI_G_y1;
// calcBgBoundaryParam.ROI_G_stop_y2 = struct.POI_G_y2;
// BgBoundary bgBoundary = EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam);
String redisKey = userName+StringPool.DASH+phdOne.getHeader().getSystem_type()+"-self";
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(redisKey);
// 执行分析
int flag = gammaFileUtil.AnalyseData(phdOne);
String processKey = "processKey";
resultMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, flag));
resultMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, flag));
resultMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, flag));
resultMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, flag));
// 用于下次分析判断是否更新
sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart());
sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop());
sampleVueData.setUsedROITwoBetaStart(sampleVueData.getROITwoBetaStart());
sampleVueData.setUsedROITwoBetaStop(sampleVueData.getROITwoBetaStop());
sampleVueData.setUsedROIThreeBetaStart(sampleVueData.getROIThreeBetaStart());
sampleVueData.setUsedROIThreeBetaStop(sampleVueData.getROIThreeBetaStop());
sampleVueData.setUsedROIFourBetaStart(sampleVueData.getROIFourBetaStart());
sampleVueData.setUsedROIFourBetaStop(sampleVueData.getROIFourBetaStop());
sampleVueData.setUsedEner(phdOne.getUsedEner());
sampleVueData.setUsedEnerKD(phdOne.getUsedEnerKD());
sampleVueData.setUsedEffiKD(phdOne.getUsedEffiKD());
sampleVueData.setUsedResoKD(phdOne.getUsedResoKD());
sampleVueData.setMapEnerKD(phdOne.getMapEnerKD());
sampleVueData.setMapResoKD(phdOne.getMapResoKD());
sampleVueData.setMapEffiKD(phdOne.getMapEffiKD());
sampleVueData.setUsedEnerPara(phdOne.getUsedEnerPara());
sampleVueData.setUsedEffiPara(phdOne.getUsedEffiPara());
sampleVueData.setUsedResoPara(phdOne.getUsedResoPara());
sampleVueData.setMapEnerPara(phdOne.getMapEnerPara());
sampleVueData.setMapResoPara(phdOne.getMapResoPara());
sampleVueData.setMapEffiPara(phdOne.getMapEffiPara());
// if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) { SelfStationVueData sampleData = selfStationData.getSampleVueData();
// //调用分析方法进行分析操作 // 获取自建台站参数
// boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, betaDataFile); SelfParameter selfParameter = (SelfParameter) redisUtil.get(RedisConstant.SELF_PARAMETER);
// if (analyseData.isQcData()) { HashMap<String, NuclideLine> nuclideMap = selfParameter.getNuclideMap();
// if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) { // 执行Beta分析
// EnergySpectrumStruct struct = betaDataFile.getQcStruct(); List<GardsXeResultsSpectrum> betaResult = SelfBaseUtil.betaAnalyse(nuclideMap, struct.POI_G_y1,
// if (Objects.nonNull(struct)) { struct.POI_G_y2, selfStationData.getSampleTmpPath(), phdOne, phdTwo,
// phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap, betaDataFile); phdThree, phdFour);
// } resultMap.put("XeData", betaResult);
// }
// } List<GardsXeResults> xeResults = Lists.newArrayList(betaResult);
// if (bRet) { betaDataFile.setXeDataList(xeResults);
// List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary"); betaDataFile.setXeResultsSpectrumList(betaResult);
// if(CollectionUtils.isNotEmpty(sampleBoundary)) {
// betaDataFile.setSampleBoundary(sampleBoundary); betaDataFile.setRoiResultsSpectrumList(SelfBaseUtil.getRoiResult(betaResult));
// }
// List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary"); //横坐标 beta-gamma
// if(CollectionUtils.isNotEmpty(gasBoundary)) { long bChannels = struct.b_channels;
// betaDataFile.setGasBoundary(gasBoundary); //纵坐标 gamma
// } long gChannels = struct.g_channels;
// List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary"); //调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数
// if(CollectionUtils.isNotEmpty(detBoundary)) { String currentText = phdOne.getUsedEner();
// betaDataFile.setDetBoundary(detBoundary); List<Double> m_vCurCentroid = phdOne.getMapEnerKD().get(currentText).getCentroid_channel();
// } List<Double> m_vCurEnergy = phdOne.getMapEnerKD().get(currentText).getG_energy();
// List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary"); List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(m_vCurCentroid, m_vCurEnergy);
// if(CollectionUtils.isNotEmpty(qcBoundary)) { //存储需要计算gamma能量的道值
// betaDataFile.setQcBoundary(qcBoundary); List<Double> gchannels = new ArrayList<>();
// } for (int i=0; i<gChannels; i++){
// List<GardsXeResultsSpectrum> xeResultsSpectrumList = (List<GardsXeResultsSpectrum>) xeMap.get("XeData"); gchannels.add(Double.valueOf(i));
// if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){ }
// for (GardsXeResultsSpectrum xeData: xeResultsSpectrumList) { //调用算法 传递gamma参与计算的道值以及计算公式参数 得到各道值对应的能量
// Double conc = xeData.getConc(); List<Double> gammaEnergyList = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
// Double mdc = xeData.getMdc(); //将gamma能量折线图进行赋值返回
// if (conc < 0){ resultMap.put("gammaEnergyData", gammaEnergyList);
// xeData.setColor("red"); //调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数
// xeData.setNidFlag(0); // todo beta canshu xuyao tiaozheng
// } else if (0<conc && conc < mdc) { List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(struct.b_channel, struct.b_electron_energy);
// xeData.setColor("#ffcc30"); List<Double> bchannels = new ArrayList<>();
// xeData.setNidFlag(0); for (int i=0; i<bChannels; i++){
// } else if (conc > mdc) { bchannels.add(Double.valueOf(i));
// xeData.setColor("green"); }
// xeData.setNidFlag(1); //传入道值和计算公式的参数计算出各道值对应的beta能量
// } List<Double> betaEnergyList = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
// xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc())))); //将beta能量折线图进行赋值返回
// xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc())))); resultMap.put("betaEnergyData", betaEnergyList);
// xeData.setConcErr(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConcErr()))));
// }
// betaDataFile.setXeResultsSpectrumList(xeResultsSpectrumList);
// betaDataFile.setBProcessed(true);
// betaDataFile.setSaveAnalysisResult(true);
// betaDataFile.setBgPara(spectrum_group.BgCalPara);
// }
// xeMap.put("bProcessed", true);
// xeMap.put("savedAnalysisResult", true);
// } else {
// List<Boundary> sampleBoundary = (List<Boundary>) xeMap.get("SampleBoundary");
// if(CollectionUtils.isNotEmpty(sampleBoundary)) {
// betaDataFile.setSampleBoundary(sampleBoundary);
// }
// List<Boundary> gasBoundary = (List<Boundary>) xeMap.get("GasBoundary");
// if(CollectionUtils.isNotEmpty(gasBoundary)) {
// betaDataFile.setGasBoundary(gasBoundary);
// }
// List<Boundary> detBoundary = (List<Boundary>) xeMap.get("DetBoundary");
// if(CollectionUtils.isNotEmpty(detBoundary)) {
// betaDataFile.setDetBoundary(detBoundary);
// }
// List<Boundary> qcBoundary = (List<Boundary>) xeMap.get("QCBoundary");
// if(CollectionUtils.isNotEmpty(qcBoundary)) {
// betaDataFile.setQcBoundary(qcBoundary);
// }
// betaDataFile.setBProcessed(false);
// betaDataFile.setSaveAnalysisResult(false);
// betaDataFile.setXeResultsSpectrumList(Collections.EMPTY_LIST);
// xeMap.put("XeData", Collections.EMPTY_LIST);
// xeMap.put("bProcessed", false);
// xeMap.put("savedAnalysisResult", false);
// }
// }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return xeMap; return resultMap;
}
private void updateGammaEnergy(List<Double> newEnergyList, PHDFile ...phdList) {
for (PHDFile phd : phdList) {
String curCalName = null;
if(phd.getMapEnerKD().containsKey("input")) {
List<String> list_cal = new ArrayList<>(phd.getMapEnerKD().keySet());
curCalName = "Input " + ((int) list_cal.stream().filter(item -> item.contains("Input")).count() + 1);
}
String currentText = "PHD";
GEnergyBlock beforeEnergyBlock = phd.getMapEnerKD().get(currentText);
ParameterInfo m_curParam = phd.getMapEnerPara().get(currentText);
// 录入最新的energy
GEnergyBlock gEnergyBlock = new GEnergyBlock();
BeanUtil.copyProperties(beforeEnergyBlock, gEnergyBlock);
gEnergyBlock.setG_energy(newEnergyList);
phd.getMapEnerKD().put(curCalName, gEnergyBlock);
phd.getMapEnerPara().put(curCalName, m_curParam);
}
} }
private Map<String, Object> BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName){ private Map<String, Object> BetaGammaAnalyzeAllProcess(AnalyseData analyseData, String userName, String currentFileName){
@ -4777,6 +4781,12 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
List<List<Double>> energyList = new LinkedList<>(); List<List<Double>> energyList = new LinkedList<>();
//记录计算结果转换成字符串后数据的数组 第二组公式 //记录计算结果转换成字符串后数据的数组 第二组公式
List<String> fittingParaToUiStr = new LinkedList<>(); List<String> fittingParaToUiStr = new LinkedList<>();
int channelLength = 0;
if (tabName.equalsIgnoreCase("gamma")) {
channelLength = (int) struct.num_g_channel;
} else {
channelLength = (int) struct.num_b_channel;
}
//tempPoint数组大小需要大于2个值 //tempPoint数组大小需要大于2个值
if ((CollectionUtils.isNotEmpty(tempPoints) && tempPoints.size() > 2 && Objects.nonNull(count) && tempPoints.size() != count) if ((CollectionUtils.isNotEmpty(tempPoints) && tempPoints.size() > 2 && Objects.nonNull(count) && tempPoints.size() != count)
|| (Objects.isNull(paramA) || StringUtils.isBlank(String.valueOf(paramA))) || (Objects.isNull(paramA) || StringUtils.isBlank(String.valueOf(paramA)))
@ -4793,8 +4803,9 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
fittingParaStr.add(String.valueOf(para)); fittingParaStr.add(String.valueOf(para));
} }
map.put("CToE", fittingParaStr); map.put("CToE", fittingParaStr);
//填充道值数组的数据 //填充道值数组的数据
for (int i=0; i<512; i++) { for (int i = 0; i < channelLength; i++) {
channels.add(Double.valueOf(i)); channels.add(Double.valueOf(i));
} }
//计算道值的能量 //计算道值的能量
@ -4886,7 +4897,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
map.put("tableWidgets", tableWidgets); map.put("tableWidgets", tableWidgets);
map.put("newScatterSeriesData", seriseDataList); map.put("newScatterSeriesData", seriseDataList);
//填充道值数组的数据 //填充道值数组的数据
for (int i=0; i< numBChannel -1; i++) { for (int i = 0; i< channelLength -1; i++) {
channels.add(Double.valueOf(i)); channels.add(Double.valueOf(i));
} }
//根据道值和公式参数计算新的能量数据 //根据道值和公式参数计算新的能量数据