fix: 增加自建台站qc刻度 重新分析 接口
This commit is contained in:
parent
42f94fbe76
commit
1419eaf562
|
@ -843,8 +843,8 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
// 半衰期
|
||||
nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString());
|
||||
// baseline 计数,这里使用的energy是固定的 从配置文件中取出
|
||||
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
|
||||
nuclideParam.put("lcConst", "2.33");
|
||||
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
|
||||
for (PeakInfo info : vPeak) {
|
||||
double energy = info.energy;
|
||||
// 找匹配roi范围的 energy
|
||||
|
|
|
@ -44,11 +44,10 @@ import java.util.stream.Collectors;
|
|||
@Component
|
||||
@Slf4j
|
||||
public class SelfStationUtil extends SelfBaseUtil {
|
||||
|
||||
@Autowired
|
||||
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 {
|
||||
EnergySpectrumStruct struct = null;
|
||||
if (systemType.equals("sample")) {
|
||||
|
@ -155,7 +154,7 @@ public class SelfStationUtil extends SelfBaseUtil {
|
|||
selfStationData.setRoiGBoundaryStop(bgBoundary.ROI_G_Boundary_stop);
|
||||
|
||||
//根据范围1划分 范围1对应的折线图
|
||||
Map<String, Object> gammaByROI = this.getGammaByROI(systemType, roiBBoundaryStart, roiBBoundaryStop, selfStationData);
|
||||
Map<String, Object> gammaByROI = getGammaByROI(systemType, roiBBoundaryStart, roiBBoundaryStop, selfStationData);
|
||||
map.putAll(gammaByROI);
|
||||
//统计散点图
|
||||
//横坐标 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.setRoiBBoundaryStart(roiBBoundaryStart);
|
||||
|
@ -651,30 +665,30 @@ public class SelfStationUtil extends SelfBaseUtil {
|
|||
* @param struct beta谱数据
|
||||
* @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
|
||||
String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD";
|
||||
// 创建Gamma文件
|
||||
this.createGammaFile(path, gammaOneName, struct, sampleVueData.getROIOneCounts());
|
||||
createGammaFile(path, gammaOneName, struct, sampleVueData.getROIOneCounts());
|
||||
|
||||
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";
|
||||
this.createGammaFile(path, gammaThreeName, struct, sampleVueData.getROIThreeCounts());
|
||||
createGammaFile(path, gammaThreeName, struct, sampleVueData.getROIThreeCounts());
|
||||
|
||||
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实体
|
||||
sampleVueData.setROIOneFileName(gammaOneName);
|
||||
sampleVueData.setROIOnePHDFile(this.createGammaPHD(struct, gammaOneName, path, sampleVueData.getROIOneCounts()));
|
||||
sampleVueData.setROIOnePHDFile(createGammaPHD(struct, gammaOneName, path, sampleVueData.getROIOneCounts()));
|
||||
sampleVueData.setROITwoFileName(gammaTwoName);
|
||||
sampleVueData.setROITwoPHDFile(this.createGammaPHD(struct, gammaTwoName, path, sampleVueData.getROITwoCounts()));
|
||||
sampleVueData.setROITwoPHDFile(createGammaPHD(struct, gammaTwoName, path, sampleVueData.getROITwoCounts()));
|
||||
sampleVueData.setROIThreeFileName(gammaThreeName);
|
||||
sampleVueData.setROIThreePHDFile(this.createGammaPHD(struct, gammaThreeName, path, sampleVueData.getROIThreeCounts()));
|
||||
sampleVueData.setROIThreePHDFile(createGammaPHD(struct, gammaThreeName, path, sampleVueData.getROIThreeCounts()));
|
||||
sampleVueData.setROIFourFileName(gammaFourName);
|
||||
sampleVueData.setROIFourPHDFile(this.createGammaPHD(struct, gammaFourName, path, sampleVueData.getROIFourCounts()));
|
||||
sampleVueData.setROIFourPHDFile(createGammaPHD(struct, gammaFourName, path, sampleVueData.getROIFourCounts()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
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.native_jni.CalValuesHandler;
|
||||
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.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.*;
|
||||
|
@ -4022,7 +4024,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
result.error500("Load basic file information first!");
|
||||
return result;
|
||||
}
|
||||
map = BetaGammaAnalyzeCurrentProcess(analyseData, betaDataFile);
|
||||
map = BetaGammaAnalyzeCurrentProcess(analyseData, userName, selfStationData);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
|
||||
|
@ -4034,19 +4036,19 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
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<String, Object> xeMap = new HashMap<>();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
try {
|
||||
//存储重新分析字段的实体类
|
||||
SpectrumGroup spectrum_group = new SpectrumGroup();
|
||||
//获取计算参数
|
||||
List<SeriseData> betaList = new LinkedList<>();
|
||||
List<String> betaFittingPara = new LinkedList<>();
|
||||
List<String> betaFittingParaToUi = new LinkedList<>();
|
||||
List<SeriseData> gammaList = new LinkedList<>();
|
||||
List<String> gammaFittingPara = new LinkedList<>();
|
||||
List<String> gammaFittingParaToUi = new LinkedList<>();
|
||||
|
||||
BetaDataFile betaDataFile = selfStationData.getBetaDataFile();
|
||||
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
|
||||
SelfStationVueData sampleVueData = selfStationData.getSampleVueData();
|
||||
|
||||
PHDFile phdOne = sampleVueData.getROIOnePHDFile();
|
||||
PHDFile phdTwo = sampleVueData.getROITwoPHDFile();
|
||||
PHDFile phdThree = sampleVueData.getROIThreePHDFile();
|
||||
PHDFile phdFour = sampleVueData.getROIFourPHDFile();
|
||||
//判断是否对beta页面进行过分析
|
||||
if (analyseData.isBetaEnergyValid()) {
|
||||
//如果进行过分析 则将当前beta用于分析的新的数据 赋值到最终使用的数组
|
||||
|
@ -4056,30 +4058,42 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
betaDataFile.setBetaFittingPara(betaDataFile.getBetaFittingParaNow());
|
||||
betaDataFile.setBetaFittingParaToUi(betaDataFile.getBetaFittingParaToUiNow());
|
||||
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页面进行过分析
|
||||
if (analyseData.isGammaEnergyValid()) {
|
||||
//如果缓存数据不为空 且对gamma进行了计算 将当前gamma的计算结果赋值到最终的结果数组 进行新的分析使用
|
||||
|
@ -4088,136 +4102,126 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
betaDataFile.setGammaFittingPara(betaDataFile.getGammaFittingParaNow());
|
||||
betaDataFile.setGammaFittingParaToUi(betaDataFile.getGammaFittingParaToUiNow());
|
||||
betaDataFile.setGammaNewEnergyList(betaDataFile.getGammaNewEnergyListNow());
|
||||
gammaList = betaDataFile.getGammaList();
|
||||
gammaFittingPara = betaDataFile.getGammaFittingPara();
|
||||
gammaFittingParaToUi = betaDataFile.getGammaFittingParaToUi();
|
||||
}
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(0)));
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(1)));
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
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());
|
||||
}
|
||||
|
||||
// 接收算法计算得到的公式的数据
|
||||
List<Double> fittingParas = betaDataFile.getGammaFittingParaNow().stream()
|
||||
.map(Double::parseDouble)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<Double> newEnergyList = EnergySpectrumHandler.GetFileFittingData(struct.g_centroid_channel, fittingParas);
|
||||
|
||||
this.updateGammaEnergy(newEnergyList, phdOne, phdTwo, phdThree, phdFour);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//判断是否勾选了sample
|
||||
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
|
||||
File sampleTmp = null;
|
||||
if (StringUtils.isNotBlank(betaDataFile.getSampleTmpPath())) {
|
||||
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||
// 获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
|
||||
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());
|
||||
|
||||
SelfStationVueData sampleData = selfStationData.getSampleVueData();
|
||||
// 获取自建台站参数
|
||||
SelfParameter selfParameter = (SelfParameter) redisUtil.get(RedisConstant.SELF_PARAMETER);
|
||||
HashMap<String, NuclideLine> nuclideMap = selfParameter.getNuclideMap();
|
||||
// 执行Beta分析
|
||||
List<GardsXeResultsSpectrum> betaResult = SelfBaseUtil.betaAnalyse(nuclideMap, struct.POI_G_y1,
|
||||
struct.POI_G_y2, selfStationData.getSampleTmpPath(), phdOne, phdTwo,
|
||||
phdThree, phdFour);
|
||||
resultMap.put("XeData", betaResult);
|
||||
|
||||
List<GardsXeResults> xeResults = Lists.newArrayList(betaResult);
|
||||
betaDataFile.setXeDataList(xeResults);
|
||||
betaDataFile.setXeResultsSpectrumList(betaResult);
|
||||
|
||||
betaDataFile.setRoiResultsSpectrumList(SelfBaseUtil.getRoiResult(betaResult));
|
||||
|
||||
//横坐标 beta-gamma
|
||||
long bChannels = struct.b_channels;
|
||||
//纵坐标 gamma
|
||||
long gChannels = struct.g_channels;
|
||||
//调用算法 传入道值和道值对应的能量 得到计算gamma能量公式的参数
|
||||
String currentText = phdOne.getUsedEner();
|
||||
List<Double> m_vCurCentroid = phdOne.getMapEnerKD().get(currentText).getCentroid_channel();
|
||||
List<Double> m_vCurEnergy = phdOne.getMapEnerKD().get(currentText).getG_energy();
|
||||
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(m_vCurCentroid, m_vCurEnergy);
|
||||
//存储需要计算gamma能量的道值
|
||||
List<Double> gchannels = new ArrayList<>();
|
||||
for (int i=0; i<gChannels; i++){
|
||||
gchannels.add(Double.valueOf(i));
|
||||
}
|
||||
|
||||
// 根据公式更新对应#energy道址数据 fix:20240918
|
||||
// CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam();
|
||||
// calcBgBoundaryParam.g_e_cal = spectrum_group.BgCalPara.g_e_cal;
|
||||
// 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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (Objects.nonNull(sampleTmp) && Objects.nonNull(gasTmp) && Objects.nonNull(detTmp)) {
|
||||
// //调用分析方法进行分析操作
|
||||
// boolean bRet = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, spectrum_group.BgCalPara, xeMap, betaDataFile);
|
||||
// if (analyseData.isQcData()) {
|
||||
// if (StringUtils.isNotBlank(betaDataFile.getQcFilePathName())) {
|
||||
// EnergySpectrumStruct struct = betaDataFile.getQcStruct();
|
||||
// if (Objects.nonNull(struct)) {
|
||||
// phdFileUtil.CalQCBoundary(betaList, gammaList, betaFittingParaToUi, gammaFittingParaToUi, struct, xeMap, betaDataFile);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (bRet) {
|
||||
// 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);
|
||||
// }
|
||||
// List<GardsXeResultsSpectrum> xeResultsSpectrumList = (List<GardsXeResultsSpectrum>) xeMap.get("XeData");
|
||||
// if (CollectionUtils.isNotEmpty(xeResultsSpectrumList)){
|
||||
// for (GardsXeResultsSpectrum xeData: xeResultsSpectrumList) {
|
||||
// Double conc = xeData.getConc();
|
||||
// Double mdc = xeData.getMdc();
|
||||
// if (conc < 0){
|
||||
// xeData.setColor("red");
|
||||
// xeData.setNidFlag(0);
|
||||
// } else if (0<conc && conc < mdc) {
|
||||
// xeData.setColor("#ffcc30");
|
||||
// xeData.setNidFlag(0);
|
||||
// } else if (conc > mdc) {
|
||||
// xeData.setColor("green");
|
||||
// xeData.setNidFlag(1);
|
||||
// }
|
||||
// xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc()))));
|
||||
// xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc()))));
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
//调用算法 传递gamma参与计算的道值以及计算公式参数 得到各道值对应的能量
|
||||
List<Double> gammaEnergyList = EnergySpectrumHandler.GetFileFittingData(gchannels, gammaParam);
|
||||
//将gamma能量折线图进行赋值返回
|
||||
resultMap.put("gammaEnergyData", gammaEnergyList);
|
||||
//调用算法 传入道值和道值对应的能量 得到计算beta能量公式的参数
|
||||
// todo beta canshu xuyao tiaozheng
|
||||
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(struct.b_channel, struct.b_electron_energy);
|
||||
List<Double> bchannels = new ArrayList<>();
|
||||
for (int i=0; i<bChannels; i++){
|
||||
bchannels.add(Double.valueOf(i));
|
||||
}
|
||||
//传入道值和计算公式的参数计算出各道值对应的beta能量
|
||||
List<Double> betaEnergyList = EnergySpectrumHandler.GetFileFittingData(bchannels, betaParam);
|
||||
//将beta能量折线图进行赋值返回
|
||||
resultMap.put("betaEnergyData", betaEnergyList);
|
||||
} catch (Exception e) {
|
||||
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){
|
||||
|
@ -4777,6 +4781,12 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
List<List<Double>> energyList = 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个值
|
||||
if ((CollectionUtils.isNotEmpty(tempPoints) && tempPoints.size() > 2 && Objects.nonNull(count) && tempPoints.size() != count)
|
||||
|| (Objects.isNull(paramA) || StringUtils.isBlank(String.valueOf(paramA)))
|
||||
|
@ -4793,8 +4803,9 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
fittingParaStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("CToE", fittingParaStr);
|
||||
|
||||
//填充道值数组的数据
|
||||
for (int i=0; i<512; i++) {
|
||||
for (int i = 0; i < channelLength; i++) {
|
||||
channels.add(Double.valueOf(i));
|
||||
}
|
||||
//计算道值的能量
|
||||
|
@ -4886,7 +4897,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
|||
map.put("tableWidgets", tableWidgets);
|
||||
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));
|
||||
}
|
||||
//根据道值和公式参数计算新的能量数据
|
||||
|
|
Loading…
Reference in New Issue
Block a user