feat:自建台站谱解析
This commit is contained in:
parent
dee89d28b5
commit
970d4f3027
|
@ -0,0 +1,24 @@
|
|||
package org.jeecg.modules.exception;
|
||||
|
||||
/**
|
||||
* C谱分析异常
|
||||
*/
|
||||
public class CAnalyseException extends AnalyseException{
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified detail message. The
|
||||
* cause is not initialized, and may subsequently be initialized by
|
||||
* a call to {@link #initCause}.
|
||||
*
|
||||
* @param message the detail message. The detail message is saved for
|
||||
* later retrieval by the {@link #getMessage()} method.
|
||||
*/
|
||||
public CAnalyseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CAnalyseException(String message, boolean isDuplicateKeyException) {
|
||||
super(message,isDuplicateKeyException);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ import org.jeecg.modules.base.enums.SpectrumType;
|
|||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.exception.AnalySpectrumException;
|
||||
import org.jeecg.modules.exception.CAnalyseException;
|
||||
import org.jeecg.modules.exception.GAnalyseException;
|
||||
import org.jeecg.modules.file.FileOperation;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
|
@ -139,7 +140,7 @@ public class Sample_C_Analysis {
|
|||
sampleData.getInputFileName().lastIndexOf((StringConstant.SLASH))+1);
|
||||
}
|
||||
|
||||
public void analysis() throws GAnalyseException, AnalySpectrumException{
|
||||
public void analysis() throws CAnalyseException, AnalySpectrumException{
|
||||
log.info("SelfStaion自动处理分析--Start");
|
||||
try {
|
||||
//获取PHD文件的路径以及文件名称信息
|
||||
|
@ -225,11 +226,11 @@ public class Sample_C_Analysis {
|
|||
e.printStackTrace();
|
||||
log.error("Sample_C_Analysis", e);
|
||||
if (e instanceof DuplicateKeyException) {
|
||||
throw new GAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"), true);
|
||||
throw new CAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"), true);
|
||||
} else if (e instanceof AnalySpectrumException) {
|
||||
throw new AnalySpectrumException(e.getMessage());
|
||||
} else {
|
||||
throw new GAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
throw new CAnalyseException("Sample Analyse Error at "+DateUtils.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
log.info("SelfStaion自动处理分析--End");
|
||||
|
@ -238,7 +239,7 @@ public class Sample_C_Analysis {
|
|||
/*
|
||||
* 根据自建台站样品谱生成4个Gamma谱
|
||||
* */
|
||||
private void create4PHD(){
|
||||
public void create4PHD(){
|
||||
// 计算边界值
|
||||
List<Double> gEnergy = sampleStruct.g_energy;
|
||||
List<Double> gCentroidChannel = sampleStruct.g_centroid_channel;
|
||||
|
@ -280,27 +281,38 @@ public class Sample_C_Analysis {
|
|||
|
||||
// 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD
|
||||
String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD";
|
||||
selfStationUtil.createGammaFile(sampleFilePath, gammaOneName, this.sampleStruct, roiOneCounts);
|
||||
selfStationUtil.createGammaFile(this.savePath(), gammaOneName, this.sampleStruct, roiOneCounts);
|
||||
|
||||
String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD";
|
||||
selfStationUtil.createGammaFile(sampleFilePath, gammaTwoName, this.sampleStruct, roiTwoCounts);
|
||||
selfStationUtil.createGammaFile(this.savePath(), gammaTwoName, this.sampleStruct, roiTwoCounts);
|
||||
|
||||
String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD";
|
||||
selfStationUtil.createGammaFile(sampleFilePath, gammaThreeName, this.sampleStruct, roiThreeCounts);
|
||||
selfStationUtil.createGammaFile(this.savePath(), gammaThreeName, this.sampleStruct, roiThreeCounts);
|
||||
|
||||
String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD";
|
||||
selfStationUtil.createGammaFile(sampleFilePath, gammaFourName, this.sampleStruct, roiFourCounts);
|
||||
selfStationUtil.createGammaFile(this.savePath(), gammaFourName, this.sampleStruct, roiFourCounts);
|
||||
// 将生成的GammaPHD文件转换为PHDFile对象
|
||||
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, sampleFilePath);
|
||||
this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, this.savePath());
|
||||
this.phdFile1.setRoiSuffix("_ROI_1");
|
||||
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, sampleFilePath);
|
||||
this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, this.savePath());
|
||||
this.phdFile2.setRoiSuffix("_ROI_2");
|
||||
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, sampleFilePath);
|
||||
this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, this.savePath());
|
||||
this.phdFile3.setRoiSuffix("_ROI_3");
|
||||
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, sampleFilePath);
|
||||
this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, this.savePath());
|
||||
this.phdFile4.setRoiSuffix("_ROI_4");
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取savefile全路径 不包含文件名
|
||||
* */
|
||||
public String savePath(){
|
||||
spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class);
|
||||
String rootPath = spectrumPathProperties.getRootPath();
|
||||
String saveFilePath = spectrumPathProperties.getSaveFilePath();
|
||||
String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath();
|
||||
return rootPath + saveFilePath + File.separator + saveRelativePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取计算MDC参数文件方法
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.common.util;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
|
@ -3178,8 +3179,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
boolean bRet=true;
|
||||
//标准名称规范化
|
||||
String dataType = fileAnlyse.getMsgInfo().getData_type();
|
||||
String systemType = fileAnlyse.getHeader().getSystem_type();
|
||||
String subDirSavePath = "";
|
||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(fileAnlyse.getHeader().getSystem_type());
|
||||
subDirSavePath+=nameStandUtil.GetSysTemSubdir(systemType);
|
||||
subDirSavePath+=nameStandUtil.GetDateTypeSubdir(dataType);
|
||||
Map<String, String> fileNames = nameStandUtil.NameStandard(fileAnlyse);
|
||||
String lcName = fileNames.get("lc");
|
||||
|
@ -3212,7 +3214,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
anylseBegin = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss");
|
||||
bRet = AnalyseSpectrum(fileAnlyse,nucline);
|
||||
if (bRet) {
|
||||
RunQC(fileAnlyse);
|
||||
if (!StrUtil.equals(systemType, SystemType.SELFSTATION.getType()))
|
||||
RunQC(fileAnlyse);
|
||||
fileAnlyse.setEfficiencyParam(fileAnlyse.getUsedEffiPara().getP());
|
||||
fileAnlyse.setEfficiencyEnergy(fileAnlyse.getUsedEffiKD().getG_energy());
|
||||
fileAnlyse.setEfficiencyCurRow(0);
|
||||
|
@ -3316,7 +3319,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
}
|
||||
|
||||
//gards_ calibration_pairs Efficiency
|
||||
middleData.calibration_pairs_sample_type = fileAnlyse.getHeader().getSystem_type();
|
||||
middleData.calibration_pairs_sample_type = systemType;
|
||||
if(fileAnlyse.getUsedEffiKD() != null && fileAnlyse.getUsedEffiKD().getG_energy().size() != 0) {
|
||||
middleData.calibration_pairs_EF_Caltype = CalType.EFFICIENCY_CAL.getType();
|
||||
middleData.calibration_pairs_EF_Input = fileAnlyse.getUsedEffi();
|
||||
|
@ -3390,7 +3393,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
// gards_ calibration 数据表
|
||||
//拼写刻度字符串
|
||||
//获取刻度描述字符串
|
||||
middleData.calibration_sample_type = fileAnlyse.getHeader().getSystem_type();
|
||||
middleData.calibration_sample_type = systemType;
|
||||
String coeffEnergy = "";
|
||||
String uncerEnergy = "";
|
||||
String funcDefEnergy = "";
|
||||
|
@ -3805,7 +3808,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
middleData.sample_stationID = fileAnlyse.getHeader().getSite_code();
|
||||
middleData.sample_detectID = fileAnlyse.getHeader().getDetector_code();
|
||||
middleData.sample_Geometry = fileAnlyse.getHeader().getSample_geometry();
|
||||
middleData.sample_Type = fileAnlyse.getHeader().getSystem_type();
|
||||
middleData.sample_Type = systemType;
|
||||
middleData.setting_specSetup = fileAnlyse.getUsedSetting();
|
||||
middleData.Collection_Station_Comments = StringUtils.isNotBlank(fileAnlyse.getOriTotalCmt())?fileAnlyse.getOriTotalCmt():"";
|
||||
middleData.NDC_Analysis_General_Comments = StringUtils.isNotBlank(fileAnlyse.getTotalCmt())?fileAnlyse.getTotalCmt():"";
|
||||
|
|
|
@ -46,7 +46,14 @@ public class SelfUtil {
|
|||
return counts;
|
||||
}
|
||||
|
||||
public void createGammaFile(String pathName, String fileName, EnergySpectrumStruct struct, List<Long> g_counts) {
|
||||
/**
|
||||
* 根据ROI卡出来的Gamma数据生成新的GammaPHD文件
|
||||
* @param pathName 文件存储路径
|
||||
* @param fileName GammaPHD名称
|
||||
* @param struct BetaPHD内容
|
||||
* @param g_counts ROI卡出来的Gamma数据
|
||||
*/
|
||||
public void createGammaFile(String pathName,String fileName, EnergySpectrumStruct struct, List<Long> g_counts) {
|
||||
File file = new File(pathName + "\\" + fileName);
|
||||
// 创建PrintWriter对象
|
||||
PrintWriter out = null;
|
||||
|
@ -59,7 +66,7 @@ public class SelfUtil {
|
|||
out.println("MSG_ID " + struct.msg_id + " " + struct.msg_type + "\n" + "DATA_TYPE " + struct.data_type);
|
||||
out.println("#Header 3");
|
||||
// 解析出的Gamma谱 系统类型暂时使用G
|
||||
out.println(struct.site_code + " " + struct.detector_code + " G " +
|
||||
out.println(struct.site_code + " " + struct.detector_code + " C " +
|
||||
struct.sample_geometry + " " + struct.spectrum_quantity);
|
||||
out.println(struct.sample_ref_id);
|
||||
out.println(struct.measurement_id + " " + struct.detector_bk_measurement_id + " 0");
|
||||
|
@ -89,9 +96,9 @@ public class SelfUtil {
|
|||
String str = g_counts.get(i).toString();
|
||||
if(i % 5 == 0) {
|
||||
if (i == 0) {
|
||||
out.printf(i+"");
|
||||
out.printf((i+1)+"");
|
||||
} else {
|
||||
out.printf("\n" + i );
|
||||
out.printf("\n" + (i+1) );
|
||||
}
|
||||
beforeStr = i+"";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user