人工交互分析模块beta部分进入energyCalibration页面beta部分tab页E TO C公式计算参数修改

人工交互分析计算时间差值精度问题修改
台站运行管理时间间隔精度问题修改
This commit is contained in:
qiaoqinzheng 2023-11-28 15:19:56 +08:00
parent b5775437e1
commit 9f8d730a6f
3 changed files with 53 additions and 40 deletions

View File

@ -68,7 +68,7 @@ public class PHDFileUtil extends AbstractLogOrReport {
//Collection Time //Collection Time
String CollectionTime = ""; String CollectionTime = "";
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){ if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
CollectionTime = String.format ("%.2f",Double.valueOf(CollectionStop.getTime()/1000 - CollectionStart.getTime()/ 1000)); CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000));
} }
//Acquisition Start //Acquisition Start
Date AcquisitionStart = null; Date AcquisitionStart = null;

View File

@ -1015,7 +1015,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCollection Stop:%-35s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss"))); strBuffer.append(rowFormat("%sCollection Stop:%-35s%s", StringPool.SPACE, StringPool.SPACE, DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss")));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sCollection TIME(h):%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf((information.getCollect_stop().getTime()/1000-information.getCollect_start().getTime()/1000)/3600))); strBuffer.append(rowFormat("%sCollection TIME(h):%-32s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(((information.getCollect_stop().getTime()-information.getCollect_start().getTime())/1000)/3600)));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
strBuffer.append(rowFormat("%sAir Volume[cm3]:%-35s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_xe_stable_volume()))); strBuffer.append(rowFormat("%sAir Volume[cm3]:%-35s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_xe_stable_volume())));
strBuffer.append(System.lineSeparator()); strBuffer.append(System.lineSeparator());
@ -1380,7 +1380,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
Date collectStopDate = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time.substring(0, struct.collection_stop_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); Date collectStopDate = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time.substring(0, struct.collection_stop_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss");
String collect_start = DateUtils.formatDate(collectStartDate, "yyyy/MM/dd HH:mm:ss"); String collect_start = DateUtils.formatDate(collectStartDate, "yyyy/MM/dd HH:mm:ss");
String collect_stop = DateUtils.formatDate(collectStopDate, "yyyy/MM/dd HH:mm:ss"); String collect_stop = DateUtils.formatDate(collectStopDate, "yyyy/MM/dd HH:mm:ss");
String collection_time_value = String.format ("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)); String collection_time_value = String.format ("%.2f",Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime())/ 1000));
String s_volume_of_Xe = String.valueOf(struct.air_volume); String s_volume_of_Xe = String.valueOf(struct.air_volume);
String s_xe_stable_volume = String.valueOf(struct.sample_volume_of_Xe); String s_xe_stable_volume = String.valueOf(struct.sample_volume_of_Xe);
Date acquisitionStartDate = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time.substring(0, struct.acquisition_start_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss"); Date acquisitionStartDate = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time.substring(0, struct.acquisition_start_time.indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss");
@ -1487,10 +1487,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (Objects.nonNull(sampleSourceData) && Objects.nonNull(gasSourceData) && Objects.nonNull(detSourceData)) { if (Objects.nonNull(sampleSourceData) && Objects.nonNull(gasSourceData) && Objects.nonNull(detSourceData)) {
Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time); Date collectStartDate = DateUtils.parseDate(sampleSourceData.collection_start_date + StringPool.SPACE + sampleSourceData.collection_start_time);
Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time); Date collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time);
Double collection_time = Double.valueOf(collectStopDate.getTime() / 1000 - collectStartDate.getTime() / 1000); Double collection_time = Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime()) / 1000);
String collection_time_value = String.format("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)/3600.0); String collection_time_value = String.format("%.4f",collection_time/3600.0);
qcResult.setCollectTimeValue(collection_time_value); qcResult.setCollectTimeValue(collection_time_value);
if (collectionTimeSections.get(1) < collection_time/3600 && collection_time/3600 < collectionTimeSections.get(4)){ if (collectionTimeSections.get(1) < collection_time/3600.0 && collection_time/3600.0 < collectionTimeSections.get(4)){
qcResult.setCollectTimeStatus("Pass"); qcResult.setCollectTimeStatus("Pass");
}else { }else {
qcResult.setCollectTimeStatus("Failed"); qcResult.setCollectTimeStatus("Failed");
@ -1728,21 +1728,28 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
oldScatterSeries.add(temp); oldScatterSeries.add(temp);
} }
map.put("oldScatterSeries", oldScatterSeries); map.put("oldScatterSeries", oldScatterSeries);
List<Double> xs = new LinkedList<>();
List<Double> ys = new LinkedList<>();
for (int i=0; i< oldScatterSeries.size(); i++){
xs.add(oldScatterSeries.get(i).getX());
ys.add(oldScatterSeries.get(i).getY());
}
//C to E //C to E
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys); List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<String> fittingParaStr = new LinkedList<>(); List<String> fittingParaStr = new LinkedList<>();
for (Double para:fittingPara) { for (Double para:fittingPara) {
fittingParaStr.add(String.valueOf(para)); fittingParaStr.add(String.valueOf(para));
} }
map.put("CToE", fittingParaStr); map.put("CToE", fittingParaStr);
List<Double> channel = new LinkedList<>();
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();
tmp.setX(channel.get(i));
tmp.setY(energy.get(i));
oldLineSeries.add(tmp);
}
map.put("oldLineSeries", oldLineSeries);
//E to C //E to C
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
List<String> fittingParaToUiStr = new LinkedList<>(); List<String> fittingParaToUiStr = new LinkedList<>();
for (Double para:fittingParaToUi) { for (Double para:fittingParaToUi) {
fittingParaToUiStr.add(String.valueOf(para)); fittingParaToUiStr.add(String.valueOf(para));
@ -1821,9 +1828,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (Objects.nonNull(struct)){ if (Objects.nonNull(struct)){
//Figure of Beta Detector Calibration //Figure of Beta Detector Calibration
long numBChannel = struct.num_b_channel; long numBChannel = struct.num_b_channel;
List<List<Double>> betaEnergyList = new LinkedList<>();
List<Double> bChannel = struct.b_channel; List<Double> bChannel = struct.b_channel;
List<Double> bElectronEnergy = struct.b_electron_energy; List<Double> bElectronEnergy = struct.b_electron_energy;
long numGChannel = struct.num_g_channel;
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
long bChannels = struct.b_channels;
long gChannels = struct.g_channels;
List<Long> hCounts = struct.h_counts;
int bRecordCount = struct.b_record_count;
//散点图坐标点关联beta部分相关数据
List<List<Double>> betaEnergyList = new LinkedList<>();
List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy); List<Double> betaParam = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<Double> bchannels = new ArrayList<>(); List<Double> bchannels = new ArrayList<>();
for (int i=0; i<numBChannel; i++){ for (int i=0; i<numBChannel; i++){
@ -1833,10 +1848,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaEnergyList.add(betaEnergy); betaEnergyList.add(betaEnergy);
} }
map.put("betaEnergy", betaEnergyList); map.put("betaEnergy", betaEnergyList);
//gamma Energy //gamma Energy 散点图坐标点关联gamma部分相关数据
long numGChannel = struct.num_g_channel;
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy); List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<Double> gchannels = new ArrayList<>(); List<Double> gchannels = new ArrayList<>();
List<List<Double>> gammaEnergyList = new LinkedList<>(); List<List<Double>> gammaEnergyList = new LinkedList<>();
@ -1847,10 +1859,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
gammaEnergyList.add(gammaEnergy); gammaEnergyList.add(gammaEnergy);
} }
map.put("gammaEnergy", gammaEnergyList); map.put("gammaEnergy", gammaEnergyList);
//Beta-Gamma Spectrum: QC //Beta-Gamma Spectrum: QC 散点图相关数据
long bChannels = struct.b_channels;
long gChannels = struct.g_channels;
List<Long> hCounts = struct.h_counts;
List<HistogramData> histogramDataList = new LinkedList<>(); List<HistogramData> histogramDataList = new LinkedList<>();
for (int column=0; column<bChannels; column++) { for (int column=0; column<bChannels; column++) {
for (int row=0; row<gChannels; row++) { for (int row=0; row<gChannels; row++) {
@ -1865,35 +1874,39 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
} }
} }
map.put("histogramData", histogramDataList); map.put("histogramData", histogramDataList);
//计算Calibration Parameter Of Gamma Detector //计算Calibration Parameter Of Gamma Detector 拟合线图数据
List<Double> bChannelList = struct.b_channel;
List<Double> bEnergy = struct.b_electron_energy;
int bRecordCount = struct.b_record_count;
List<SeriseData> oldScatterSeries = new LinkedList<>(); List<SeriseData> oldScatterSeries = new LinkedList<>();
for (int i=0; i<bRecordCount; i++) { for (int i=0; i<bRecordCount; i++) {
SeriseData temp = new SeriseData(); SeriseData temp = new SeriseData();
double p1 = bChannelList.get(i); double p1 = bChannel.get(i);
double p2 = bEnergy.get(i); double p2 = bElectronEnergy.get(i);
temp.setX(p1); temp.setX(p1);
temp.setY(p2); temp.setY(p2);
oldScatterSeries.add(temp); oldScatterSeries.add(temp);
} }
map.put("oldScatterSeries", oldScatterSeries); map.put("oldScatterSeries", oldScatterSeries);
List<Double> xs = new LinkedList<>(); //计算得到C to E公式数据
List<Double> ys = new LinkedList<>(); List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
for (int i=0; i< oldScatterSeries.size(); i++){
xs.add(oldScatterSeries.get(i).getX());
ys.add(oldScatterSeries.get(i).getY());
}
//C to E
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
List<String> fittingParaStr = new LinkedList<>(); List<String> fittingParaStr = new LinkedList<>();
for (Double para:fittingPara) { for (Double para:fittingPara) {
fittingParaStr.add(String.valueOf(para)); fittingParaStr.add(String.valueOf(para));
} }
map.put("CToE", fittingParaStr); map.put("CToE", fittingParaStr);
List<Double> channel = new LinkedList<>();
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();
tmp.setX(channel.get(i));
tmp.setY(energy.get(i));
oldLineSeries.add(tmp);
}
map.put("oldLineSeries", oldLineSeries);
//E to C //E to C
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs); List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(energy, channel);
List<String> fittingParaToUiStr = new LinkedList<>(); List<String> fittingParaToUiStr = new LinkedList<>();
for (Double para:fittingParaToUi) { for (Double para:fittingParaToUi) {
fittingParaToUiStr.add(String.valueOf(para)); fittingParaToUiStr.add(String.valueOf(para));

View File

@ -159,7 +159,7 @@ public class DataReceivingStatusManager {
Date acquisitionStop = sampleData.getAcquisitionStop(); Date acquisitionStop = sampleData.getAcquisitionStop();
dataInfo.setEndTime(Double.valueOf(acquisitionStop.getTime() / 1000)); dataInfo.setEndTime(Double.valueOf(acquisitionStop.getTime() / 1000));
//时间间隔 //时间间隔
Double span = Double.valueOf(acquisitionStop.getTime() / 1000) - Double.valueOf(acquisitionStart.getTime() / 1000); Double span = Double.valueOf((acquisitionStop.getTime() - acquisitionStart.getTime()) / 1000);
dataInfo.setSpanTime(span); dataInfo.setSpanTime(span);
dataInfoList.add(dataInfo); dataInfoList.add(dataInfo);
} }
@ -191,7 +191,7 @@ public class DataReceivingStatusManager {
dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000)); dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000));
Date endTime = metData.getEndTime(); Date endTime = metData.getEndTime();
dataInfo.setEndTime(Double.valueOf(endTime.getTime() / 1000)); dataInfo.setEndTime(Double.valueOf(endTime.getTime() / 1000));
Double span = Double.valueOf(startTime.getTime() / 1000) - Double.valueOf(endTime.getTime() / 1000); Double span = Double.valueOf( (endTime.getTime() - startTime.getTime()) / 1000);
dataInfo.setSpanTime(span); dataInfo.setSpanTime(span);
dataInfoList.add(dataInfo); dataInfoList.add(dataInfo);
} }