Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
nieziyan 2023-11-28 18:36:09 +08:00
commit ba40f06460
5 changed files with 70 additions and 49 deletions

View File

@ -496,11 +496,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
//获取phdFile的 分析开始时间
Date acq = DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time());
//计算得到采集耗时
double collect_hour = (end.getTime()/1000 - start.getTime()/1000) / 3600.0;
double collect_hour = ((end.getTime() - start.getTime())/1000) / 3600.0;
//获取 实际分析时长
double acq_hour = phd.getAcq().getAcquisition_real_time() / 3600.0;
//计算得到衰减耗时
double Decay_hour = (acq.getTime()/1000 - end.getTime()/1000) / 3600.0;
double Decay_hour = ((acq.getTime() - end.getTime())/1000) / 3600.0;
//声明一个double数据
List<Double> Be7Value = new LinkedList<>();
//声明一个map用于存储计算数据
@ -640,9 +640,9 @@ public class GammaFileUtil extends AbstractLogOrReport {
//获取能谱获取时间
Date acqStart = DateUtils.parseDate(phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time().substring(0,phd.getAcq().getAcquisition_start_time().indexOf(StringPool.DOT)), "yyyy/MM/dd HH:mm:ss");
//计算采样时间
double Ts = (collectStop.getTime()/1000 - collectStart.getTime()/1000);
double Ts = ((collectStop.getTime() - collectStart.getTime())/1000);
//计算衰变时间
double Td = (acqStart.getTime()/1000 - collectStop.getTime()/1000);
double Td = ((acqStart.getTime() - collectStop.getTime())/1000);
//获取能谱获取实时间
double Ta = phd.getAcq().getAcquisition_real_time();
//获取能谱获取活时间
@ -670,7 +670,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
DCF3 = lambda * Ta / (1-Math.exp(-lambda*Ta));
}
//计算得到DCF_conc
double DCF_conc = Math.exp(lambda * (collectStart.getTime()/1000 - phd.getUsedSetting().getRefTime_conc().getTime()/1000));
double DCF_conc = Math.exp(lambda * ((collectStart.getTime() - phd.getUsedSetting().getRefTime_conc().getTime())/1000));
//声明一个集合
List<Double> energy = new LinkedList<>();
energy.add(vMdcInfo.get(0));

View File

@ -68,7 +68,7 @@ public class PHDFileUtil extends AbstractLogOrReport {
//Collection Time
String CollectionTime = "";
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
Date AcquisitionStart = null;

View File

@ -1089,7 +1089,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
Map<String, NuclideLines> nuclideLinesMap = (Map<String, NuclideLines>) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());
gammaFileUtil.AnalyseSpectrum(phd, nuclideLinesMap);
// 重新分析各峰值对应的核素信息
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
// gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
Map<String, Object> map = new HashMap<>();
gammaFileUtil.UpdateChart(phd, map, colorMap);
// 更新 QC Flags 状态
@ -2304,7 +2304,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
// date of Zero Time
Date datetime = DateUtils.parseDate(date + StringPool.SPACE + time, "yyyy-MM-dd HH:mm:ss");
Date oriDate = DateUtils.parseDate("1970-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
double second = (datetime.getTime() / 1000 - oriDate.getTime() / 1000) - t - 8 * 60 * 60;
double second = ((datetime.getTime() - oriDate.getTime()) / 1000) - t - 8 * 60 * 60;
Date resultDateTime = DateUtils.getDate((long) second * 1000);
@ -3571,6 +3571,14 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
max = editEnergyDou + err;
}
List<GardsNuclLinesLib> nuclideLines = spectrumAnalysisMapper.getNuclideLine(min, max, name);
nuclideLines.stream().forEach(item -> {
if (Objects.nonNull(item.getYield())) {
item.setYield(Double.valueOf(String.format("%.3f", item.getYield())));
}
if (Objects.nonNull(item.getYieldUncert())) {
item.setYieldUncert(Double.valueOf(String.format("%.3f", item.getYieldUncert())));
}
});
return nuclideLines;
}
@ -3996,10 +4004,10 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
String acq_start = phd.getAcq().getAcquisition_start_date() + StringPool.SPACE + phd.getAcq().getAcquisition_start_time();
Date collect_stop_dt = DateUtils.parseDate(collect_stop);
Date collect_start_dt = DateUtils.parseDate(collect_start);
double Sampling_Time = (collect_stop_dt.getTime() / 1000 - collect_start_dt.getTime() / 1000) / 3600.0;
double Sampling_Time = ((collect_stop_dt.getTime() - collect_start_dt.getTime()) / 1000) / 3600.0;
Date acq_start_dt = DateUtils.parseDate(acq_start);
double Decay_Time = (acq_start_dt.getTime() / 1000 - collect_stop_dt.getTime() / 1000) / 3600.0;
double Decay_Time = ((acq_start_dt.getTime() - collect_stop_dt.getTime()) / 1000) / 3600.0;
long secs = (long) (acq_start_dt.getTime() + (phd.getAcq().getAcquisition_live_time() * 1000));
String acq_stop = DateUtils.formatDate(new Date(secs), "yyyy/MM/dd HH:mm:ss.S");

