fix:自建台站beta分析
This commit is contained in:
parent
356bd94a26
commit
5719c210ca
|
@ -27,8 +27,6 @@ public class CalValuesHandler {
|
||||||
|
|
||||||
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process);
|
public static native String analyseSpectrum(String phd, String mapLines, String phdFilePath, AnalysisProcess process);
|
||||||
|
|
||||||
public static native String selfBgAnalyse(String PHDPath, String param);
|
|
||||||
|
|
||||||
public static native String fitPeakFull(String phd, List<Integer> Af, List<Integer> Cf, List<Integer> Ff);
|
public static native String fitPeakFull(String phd, List<Integer> Af, List<Integer> Cf, List<Integer> Ff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,4 +84,5 @@ public class EnergySpectrumHandler {
|
||||||
|
|
||||||
public static native List<Double> GetFittingData(List<Double> data, String fitType, List<Double> fittingPara);
|
public static native List<Double> GetFittingData(List<Double> data, String fitType, List<Double> fittingPara);
|
||||||
|
|
||||||
|
public static native String selfBgAnalyse(String PHDPath, String param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,10 @@ public class GardsXeResultsSpectrum implements Serializable {
|
||||||
* 感兴趣区MDC
|
* 感兴趣区MDC
|
||||||
*/
|
*/
|
||||||
private Double mdc;
|
private Double mdc;
|
||||||
|
/**
|
||||||
|
* 感兴趣区MDC
|
||||||
|
*/
|
||||||
|
private Double mda;
|
||||||
/**
|
/**
|
||||||
* 感兴趣区LC
|
* 感兴趣区LC
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -487,7 +487,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
String detFilePath = path + StringPool.SLASH + detFileName;
|
String detFilePath = path + StringPool.SLASH + detFileName;
|
||||||
//返回结果map
|
//返回结果map
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//获取sample分析后的对象
|
//获取det分析后的对象
|
||||||
EnergySpectrumStruct struct = selfStationUtil.getSourceData(detFilePath, "det", selfStationData);
|
EnergySpectrumStruct struct = selfStationUtil.getSourceData(detFilePath, "det", selfStationData);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
selfStationData.setDetStruct(struct);
|
selfStationData.setDetStruct(struct);
|
||||||
|
@ -506,7 +506,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
String qcFilePath = path + StringPool.SLASH + qcFileName;
|
String qcFilePath = path + StringPool.SLASH + qcFileName;
|
||||||
//返回结果map
|
//返回结果map
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//获取sample分析后的对象
|
//获取QC分析后的对象
|
||||||
EnergySpectrumStruct struct = selfStationUtil.getSourceData(qcFilePath, "qc", selfStationData);
|
EnergySpectrumStruct struct = selfStationUtil.getSourceData(qcFilePath, "qc", selfStationData);
|
||||||
if (Objects.nonNull(struct)) {
|
if (Objects.nonNull(struct)) {
|
||||||
selfStationData.setQcStruct(struct);
|
selfStationData.setQcStruct(struct);
|
||||||
|
@ -2547,7 +2547,7 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
PHDFile phdFour = sampleVueData.getROIFourPHDFile();
|
PHDFile phdFour = sampleVueData.getROIFourPHDFile();
|
||||||
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phdOne.getHeader().getSystem_type()+"-self");
|
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+StringPool.DASH+phdOne.getHeader().getSystem_type()+"-self");
|
||||||
|
|
||||||
Map<String, Object> roiMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
boolean bROI1 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI1);
|
boolean bROI1 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI1);
|
||||||
boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2);
|
boolean bROI2 = selfStationUtil.checkROIRenew(sampleVueData, SelfStationConstant.ROI2);
|
||||||
|
@ -2564,20 +2564,17 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
}
|
}
|
||||||
// 如果参数修改 或者 修改某个ROI 只重新分析某个gamma
|
// 如果参数修改 或者 修改某个ROI 只重新分析某个gamma
|
||||||
if (flag != 0 || bROI1) {
|
if (flag != 0 || bROI1) {
|
||||||
roiMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, flag));
|
resultMap.put(SelfStationConstant.ROI1, this.gammaAnalyse(processKey, phdOne, nuclideLinesMap, colorMap, flag));
|
||||||
}
|
}
|
||||||
if (flag != 0 || bROI2) {
|
if (flag != 0 || bROI2) {
|
||||||
roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, flag));
|
resultMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, flag));
|
||||||
}
|
}
|
||||||
if (flag != 0 || bROI3) {
|
if (flag != 0 || bROI3) {
|
||||||
roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, flag));
|
resultMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, flag));
|
||||||
}
|
}
|
||||||
if (flag != 0 || bROI4) {
|
if (flag != 0 || bROI4) {
|
||||||
roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, flag));
|
resultMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, flag));
|
||||||
}
|
}
|
||||||
// roiMap.put(SelfStationConstant.ROI2, this.gammaAnalyse(processKey, phdTwo, nuclideLinesMap, colorMap, bROI2));
|
|
||||||
// roiMap.put(SelfStationConstant.ROI3, this.gammaAnalyse(processKey, phdThree, nuclideLinesMap, colorMap, bROI3));
|
|
||||||
// roiMap.put(SelfStationConstant.ROI4, this.gammaAnalyse(processKey, phdFour, nuclideLinesMap, colorMap, bROI4));
|
|
||||||
// 用于下次分析判断是否更新
|
// 用于下次分析判断是否更新
|
||||||
sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart());
|
sampleVueData.setUsedROIOneBetaStart(sampleVueData.getROIOneBetaStart());
|
||||||
sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop());
|
sampleVueData.setUsedROIOneBetaStop(sampleVueData.getROIOneBetaStop());
|
||||||
|
@ -2602,11 +2599,12 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
sampleVueData.setMapResoPara(phdOne.getMapResoPara());
|
sampleVueData.setMapResoPara(phdOne.getMapResoPara());
|
||||||
sampleVueData.setMapEffiPara(phdOne.getMapEffiPara());
|
sampleVueData.setMapEffiPara(phdOne.getMapEffiPara());
|
||||||
|
|
||||||
// todo 调用beta分析
|
// 调用beta分析
|
||||||
this.betaAnalyse(selfStationData.getSampleFilePathName(), selfStationData, nuclideLinesMap);
|
List<GardsXeResultsSpectrum> betaResult = this.betaAnalyse(selfStationData, nuclideLinesMap);
|
||||||
|
resultMap.put("XeData", betaResult);
|
||||||
|
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(roiMap);
|
result.setResult(resultMap);
|
||||||
selfStationData.setBAnalyed(true);
|
selfStationData.setBAnalyed(true);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.error("analyse error:", e);
|
Log.error("analyse error:", e);
|
||||||
|
@ -2617,10 +2615,16 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void betaAnalyse(String phdPath, SelfStationData selfStationData, Map<String, NuclideLines> nuclideLinesMap) throws JsonProcessingException {
|
/**
|
||||||
|
* beta分析
|
||||||
|
* @param selfStationData 自建台站缓存数据
|
||||||
|
* @param nuclideLinesMap 核素信息
|
||||||
|
* @throws JsonProcessingException
|
||||||
|
*/
|
||||||
|
private List<GardsXeResultsSpectrum> betaAnalyse(SelfStationData selfStationData, Map<String, NuclideLines> nuclideLinesMap) throws JsonProcessingException {
|
||||||
SelfStationVueData sampleData = selfStationData.getSampleVueData();
|
SelfStationVueData sampleData = selfStationData.getSampleVueData();
|
||||||
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
|
EnergySpectrumStruct struct = selfStationData.getSampleStruct();
|
||||||
|
String phdPath = selfStationData.getSampleFilePathName();
|
||||||
// 获取自建台站参数
|
// 获取自建台站参数
|
||||||
SelfParameter selfParameter = (SelfParameter) redisUtil.get(RedisConstant.SELF_PARAMETER);
|
SelfParameter selfParameter = (SelfParameter) redisUtil.get(RedisConstant.SELF_PARAMETER);
|
||||||
HashMap<String, NuclideLine> nuclideMap = selfParameter.getNuclideMap();
|
HashMap<String, NuclideLine> nuclideMap = selfParameter.getNuclideMap();
|
||||||
|
@ -2629,9 +2633,32 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
HashMap<String, Object> nuclideParam = this.getBetaAnalyseNuclideParam(sampleData, nuclideMap, struct.POI_G_y1, struct.POI_G_y2, nuclideLinesMap);
|
HashMap<String, Object> nuclideParam = this.getBetaAnalyseNuclideParam(sampleData, nuclideMap, struct.POI_G_y1, struct.POI_G_y2, nuclideLinesMap);
|
||||||
Console.log(JSON.toJSONString(nuclideParam));
|
Console.log(JSON.toJSONString(nuclideParam));
|
||||||
// 调用beta分析算法
|
// 调用beta分析算法
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
String resultStr = EnergySpectrumHandler.selfBgAnalyse(phdPath, JSON.toJSONString(nuclideParam));
|
||||||
String result = CalValuesHandler.selfBgAnalyse(phdPath, JSON.toJSONString(mapper.writeValueAsString(nuclideParam)));
|
List<GardsXeResultsSpectrum> xeDataList = new ArrayList<>();
|
||||||
Console.log(result);
|
if (StrUtil.isNotBlank(resultStr)) {
|
||||||
|
xeDataList = JSON.parseArray(resultStr,GardsXeResultsSpectrum.class);
|
||||||
|
xeDataList.forEach(GardsXeResultsSpectrum::getMdc);
|
||||||
|
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||||
|
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||||
|
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()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Console.log(resultStr);
|
||||||
|
return xeDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2701,8 +2728,14 @@ public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelf
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到 baseline计数
|
||||||
|
* @param sampleData 谱数据
|
||||||
|
* @param nuclideName 核素名称
|
||||||
|
* @param energy 能量
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private double getBetaAnalyseBaseLineCount(SelfStationVueData sampleData,String nuclideName, Double energy) {
|
private double getBetaAnalyseBaseLineCount(SelfStationVueData sampleData,String nuclideName, Double energy) {
|
||||||
HashMap<String, Object> nuclideParam = Maps.newHashMap();
|
|
||||||
double baseLineCount = 0;
|
double baseLineCount = 0;
|
||||||
String currentText = null;
|
String currentText = null;
|
||||||
List<Double> vBase = null;
|
List<Double> vBase = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user