Merge remote-tracking branch 'origin/mdc' into mdc
This commit is contained in:
commit
fe755c83ee
|
@ -256,6 +256,9 @@ public class FTPUtil {
|
|||
log.error("{},根目录切换失败",rootPath);
|
||||
return false;
|
||||
}
|
||||
if (path.contains(rootPath)) {
|
||||
path = path.substring(path.indexOf(rootPath) + rootPath.length());
|
||||
}
|
||||
String[] directories = path.split("/");
|
||||
for(String directory : directories){
|
||||
if(StringUtils.isEmpty(directory)){
|
||||
|
@ -263,7 +266,7 @@ public class FTPUtil {
|
|||
}
|
||||
if(!ftpClient.changeWorkingDirectory(directory)){
|
||||
if(!ftpClient.makeDirectory(directory)){
|
||||
log.error("{},目录创建失败",directory);
|
||||
log.error("{},目录创建失败",ftpClient.printWorkingDirectory()+StringPool.SLASH+directory);
|
||||
return false;
|
||||
}
|
||||
if(!ftpClient.changeWorkingDirectory(directory)){
|
||||
|
|
|
@ -331,6 +331,338 @@ public class PHDFileUtil extends AbstractLogOrReport {
|
|||
return map;
|
||||
}
|
||||
|
||||
public void updateBoundary(BetaDataFile betaDataFile, String type, List<GardsROIChannelsSpectrum> sampleRoiChannel, Map<String, Object> map) {
|
||||
List<Boundary> boundaryList = new LinkedList<>();
|
||||
for (int i=0; i<sampleRoiChannel.size(); i++){
|
||||
Boundary boundary = new Boundary();
|
||||
GardsROIChannelsSpectrum roiChannelsSpectrum = sampleRoiChannel.get(i);
|
||||
boundary.setMinX(roiChannelsSpectrum.getBChanStart());
|
||||
boundary.setMaxX(roiChannelsSpectrum.getBChanStop());
|
||||
boundary.setMinY(roiChannelsSpectrum.getGChanStart());
|
||||
boundary.setMaxY(roiChannelsSpectrum.getGChanStop());
|
||||
boundaryList.add(boundary);
|
||||
}
|
||||
map.put("Boundary", boundaryList);
|
||||
if (type.equalsIgnoreCase("sample")) {
|
||||
betaDataFile.setSampleBoundary(boundaryList);
|
||||
} else if (type.equalsIgnoreCase("gas")) {
|
||||
betaDataFile.setGasBoundary(boundaryList);
|
||||
} else if (type.equalsIgnoreCase("det")) {
|
||||
betaDataFile.setDetBoundary(boundaryList);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEnergyData(BetaDataFile betaDataFile, String type, List<GardsCalibrationPairsSpectrum> gammaCalibrationPairs, List<GardsCalibrationPairsSpectrum> betaCalibrationPairs, Map<String, Object> map) {
|
||||
List<Double> channels = new LinkedList<>();
|
||||
List<List<Double>> gammaNewEnergyList = new LinkedList<>();
|
||||
List<List<Double>> betaNewEnergyList = new LinkedList<>();
|
||||
//填充道值数组的数据
|
||||
for (int i=0; i<255; i++) {
|
||||
channels.add(Double.valueOf(i));
|
||||
}
|
||||
//过滤出Gamma对应的表单数据
|
||||
List<Double> gammaChannelList = gammaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> gammaEnergyList = gammaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//计算gamma对应的数据
|
||||
List<Double> gammaFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList);
|
||||
//计算道值的能量
|
||||
List<Double> gammaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,gammaFittingPara);
|
||||
//将新计算的能量封装到数组
|
||||
for (Double calEnergy:gammaEnergys) {
|
||||
List<Double> newEnergy = new LinkedList<>();
|
||||
newEnergy.add(calEnergy);
|
||||
gammaNewEnergyList.add(newEnergy);
|
||||
}
|
||||
map.put("gammaEnergyData", gammaNewEnergyList);
|
||||
|
||||
//过滤出Beta对应的表单数据
|
||||
List<Double> betaChannelList = betaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> betaEnergyList = betaCalibrationPairs.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//计算beta对应的数据
|
||||
List<Double> betaFittingPara = EnergySpectrumHandler.GetFileFittingPara(betaChannelList, betaEnergyList);
|
||||
|
||||
//计算道值的能量
|
||||
List<Double> betaEnergys = EnergySpectrumHandler.GetFileFittingData(channels,betaFittingPara);
|
||||
//将新计算的能量封装到数组
|
||||
for (Double calEnergy:betaEnergys) {
|
||||
List<Double> newEnergy = new LinkedList<>();
|
||||
newEnergy.add(calEnergy);
|
||||
betaNewEnergyList.add(newEnergy);
|
||||
}
|
||||
map.put("betaEnergyData", betaNewEnergyList);
|
||||
if (type.equalsIgnoreCase("sample")) {
|
||||
betaDataFile.setSampleGammaEnergyList(gammaNewEnergyList);
|
||||
betaDataFile.setSampleBetaEnergyList(betaNewEnergyList);
|
||||
} else if (type.equalsIgnoreCase("gas")) {
|
||||
betaDataFile.setGasGammaEnergyList(gammaNewEnergyList);
|
||||
betaDataFile.setGasBetaEnergyList(betaNewEnergyList);
|
||||
} else if (type.equalsIgnoreCase("det")) {
|
||||
betaDataFile.setDetGammaEnergyList(gammaNewEnergyList);
|
||||
betaDataFile.setDetBetaEnergyList(betaNewEnergyList);
|
||||
}
|
||||
}
|
||||
|
||||
public void createBgCalPara(BetaDataFile betaDataFile, List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList,List<GardsCalibrationSpectrum> betaCalibrationSpectrumList,
|
||||
List<GardsCalibrationPairsSpectrum> gammaCalibrationPairsList,List<GardsCalibrationPairsSpectrum> betaCalibrationPairsList) {
|
||||
SpectrumGroup spectrum_group = new SpectrumGroup();
|
||||
//我需要根据 calibration页面对应的数组 及 公式判断是否有勾选sample det gas 这四个文件的操作
|
||||
//gammaCalibrationSpectrumList存储的是gamma对应的公式数据
|
||||
//betaCalibrationSpectrumList存储的是beta对应的公式数据
|
||||
//gammaCalibrationPairsList存储的是gamma对应的表单数据
|
||||
//betaCalibrationPairsList存储的是beta对应的表单数据
|
||||
//根据数据类型过滤出sample对应的参数
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(betaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
List<GardsCalibrationSpectrum> sampleGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationSpectrum> sampleBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> sampleGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> sampleBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出sampleGamma对应的表单数据
|
||||
List<Double> gammaChannelList = sampleGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> gammaEnergyList = sampleGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//过滤出sampleBeta对应的表单数据
|
||||
List<Double> betaChannelList = sampleBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> betaEnergyList = sampleBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//获取文件中的表单数据
|
||||
EnergySpectrumStruct struct = betaDataFile.getSampleStruct();
|
||||
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||
List<Double> gEnergy = struct.g_energy;
|
||||
List<Double> bChannel = struct.b_channel;
|
||||
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||
//比较四组表单数据
|
||||
if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) {
|
||||
//将公式参数放入到重新计算的参数内
|
||||
List<Double> newFittingPara = EnergySpectrumHandler.GetFileFittingPara(gammaChannelList, gammaEnergyList);
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList);
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(sampleGammaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> gc2e = new LinkedList<>();
|
||||
gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff1()));
|
||||
gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff2()));
|
||||
gc2e.add(Double.valueOf(sampleGammaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.g_c2e = gc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<gammaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(gammaChannelList.get(i));
|
||||
seriseData.setY(gammaEnergyList.get(i));
|
||||
betaDataFile.getGammaList().add(seriseData);
|
||||
}
|
||||
//将sample的重新计算标识标为true
|
||||
spectrum_group.BgCalPara.bApplyNewCalicSample = true;
|
||||
betaDataFile.setBGammaEnergyValidSample(true);
|
||||
betaDataFile.setGammaFittingPara(fittingPara);
|
||||
}
|
||||
if ( !betaChannelList.equals(bChannel) || !betaEnergyList.equals(bElectronEnergy) ) {
|
||||
//将公式参数放入到重新计算的参数内
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList);
|
||||
List<Double> beCal = new LinkedList<>();
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(sampleBetaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> bc2e = new LinkedList<>();
|
||||
bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff1()));
|
||||
bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff2()));
|
||||
bc2e.add(Double.valueOf(sampleBetaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.b_c2e = bc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<betaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(betaChannelList.get(i));
|
||||
seriseData.setY(betaEnergyList.get(i));
|
||||
betaDataFile.getBetaList().add(seriseData);
|
||||
}
|
||||
//将sample的重新计算标识标为true
|
||||
spectrum_group.BgCalPara.bApplyNewCalicSample = true;
|
||||
betaDataFile.setBBetaEnergyValidSample(true);
|
||||
betaDataFile.setBetaFittingPara(fittingPara);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(betaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
//根据数据类型过滤出gas对应的参数
|
||||
List<GardsCalibrationSpectrum> gasGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationSpectrum> gasBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> gasGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> gasBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出gasGamma对应的表单数据
|
||||
List<Double> gammaChannelList = gasGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> gammaEnergyList = gasGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//过滤出gasBeta对应的表单数据
|
||||
List<Double> betaChannelList = gasBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> betaEnergyList = gasBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//获取文件中的表单数据
|
||||
EnergySpectrumStruct struct = betaDataFile.getGasStruct();
|
||||
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||
List<Double> gEnergy = struct.g_energy;
|
||||
List<Double> bChannel = struct.b_channel;
|
||||
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||
//比较gamma部分表单数据
|
||||
if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) {
|
||||
//将公式参数放入到重新计算的参数内
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList);
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(gasGammaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> gc2e = new LinkedList<>();
|
||||
gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff1()));
|
||||
gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff2()));
|
||||
gc2e.add(Double.valueOf(gasGammaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.g_c2e = gc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<gammaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(gammaChannelList.get(i));
|
||||
seriseData.setY(gammaEnergyList.get(i));
|
||||
betaDataFile.getGammaList().add(seriseData);
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicGasBg = true;
|
||||
betaDataFile.setBGammaEnergyValidGas(true);
|
||||
betaDataFile.setGammaFittingPara(fittingPara);
|
||||
}
|
||||
//比较beta部分表单数据
|
||||
if ( !betaChannelList.equals(bChannel) || !betaEnergyList.equals(bElectronEnergy) ) {
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList);
|
||||
List<Double> beCal = new LinkedList<>();
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(gasBetaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> bc2e = new LinkedList<>();
|
||||
bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff1()));
|
||||
bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff2()));
|
||||
bc2e.add(Double.valueOf(gasBetaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.b_c2e = bc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<betaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(betaChannelList.get(i));
|
||||
seriseData.setY(betaEnergyList.get(i));
|
||||
betaDataFile.getBetaList().add(seriseData);
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicGasBg = true;
|
||||
betaDataFile.setBBetaEnergyValidGas(true);
|
||||
betaDataFile.setBetaFittingPara(fittingPara);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(betaCalibrationSpectrumList) && CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
//根据参数类型过滤出det对应的参数
|
||||
List<GardsCalibrationSpectrum> detGammaCalibrationList = gammaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationSpectrum> detBetaCalibrationList = betaCalibrationSpectrumList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> detGammaCalibrationPairsList = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
List<GardsCalibrationPairsSpectrum> detBetaCalibrationPairsList = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equals(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出gasGamma对应的表单数据
|
||||
List<Double> gammaChannelList = detGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> gammaEnergyList = detGammaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//过滤出gasBeta对应的表单数据
|
||||
List<Double> betaChannelList = detBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getXValue).collect(Collectors.toList());
|
||||
List<Double> betaEnergyList = detBetaCalibrationPairsList.stream().map(GardsCalibrationPairsSpectrum::getYValue).collect(Collectors.toList());
|
||||
//获取文件中的表单数据
|
||||
EnergySpectrumStruct struct = betaDataFile.getDetStruct();
|
||||
List<Double> gCentroidChannel = struct.g_centroid_channel;
|
||||
List<Double> gEnergy = struct.g_energy;
|
||||
List<Double> bChannel = struct.b_channel;
|
||||
List<Double> bElectronEnergy = struct.b_electron_energy;
|
||||
//比较四组表单数据
|
||||
if ( !gammaChannelList.equals(gCentroidChannel) || !gammaEnergyList.equals(gEnergy) ) {
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gammaEnergyList, gammaChannelList);
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
geCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(detGammaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> gc2e = new LinkedList<>();
|
||||
gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff1()));
|
||||
gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff2()));
|
||||
gc2e.add(Double.valueOf(detGammaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.g_c2e = gc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<gammaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(gammaChannelList.get(i));
|
||||
seriseData.setY(gammaEnergyList.get(i));
|
||||
betaDataFile.getGammaList().add(seriseData);
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicDetBg = true;
|
||||
betaDataFile.setBGammaEnergyValidDet(true);
|
||||
betaDataFile.setGammaFittingPara(fittingPara);
|
||||
}
|
||||
if ( !betaChannelList.equals(bChannel) || !betaEnergyList.equals(bElectronEnergy) ) {
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(betaEnergyList, betaChannelList);
|
||||
//将公式参数放入到重新计算的参数内
|
||||
List<Double> beCal = new LinkedList<>();
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(0)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(1)));
|
||||
beCal.add(Double.valueOf(newFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
//公式C TO E参数
|
||||
List<String> fittingPara = new LinkedList<>();
|
||||
fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff1()));
|
||||
fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff2()));
|
||||
fittingPara.add(String.valueOf(detBetaCalibrationList.get(0).getCoeff3()));
|
||||
|
||||
List<Double> bc2e = new LinkedList<>();
|
||||
bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff1()));
|
||||
bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff2()));
|
||||
bc2e.add(Double.valueOf(detBetaCalibrationList.get(0).getCoeff3()));
|
||||
spectrum_group.b_c2e = bc2e;
|
||||
//将新的道值对应能量值参数存储
|
||||
for (int i=0; i<betaChannelList.size(); i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(betaChannelList.get(i));
|
||||
seriseData.setY(betaEnergyList.get(i));
|
||||
betaDataFile.getBetaList().add(seriseData);
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicDetBg = true;
|
||||
betaDataFile.setBBetaEnergyValidDet(true);
|
||||
betaDataFile.setBetaFittingPara(fittingPara);
|
||||
}
|
||||
}
|
||||
if (spectrum_group.BgCalPara.bApplyNewCalicSample || spectrum_group.BgCalPara.bApplyNewCalicGasBg || spectrum_group.BgCalPara.bApplyNewCalicDetBg) {
|
||||
betaDataFile.setBgPara(spectrum_group.BgCalPara);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> readLine(String filePath) {
|
||||
List<String> allLines = new ArrayList<>();
|
||||
try {
|
||||
|
|
|
@ -86,11 +86,11 @@ public interface SpectrumAnalysisMapper {
|
|||
|
||||
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
List<GardsCalibrationPairsSpectrum> ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> ReadGammaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationPairsSpectrum> ReadBetaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis, @Param(value = "sampleId") Integer sampleId);
|
||||
List<GardsCalibrationPairsSpectrum> ReadBetaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
List<GardsCalibrationSpectrum> ReadBetaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis);
|
||||
|
||||
|
|
|
@ -619,7 +619,6 @@
|
|||
CALIBRATION_PAIRS.SAMPLE_ID = SMAPLE_DATA.SAMPLE_ID
|
||||
AND CALIBRATION_PAIRS.SAMPLE_TYPE = 'G'
|
||||
AND CALIBRATION_PAIRS.IDANALYSIS = #{idAnalysis}
|
||||
AND CALIBRATION_PAIRS.SAMPLE_ID = #{sampleId}
|
||||
ORDER BY CALIBRATION_PAIRS.IDCALPOINT ASC
|
||||
</select>
|
||||
|
||||
|
@ -651,7 +650,6 @@
|
|||
CALIBRATION_PAIRS.SAMPLE_ID = SMAPLE_DATA.SAMPLE_ID
|
||||
AND CALIBRATION_PAIRS.SAMPLE_TYPE = 'B'
|
||||
AND CALIBRATION_PAIRS.IDANALYSIS = #{idAnalysis}
|
||||
AND CALIBRATION_PAIRS.SAMPLE_ID = #{sampleId}
|
||||
ORDER BY CALIBRATION_PAIRS.IDCALPOINT ASC
|
||||
</select>
|
||||
|
||||
|
|
|
@ -5001,8 +5001,16 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
//格式化名称
|
||||
Map<String, String> nameMap = nameStandUtil.NameStandard(phd);
|
||||
String mSaveFileName = nameMap.get("saveFile");
|
||||
String dateTimeSubdir = "";
|
||||
int pos = mSaveFileName.indexOf('-');
|
||||
if(-1 == pos) {
|
||||
|
||||
} else if(fileName.length() >= pos+7) {
|
||||
dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+1,pos+5);
|
||||
dateTimeSubdir+=StringPool.SLASH+fileName.substring(pos+5,pos+7);
|
||||
}
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + StringPool.SLASH + mSaveFileName, userName);
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sysTemSubdir+ dateTypeSubdir + dateTimeSubdir + StringPool.SLASH + mSaveFileName, userName);
|
||||
// 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员
|
||||
if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) {
|
||||
result.error500("You have no permission to save "+phd.getHeader().getSite_code()+" results to DB!");
|
||||
|
|
|
@ -459,8 +459,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
roiChannelsSpectrumList = spectrumAnalysisMapper.ReadROIChannels("RNAUTO", analysisID, sampleId);
|
||||
roiResultsSpectrumList = spectrumAnalysisMapper.ReadROIResults("RNAUTO", analysisID, sampleId);
|
||||
} else {
|
||||
gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID, sampleId);
|
||||
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID, sampleId);
|
||||
gammaCalibrationPairsList = spectrumAnalysisMapper.ReadGammaFitChannelEnergy(analysisID);
|
||||
betaCalibrationPairsList = spectrumAnalysisMapper.ReadBetaFitChannelEnergy(analysisID);
|
||||
xeResultsSpectrumList = spectrumAnalysisMapper.ReadXeResults(dbName, analysisID, sampleId);
|
||||
gammaCalibrationSpectrumList = spectrumAnalysisMapper.ReadGammaCalibrationParam("RNMAN", analysisID);
|
||||
betaCalibrationSpectrumList = spectrumAnalysisMapper.ReadBetaCalibrationParam("RNMAN", analysisID);
|
||||
|
@ -475,10 +475,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
betaDataFile.setSampleFileName(sampleFileName);
|
||||
sampleTmp = ftpUtil.downloadFile(betaDataFile.getSampleFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(sampleTmp)) {
|
||||
//sample临时文件路径存储
|
||||
betaDataFile.setSampleTmpPath(sampleTmp.getAbsolutePath());
|
||||
//获取smaple文件解析结果
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||
betaDataFile.setSampleStruct(struct);
|
||||
//处理解析结果
|
||||
sampleMap = phdFileUtil.getSourceData(struct, sample.getSampleId(), sample.getStatus(), "sample", betaDataFile);
|
||||
//更新边界值
|
||||
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) {
|
||||
//将数据库的roi范围重新赋值
|
||||
List<GardsROIChannelsSpectrum> sampleRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(sampleRoiChannel)) {
|
||||
//更新边界值
|
||||
phdFileUtil.updateBoundary(betaDataFile, "sample", sampleRoiChannel, sampleMap);
|
||||
}
|
||||
}
|
||||
//更新gamma道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
//过滤出sample的gamma的参数
|
||||
List<GardsCalibrationPairsSpectrum> sampleGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出sample的beta的参数
|
||||
List<GardsCalibrationPairsSpectrum> sampleBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.SAMPLEPHD.getType())).collect(Collectors.toList());
|
||||
//更新道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(sampleGammaCalibrationPairs) && CollectionUtils.isNotEmpty(sampleBetaCalibrationPairs)) {
|
||||
phdFileUtil.updateEnergyData(betaDataFile, "sample", sampleGammaCalibrationPairs, sampleBetaCalibrationPairs, sampleMap);
|
||||
}
|
||||
}
|
||||
sampleMap.put("fileName", betaDataFile.getSampleFileName());
|
||||
resultMap.put("sample",sampleMap);
|
||||
}
|
||||
|
@ -489,10 +512,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
betaDataFile.setGasFileName(gasFileName);
|
||||
gasTmp = ftpUtil.downloadFile(betaDataFile.getGasFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(gasTmp)) {
|
||||
//存储gas临时文件路径
|
||||
betaDataFile.setGasTmpPath(gasTmp.getAbsolutePath());
|
||||
//获取gas文件解析结果
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||
betaDataFile.setGasStruct(struct);
|
||||
//处理gas文件解析结果
|
||||
gasBgMap = phdFileUtil.getSourceData(struct, gasBg.getSampleId(), gasBg.getStatus(), "gas", betaDataFile);
|
||||
//更新边界值
|
||||
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) {
|
||||
//将数据库的roi范围重新赋值
|
||||
List<GardsROIChannelsSpectrum> gasRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(gasRoiChannel)) {
|
||||
//更新边界值
|
||||
phdFileUtil.updateBoundary(betaDataFile, "gas", gasRoiChannel, gasBgMap);
|
||||
}
|
||||
}
|
||||
//更新gamma道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
//过滤出sample的gamma的参数
|
||||
List<GardsCalibrationPairsSpectrum> gasGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出sample的beta的参数
|
||||
List<GardsCalibrationPairsSpectrum> gasBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.GASBKPHD.getType())).collect(Collectors.toList());
|
||||
//更新道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(gasGammaCalibrationPairs) && CollectionUtils.isNotEmpty(gasBetaCalibrationPairs)) {
|
||||
phdFileUtil.updateEnergyData(betaDataFile, "gas", gasGammaCalibrationPairs, gasBetaCalibrationPairs, gasBgMap);
|
||||
}
|
||||
}
|
||||
gasBgMap.put("fileName", betaDataFile.getGasFileName());
|
||||
resultMap.put("gasBg",gasBgMap);
|
||||
}
|
||||
|
@ -503,10 +549,33 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
betaDataFile.setDetFileName(detFileName);
|
||||
detTmp = ftpUtil.downloadFile(betaDataFile.getDetFilePathName(), "betaGamma");
|
||||
if (Objects.nonNull(detTmp)) {
|
||||
//存储det临时文件路径
|
||||
betaDataFile.setDetTmpPath(detTmp.getAbsolutePath());
|
||||
//获取det文件解析结果
|
||||
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||
betaDataFile.setDetStruct(struct);
|
||||
//处理det文件解析结果
|
||||
detBgMap = phdFileUtil.getSourceData(struct, detBg.getSampleId(), detBg.getStatus(), "det", betaDataFile);
|
||||
//更新边界值
|
||||
if (CollectionUtils.isNotEmpty(roiChannelsSpectrumList)) {
|
||||
//将数据库的roi范围重新赋值
|
||||
List<GardsROIChannelsSpectrum> detRoiChannel = roiChannelsSpectrumList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(detRoiChannel)) {
|
||||
//更新边界值
|
||||
phdFileUtil.updateBoundary(betaDataFile, "det", detRoiChannel, detBgMap);
|
||||
}
|
||||
}
|
||||
//更新gamma道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(gammaCalibrationPairsList) && CollectionUtils.isNotEmpty(betaCalibrationPairsList)) {
|
||||
//过滤出sample的gamma的参数
|
||||
List<GardsCalibrationPairsSpectrum> detGammaCalibrationPairs = gammaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
//过滤出sample的beta的参数
|
||||
List<GardsCalibrationPairsSpectrum> detBetaCalibrationPairs = betaCalibrationPairsList.stream().filter(item -> item.getDataType().equalsIgnoreCase(DataTypeAbbr.DETBKPHD.getType())).collect(Collectors.toList());
|
||||
//更新道值-能量折线图
|
||||
if (CollectionUtils.isNotEmpty(detGammaCalibrationPairs) && CollectionUtils.isNotEmpty(detBetaCalibrationPairs)) {
|
||||
phdFileUtil.updateEnergyData(betaDataFile, "det", detGammaCalibrationPairs, detBetaCalibrationPairs, detBgMap);
|
||||
}
|
||||
}
|
||||
detBgMap.put("fileName", betaDataFile.getDetFileName());
|
||||
resultMap.put("detBg",detBgMap);
|
||||
}
|
||||
|
@ -525,6 +594,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
resultMap.put("qc",qcMap);
|
||||
}
|
||||
}
|
||||
//更新缓存数据对应的缓存数据
|
||||
phdFileUtil.createBgCalPara(betaDataFile, gammaCalibrationSpectrumList, betaCalibrationSpectrumList, gammaCalibrationPairsList, betaCalibrationPairsList);
|
||||
} else {
|
||||
xeResultsSpectrumList = betaDataFile.getXeResultsSpectrumList();
|
||||
sampleMap = loadData("sample", betaDataFile);
|
||||
|
@ -549,13 +620,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
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()))));
|
||||
|
@ -679,13 +747,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
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()))));
|
||||
|
@ -1775,6 +1840,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
//获取qc的分析结果数据
|
||||
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
|
||||
//判断qc文件的解析结果是否为空
|
||||
if (Objects.nonNull(struct)){
|
||||
//读取Gamma Detector Calibration所需要的参数
|
||||
long numGChannel = struct.num_g_channel;
|
||||
|
@ -1783,7 +1849,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
int gRecordCount = struct.g_record_count;
|
||||
List<Long> gCounts = struct.g_counts;
|
||||
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||
//计算Calibration Parameter Of Gamma Detector
|
||||
//根据道值和能量的对应关系 存储表单数据
|
||||
List<SeriseData> oldScatterSeries = new LinkedList<>();
|
||||
for (int i=0; i<gRecordCount; i++) {
|
||||
SeriseData temp = new SeriseData();
|
||||
|
@ -1794,7 +1860,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
oldScatterSeries.add(temp);
|
||||
}
|
||||
map.put("oldScatterSeries", oldScatterSeries);
|
||||
//C to E
|
||||
//计算C to E公式参数
|
||||
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||
List<String> fittingParaStr = new LinkedList<>();
|
||||
for (Double para:fittingPara) {
|
||||
|
@ -1805,7 +1871,9 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
for (int i=0; i<255; ++i) {
|
||||
channel.add(Double.valueOf(i));
|
||||
}
|
||||
//计算出新的道值对应能量值
|
||||
List<Double> energy = EnergySpectrumHandler.GetFileFittingData(channel, fittingPara);
|
||||
//根据道值和能量对应关系 封装折线图数据
|
||||
List<SeriseData> oldLineSeries = new LinkedList<>();
|
||||
for (int i=0; i<channel.size(); i++) {
|
||||
SeriseData tmp = new SeriseData();
|
||||
|
@ -1814,14 +1882,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
oldLineSeries.add(tmp);
|
||||
}
|
||||
map.put("oldLineSeries", oldLineSeries);
|
||||
//E to C
|
||||
//计算E to C公式参数
|
||||
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
|
||||
List<String> fittingParaToUiStr = new LinkedList<>();
|
||||
for (Double para:fittingParaToUi) {
|
||||
fittingParaToUiStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("EToC", fittingParaToUiStr);
|
||||
//Figure of Gamma Detector Calibration
|
||||
//计算道值对应能量值参数
|
||||
List<Double> gchannels = new ArrayList<>();
|
||||
List<List<Double>> gammaEnergyList = new LinkedList<>();
|
||||
for (int i=0; i<numGChannel; i++){
|
||||
|
@ -1860,6 +1928,97 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
map.put("min", min);
|
||||
map.put("max", max);
|
||||
map.put("gammaSpectrum", seriseDataList);
|
||||
|
||||
//判断人工交互的道值与能量对应参数数组是否为空
|
||||
if (CollectionUtils.isNotEmpty(betaDataFile.getGammaList())) {
|
||||
//存储计算参数道值
|
||||
List<Double> xs = new LinkedList();
|
||||
//存储计算参数能量值
|
||||
List<Double> ys = new LinkedList<>();
|
||||
//存储所有道值
|
||||
List<Double> channels = new LinkedList<>();
|
||||
//存储所有的能量值
|
||||
List<List<Double>> energyList = new LinkedList<>();
|
||||
//存储新的线点能量值
|
||||
List<SeriseData> newLineSeries = new LinkedList<>();
|
||||
//存储新的表单能量值
|
||||
List<TableWidget> tableWidgets = new LinkedList();
|
||||
//存储新的公式参数C TO E
|
||||
List<String> newFittingParaStr = new LinkedList<>();
|
||||
//存储新的公式参数E TO C
|
||||
List<String> newFittingParaToUiStr = new LinkedList<>();
|
||||
//记录点值数组
|
||||
List<SeriseData> newSeriseDataList = new LinkedList<>();
|
||||
//遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组
|
||||
for (int i=0; i<betaDataFile.getGammaList().size(); i++){
|
||||
xs.add(betaDataFile.getGammaList().get(i).getX());
|
||||
ys.add(betaDataFile.getGammaList().get(i).getY());
|
||||
}
|
||||
//计算C to E公式参数
|
||||
List<Double> newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
|
||||
for (Double para:newFittingPara) {
|
||||
newFittingParaStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("newCToE", newFittingParaStr);
|
||||
//填充道值数组的数据
|
||||
for (int i=0; i<255; i++) {
|
||||
channels.add(Double.valueOf(i));
|
||||
}
|
||||
//计算道值的能量
|
||||
List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,newFittingPara);
|
||||
//根据临时点的道值修改对应能量值
|
||||
//遍历所有道值
|
||||
for (int i=0; i< channels.size(); i++) {
|
||||
//获取道值
|
||||
double newChannel = channels.get(i).doubleValue();
|
||||
//遍历临时点数据
|
||||
for (int j=0; j<betaDataFile.getGammaList().size(); j++) {
|
||||
SeriseData seriseData = betaDataFile.getGammaList().get(j);
|
||||
double tempChannel = seriseData.getX();
|
||||
//如果道值等于临时点的道值
|
||||
if (newChannel == tempChannel) {
|
||||
energys.set(i, seriseData.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
//将新计算的能量封装到数组
|
||||
for (Double calEnergy:energys) {
|
||||
List<Double> newEnergy = new LinkedList<>();
|
||||
newEnergy.add(calEnergy);
|
||||
energyList.add(newEnergy);
|
||||
}
|
||||
//遍历道值添加各道值对应点数据到数组
|
||||
for (int i=0; i<channels.size(); ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(channels.get(i));
|
||||
seriseData.setY(energys.get(i));
|
||||
newLineSeries.add(seriseData);
|
||||
}
|
||||
map.put("newLineSeries", newLineSeries);
|
||||
//遍历点 缓存到表单数组以及折线图点位数组
|
||||
for (int i=0; i<betaDataFile.getGammaList().size(); i++) {
|
||||
//表单数据信息
|
||||
TableWidget tableWidget = new TableWidget();
|
||||
tableWidget.setRowCount(i+1);
|
||||
tableWidget.setChannel(betaDataFile.getGammaList().get(i).getX());
|
||||
tableWidget.setEnergy(betaDataFile.getGammaList().get(i).getY());
|
||||
tableWidgets.add(tableWidget);
|
||||
//折线图位置信息
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(betaDataFile.getGammaList().get(i).getX());
|
||||
seriseData.setY(betaDataFile.getGammaList().get(i).getY());
|
||||
newSeriseDataList.add(seriseData);
|
||||
}
|
||||
map.put("tableWidgets", tableWidgets);
|
||||
map.put("newScatterSeriesData", newSeriseDataList);
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
|
||||
for (Double para:newFittingParaToUi) {
|
||||
newFittingParaToUiStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("newEToC", newFittingParaToUiStr);
|
||||
}
|
||||
|
||||
//计算得到的
|
||||
if (betaDataFile.getGammaList().size() <= 0 ) {
|
||||
betaDataFile.setGammaList(oldScatterSeries);
|
||||
|
@ -1991,6 +2150,96 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
map.put("EToC", fittingParaToUiStr);
|
||||
|
||||
//判断人工交互的道值与能量对应参数数组是否为空
|
||||
if (CollectionUtils.isNotEmpty(betaDataFile.getBetaList())) {
|
||||
//存储计算参数道值
|
||||
List<Double> xs = new LinkedList();
|
||||
//存储计算参数能量值
|
||||
List<Double> ys = new LinkedList<>();
|
||||
//存储所有道值
|
||||
List<Double> channels = new LinkedList<>();
|
||||
//存储所有的能量值
|
||||
List<List<Double>> energyList = new LinkedList<>();
|
||||
//存储新的线点能量值
|
||||
List<SeriseData> newLineSeries = new LinkedList<>();
|
||||
//存储新的表单能量值
|
||||
List<TableWidget> tableWidgets = new LinkedList();
|
||||
//存储新的公式参数C TO E
|
||||
List<String> newFittingParaStr = new LinkedList<>();
|
||||
//存储新的公式参数E TO C
|
||||
List<String> newFittingParaToUiStr = new LinkedList<>();
|
||||
//记录点值数组
|
||||
List<SeriseData> newSeriseDataList = new LinkedList<>();
|
||||
//遍历临时点数组 将点位的横坐标以及纵坐标封装到对应的数组
|
||||
for (int i=0; i<betaDataFile.getBetaList().size(); i++){
|
||||
xs.add(betaDataFile.getBetaList().get(i).getX());
|
||||
ys.add(betaDataFile.getBetaList().get(i).getY());
|
||||
}
|
||||
//计算C to E公式参数
|
||||
List<Double> newFittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
|
||||
for (Double para:newFittingPara) {
|
||||
newFittingParaStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("newCToE", newFittingParaStr);
|
||||
//填充道值数组的数据
|
||||
for (int i=0; i<255; i++) {
|
||||
channels.add(Double.valueOf(i));
|
||||
}
|
||||
//计算道值的能量
|
||||
List<Double> energys = EnergySpectrumHandler.GetFileFittingData(channels,newFittingPara);
|
||||
//根据临时点的道值修改对应能量值
|
||||
//遍历所有道值
|
||||
for (int i=0; i< channels.size(); i++) {
|
||||
//获取道值
|
||||
double newChannel = channels.get(i).doubleValue();
|
||||
//遍历临时点数据
|
||||
for (int j=0; j<betaDataFile.getGammaList().size(); j++) {
|
||||
SeriseData seriseData = betaDataFile.getGammaList().get(j);
|
||||
double tempChannel = seriseData.getX();
|
||||
//如果道值等于临时点的道值
|
||||
if (newChannel == tempChannel) {
|
||||
energys.set(i, seriseData.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
//将新计算的能量封装到数组
|
||||
for (Double calEnergy:energys) {
|
||||
List<Double> newEnergy = new LinkedList<>();
|
||||
newEnergy.add(calEnergy);
|
||||
energyList.add(newEnergy);
|
||||
}
|
||||
//遍历道值添加各道值对应点数据到数组
|
||||
for (int i=0; i<channels.size(); ++i) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(channels.get(i));
|
||||
seriseData.setY(energys.get(i));
|
||||
newLineSeries.add(seriseData);
|
||||
}
|
||||
map.put("newLineSeries", newLineSeries);
|
||||
//遍历点 缓存到表单数组以及折线图点位数组
|
||||
for (int i=0; i<betaDataFile.getGammaList().size(); i++) {
|
||||
//表单数据信息
|
||||
TableWidget tableWidget = new TableWidget();
|
||||
tableWidget.setRowCount(i+1);
|
||||
tableWidget.setChannel(betaDataFile.getGammaList().get(i).getX());
|
||||
tableWidget.setEnergy(betaDataFile.getGammaList().get(i).getY());
|
||||
tableWidgets.add(tableWidget);
|
||||
//折线图位置信息
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(betaDataFile.getGammaList().get(i).getX());
|
||||
seriseData.setY(betaDataFile.getGammaList().get(i).getY());
|
||||
newSeriseDataList.add(seriseData);
|
||||
}
|
||||
map.put("tableWidgets", tableWidgets);
|
||||
map.put("newScatterSeriesData", newSeriseDataList);
|
||||
//计算E to C公式参数
|
||||
List<Double> newFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
|
||||
for (Double para:newFittingParaToUi) {
|
||||
newFittingParaToUiStr.add(String.valueOf(para));
|
||||
}
|
||||
map.put("newEToC", newFittingParaToUiStr);
|
||||
}
|
||||
|
||||
if (betaDataFile.getBetaList().size()<=0) {
|
||||
betaDataFile.setBetaList(oldScatterSeries);
|
||||
}
|
||||
|
@ -4977,20 +5226,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
|
||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn, List<SeriseData> betaList, List<SeriseData> gammaList, BetaDataFile betaDataFile) {
|
||||
File sampleTmp = null;
|
||||
File gasTmp = null;
|
||||
File detTmp = null;
|
||||
try {
|
||||
//获取ftp文件路径下临时文件
|
||||
sampleTmp = new File(betaDataFile.getSampleTmpPath());
|
||||
gasTmp = new File(betaDataFile.getGasTmpPath());
|
||||
detTmp = new File(betaDataFile.getDetTmpPath());
|
||||
String sampleTmp = betaDataFile.getSampleTmpPath();
|
||||
String gasTmp = betaDataFile.getGasTmpPath();
|
||||
String detTmp = betaDataFile.getDetTmpPath();
|
||||
BgCalibratePara bgPara = betaDataFile.getBgPara();
|
||||
//如果勾选了Energy Calibration页面下sample Data
|
||||
if (Objects.nonNull(sampleTmp)) {
|
||||
if(anlyseResultIn.isCheckSample()) {
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||
//没有点击过Energy Calibration页面下Gamma Detector Calibration的fitting按钮 channel/energy数据读取文件 如果点击过数据来源页面
|
||||
if (!anlyseResultIn.isBGammaEnergyValidSample()){
|
||||
if (StringUtils.isNotBlank(sampleTmp)) {
|
||||
//判断是否进行了重新分析操作
|
||||
if(Objects.nonNull(bgPara) && bgPara.bApplyNewCalicSample) {
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getSampleStruct();
|
||||
//如果gamma的能量分析页面 没有勾选sample 并且gamma数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBGammaEnergyValidSample() && CollectionUtils.isEmpty(gammaList)){
|
||||
anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_sample(sourceData.g_energy);
|
||||
} else {
|
||||
|
@ -4999,8 +5246,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
|
||||
anlyseResultIn.setG_energy_sample(energys);
|
||||
}
|
||||
//没有点击过Energy Calibration页面下Beta Detector Calibration的fitting按钮 channel/energy数据读取文件 如果点击过数据来源页面
|
||||
if (!anlyseResultIn.isBBetaEnergyValidSample()){
|
||||
//如果beta的能量分析页面 没有勾选sample 并且beta数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBBetaEnergyValidSample() && CollectionUtils.isEmpty(betaList)){
|
||||
anlyseResultIn.setB_channel_sample(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy);
|
||||
} else {
|
||||
|
@ -5010,17 +5257,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
anlyseResultIn.setB_energy_sample(energys);
|
||||
}
|
||||
} else {//如果没有勾选Energy Calibration页面下sample Data
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(sampleTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getSampleStruct();
|
||||
anlyseResultIn.setG_channel_sample(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_sample(sourceData.g_energy);
|
||||
anlyseResultIn.setB_channel_sample(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_sample(sourceData.b_electron_energy);
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(gasTmp)) {
|
||||
if (anlyseResultIn.isCheckGas()) {
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||
if (!anlyseResultIn.isBGammaEnergyValidGas()){
|
||||
if (StringUtils.isNotBlank(gasTmp)) {
|
||||
if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicGasBg) {
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getGasStruct();
|
||||
//如果gamma的能量分析页面 没有勾选gas 并且gamma数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBGammaEnergyValidGas() && CollectionUtils.isEmpty(gammaList)){
|
||||
anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_gas(sourceData.g_energy);
|
||||
} else {
|
||||
|
@ -5029,7 +5277,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
|
||||
anlyseResultIn.setG_energy_gas(energys);
|
||||
}
|
||||
if (!anlyseResultIn.isBBetaEnergyValidGas()){
|
||||
//如果beta的能量分析页面 没有勾选gas 并且beta数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBBetaEnergyValidGas() && CollectionUtils.isEmpty(betaList)){
|
||||
anlyseResultIn.setB_channel_gas(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy);
|
||||
} else {
|
||||
|
@ -5039,17 +5288,18 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
anlyseResultIn.setB_energy_gas(energys);
|
||||
}
|
||||
} else {
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(gasTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getGasStruct();
|
||||
anlyseResultIn.setG_channel_gas(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_gas(sourceData.g_energy);
|
||||
anlyseResultIn.setB_channel_gas(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_gas(sourceData.b_electron_energy);
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(detTmp)) {
|
||||
if (anlyseResultIn.isCheckDet()) {
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||
if (!anlyseResultIn.isBGammaEnergyValidDet()){
|
||||
if (StringUtils.isNotBlank(detTmp)) {
|
||||
if (Objects.nonNull(bgPara) && bgPara.bApplyNewCalicDetBg) {
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getDetStruct();
|
||||
//如果gamma的能量分析页面 没有勾选det 并且gamma数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBGammaEnergyValidDet() && CollectionUtils.isEmpty(gammaList)){
|
||||
anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_det(sourceData.g_energy);
|
||||
} else {
|
||||
|
@ -5058,7 +5308,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
List<Double> energys = gammaList.stream().map(SeriseData::getY).collect(Collectors.toList());
|
||||
anlyseResultIn.setG_energy_det(energys);
|
||||
}
|
||||
if (!anlyseResultIn.isBBetaEnergyValidDet()){
|
||||
//如果beta的能量分析页面 没有勾选det 并且beta数组是空的 存储文件中的数据
|
||||
if (!anlyseResultIn.isBBetaEnergyValidDet() && CollectionUtils.isEmpty(betaList)){
|
||||
anlyseResultIn.setB_channel_det(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_det(sourceData.b_electron_energy);
|
||||
} else {
|
||||
|
@ -5068,16 +5319,13 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
anlyseResultIn.setB_energy_det(energys);
|
||||
}
|
||||
} else {
|
||||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(detTmp.getAbsolutePath());
|
||||
EnergySpectrumStruct sourceData = betaDataFile.getDetStruct();
|
||||
anlyseResultIn.setG_channel_det(sourceData.g_centroid_channel);
|
||||
anlyseResultIn.setG_energy_det(sourceData.g_energy);
|
||||
anlyseResultIn.setB_channel_det(sourceData.b_channel);
|
||||
anlyseResultIn.setB_energy_det(sourceData.b_electron_energy);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void analyzeSavePHDFile(BgDataAnlyseResultIn anlyseResultIn, BgCalibratePara BgCalPara, List<String> betaFittingPara, List<String> gammaFittingPara,List<String> betaFittingParaToUi, List<String> gammaFittingParaToUi, BetaDataFile betaDataFile) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user