View File

@ -1015,7 +1015,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
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(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(rowFormat("%sAir Volume[cm3]:%-35s%s", StringPool.SPACE, StringPool.SPACE, String.valueOf(information.getS_xe_stable_volume())));
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");
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 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_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");
@ -1487,10 +1487,10 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
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 collectStopDate = DateUtils.parseDate(sampleSourceData.collection_stop_date + StringPool.SPACE + sampleSourceData.collection_stop_time);
Double collection_time = Double.valueOf(collectStopDate.getTime() / 1000 - collectStartDate.getTime() / 1000);
String collection_time_value = String.format("%.2f",Double.valueOf(collectStopDate.getTime()/1000 - collectStartDate.getTime()/ 1000)/3600.0);
Double collection_time = Double.valueOf((collectStopDate.getTime() - collectStartDate.getTime()) / 1000);
String collection_time_value = String.format("%.4f",collection_time/3600.0);
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");
}else {
qcResult.setCollectTimeStatus("Failed");
@ -1728,21 +1728,28 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
oldScatterSeries.add(temp);
}
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
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<String> fittingParaStr = new LinkedList<>();
for (Double para:fittingPara) {
fittingParaStr.add(String.valueOf(para));
}
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
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
List<String> fittingParaToUiStr = new LinkedList<>();
for (Double para:fittingParaToUi) {
fittingParaToUiStr.add(String.valueOf(para));
@ -1821,9 +1828,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
if (Objects.nonNull(struct)){
//Figure of Beta Detector Calibration
long numBChannel = struct.num_b_channel;
List<List<Double>> betaEnergyList = new LinkedList<>();
List<Double> bChannel = struct.b_channel;
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> bchannels = new ArrayList<>();
for (int i=0; i<numBChannel; i++){
@ -1833,10 +1848,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
betaEnergyList.add(betaEnergy);
}
map.put("betaEnergy", betaEnergyList);
//gamma Energy
long numGChannel = struct.num_g_channel;
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
//gamma Energy 散点图坐标点关联gamma部分相关数据
List<Double> gammaParam = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
List<Double> gchannels = new ArrayList<>();
List<List<Double>> gammaEnergyList = new LinkedList<>();
@ -1847,10 +1859,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
gammaEnergyList.add(gammaEnergy);
}
map.put("gammaEnergy", gammaEnergyList);
//Beta-Gamma Spectrum: QC
long bChannels = struct.b_channels;
long gChannels = struct.g_channels;
List<Long> hCounts = struct.h_counts;
//Beta-Gamma Spectrum: QC 散点图相关数据
List<HistogramData> histogramDataList = new LinkedList<>();
for (int column=0; column<bChannels; column++) {
for (int row=0; row<gChannels; row++) {
@ -1865,35 +1874,39 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
}
map.put("histogramData", histogramDataList);
//计算Calibration Parameter Of Gamma Detector
List<Double> bChannelList = struct.b_channel;
List<Double> bEnergy = struct.b_electron_energy;
int bRecordCount = struct.b_record_count;
//计算Calibration Parameter Of Gamma Detector 拟合线图数据
List<SeriseData> oldScatterSeries = new LinkedList<>();
for (int i=0; i<bRecordCount; i++) {
SeriseData temp = new SeriseData();
double p1 = bChannelList.get(i);
double p2 = bEnergy.get(i);
double p1 = bChannel.get(i);
double p2 = bElectronEnergy.get(i);
temp.setX(p1);
temp.setY(p2);
oldScatterSeries.add(temp);
}
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
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(xs, ys);
//计算得到C to E公式数据
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
List<String> fittingParaStr = new LinkedList<>();
for (Double para:fittingPara) {
fittingParaStr.add(String.valueOf(para));
}
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
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(ys, xs);
List<Double> fittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(energy, channel);
List<String> fittingParaToUiStr = new LinkedList<>();
for (Double para:fittingParaToUi) {
fittingParaToUiStr.add(String.valueOf(para));

View File

@ -159,7 +159,7 @@ public class DataReceivingStatusManager {
Date acquisitionStop = sampleData.getAcquisitionStop();
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);
dataInfoList.add(dataInfo);
}
@ -191,7 +191,7 @@ public class DataReceivingStatusManager {
dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000));
Date endTime = metData.getEndTime();
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);
dataInfoList.add(dataInfo);
}