修改如果gamma谱没有识别出对应的核素,只计算MDC值
This commit is contained in:
parent
03eaf574e0
commit
84cb8e45a1
|
@ -46,6 +46,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 解析 #histogram块数据
|
||||
*
|
||||
* @param phdPath 文件地址
|
||||
* @return
|
||||
*/
|
||||
|
@ -56,7 +57,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
try {
|
||||
List<Long> hCounts = Lists.newLinkedList();
|
||||
String currentName = "";
|
||||
long [][] hCountArr = null;
|
||||
long[][] hCountArr = null;
|
||||
int row = 0;
|
||||
String blockHis = SampleFileHeader.HISTOGRAM.getMessage();
|
||||
while (reader.ready()) {
|
||||
|
@ -68,7 +69,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
String s = reader.readLine();
|
||||
String[] split = s.split(" ");
|
||||
long[] array = Arrays.stream(split).filter(StrUtil::isNotEmpty).mapToLong(Long::parseLong).toArray();
|
||||
hCountArr = new long[(int)array[0]][(int)array[1]];
|
||||
hCountArr = new long[(int) array[0]][(int) array[1]];
|
||||
result.put("g_channels", array[0]);
|
||||
result.put("b_channels", array[1]);
|
||||
result.put("g_energy_span", array[2]);
|
||||
|
@ -90,7 +91,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
row++;
|
||||
}
|
||||
result.put("h_count", hCountArr);
|
||||
Console.log("Size:{}",hCounts.size());
|
||||
Console.log("Size:{}", hCounts.size());
|
||||
return result;
|
||||
} catch (IORuntimeException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -108,12 +109,13 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
}
|
||||
|
||||
/**
|
||||
* 统计道值范围内数量
|
||||
* @param startChannel 起始道值
|
||||
* @param endChannel 结束道值
|
||||
* @param betaChannels 行数
|
||||
* 统计道值范围内数量
|
||||
*
|
||||
* @param startChannel 起始道值
|
||||
* @param endChannel 结束道值
|
||||
* @param betaChannels 行数
|
||||
* @param gammaChannels 列数
|
||||
* @param h_counts 计数数组
|
||||
* @param h_counts 计数数组
|
||||
*/
|
||||
public Map<String, Object> statisticsROIList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List<Long> h_counts) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
@ -123,12 +125,12 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
List<Integer> sumList = new LinkedList<>();
|
||||
List<SeriseData> seriseDataList = new LinkedList<>();
|
||||
//遍历所有列
|
||||
for (int i=0; i<gammaChannels; i++) {
|
||||
for (int i = 0; i < gammaChannels; i++) {
|
||||
SeriseData seriseData = new SeriseData();
|
||||
seriseData.setX(i);
|
||||
int sum = 0;
|
||||
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
|
||||
for (int j=startChannel; j <= endChannel; j++) {
|
||||
for (int j = startChannel; j <= endChannel; j++) {
|
||||
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
|
||||
int index = (int) (i * betaChannels + j);
|
||||
long count = 0;
|
||||
|
@ -136,7 +138,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
if (index > 0 && index < h_counts.size()) {
|
||||
count = h_counts.get(index);
|
||||
}
|
||||
sum+=count;
|
||||
sum += count;
|
||||
}
|
||||
seriseData.setY(sum);
|
||||
sumList.add(sum);
|
||||
|
@ -183,6 +185,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 调用dll解析phd文件,dll不解析histogram块数据
|
||||
*
|
||||
* @param filePathName 文件地址
|
||||
* @return
|
||||
*/
|
||||
|
@ -218,10 +221,10 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
//存储同一列不同行加和后的数量
|
||||
List<Integer> sumList = new LinkedList<>();
|
||||
//遍历所有列
|
||||
for (int i=0; i<gammaChannels; i++) {
|
||||
for (int i = 0; i < gammaChannels; i++) {
|
||||
long sum = 0;
|
||||
//根据起始道值和结束道值 获取这一列的所有对应道值的数据
|
||||
for (int j=startChannel; j <= endChannel; j++) {
|
||||
for (int j = startChannel; j <= endChannel; j++) {
|
||||
//列数 * 总行数 + 当前行下标 获取对应的数据数组下标
|
||||
int index = (int) (i * betaChannels + j);
|
||||
long count = 0;
|
||||
|
@ -229,7 +232,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
if (index > 0 && index < h_counts.size()) {
|
||||
count = h_counts.get(index);
|
||||
}
|
||||
sum+=count;
|
||||
sum += count;
|
||||
}
|
||||
counts.add(sum);
|
||||
}
|
||||
|
@ -237,106 +240,105 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
}
|
||||
|
||||
public String UpdateEquationEnergy(ParameterInfo m_curParam) {
|
||||
String equation ="";
|
||||
int p_size = m_curParam.getP().size()-1;
|
||||
if(p_size >= 2 && m_curParam.getP().get(2) > 0) {
|
||||
String equation = "";
|
||||
int p_size = m_curParam.getP().size() - 1;
|
||||
if (p_size >= 2 && m_curParam.getP().get(2) > 0) {
|
||||
// Polynomial: y=a0+a1*x+a2*x^2+a3*x^3
|
||||
equation +="Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + C * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
|
||||
for(int i=3; i<=p_size; i++) {
|
||||
equation += " + C<sup style=\"vertical-align:super;\">" + (i-1) +"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+"";
|
||||
equation += "Energy = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " + C * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
|
||||
for (int i = 3; i <= p_size; i++) {
|
||||
equation += " + C<sup style=\"vertical-align:super;\">" + (i - 1) + "</sup> * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i))) + "";
|
||||
}
|
||||
} else if(p_size == 1) {
|
||||
equation = "Energy = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * C";
|
||||
} else if (p_size == 1) {
|
||||
equation = "Energy = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " * C";
|
||||
}
|
||||
return equation;
|
||||
}
|
||||
|
||||
public String UpdateEquationResolution(ParameterInfo m_curParam) {
|
||||
String equation = "";
|
||||
int p_size = m_curParam.getP().size()-1;
|
||||
if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
|
||||
int p_size = m_curParam.getP().size() - 1;
|
||||
if (p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
|
||||
// Square root of polynomial: y = sqrt(a0+a1*x+a2*x^2+a3*x^3 )
|
||||
equation += "FWHM = ("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + E * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
|
||||
for(int i=3; i<=p_size; i++) {
|
||||
equation += " + E<sup style=\"vertical-align:super;\">"+(i-1)+"</sup> * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)));
|
||||
equation += "FWHM = (" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " + E * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)));
|
||||
for (int i = 3; i <= p_size; i++) {
|
||||
equation += " + E<sup style=\"vertical-align:super;\">" + (i - 1) + "</sup> * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)));
|
||||
}
|
||||
equation += ")<sup style=\"vertical-align:super;\">"+1+"/"+2+"</sup>";
|
||||
equation += ")<sup style=\"vertical-align:super;\">" + 1 + "/" + 2 + "</sup>";
|
||||
}
|
||||
return equation;
|
||||
}
|
||||
|
||||
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, Integer curRow, Integer funId) {
|
||||
String equation = "";
|
||||
if(m_curParam.getP().size() > 2) {
|
||||
int p_size = m_curParam.getP().size()-1;
|
||||
if (m_curParam.getP().size() > 2) {
|
||||
int p_size = m_curParam.getP().size() - 1;
|
||||
int e_size = m_vCurEnergy.size();
|
||||
if (Objects.isNull(funId)) {
|
||||
funId = m_curParam.getP().get(0).intValue();
|
||||
}
|
||||
switch(funId) {
|
||||
switch (funId) {
|
||||
case 1: // Interpolation: y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x<x(i+1)
|
||||
if(p_size == 2 * e_size && p_size >= 4) {
|
||||
if (p_size == 2 * e_size && p_size >= 4) {
|
||||
int i = curRow;
|
||||
if(i < 0 || i >= e_size) break;
|
||||
if (i < 0 || i >= e_size) break;
|
||||
|
||||
double y1, y0, x1, x0;
|
||||
if(i < e_size - 1)
|
||||
{
|
||||
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+3))));
|
||||
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
|
||||
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+2))));
|
||||
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
|
||||
if (i < e_size - 1) {
|
||||
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 + 3))));
|
||||
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 + 1))));
|
||||
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 + 2))));
|
||||
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2))));
|
||||
} else {
|
||||
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2+1))));
|
||||
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-1))));
|
||||
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2))));
|
||||
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i*2-2))));
|
||||
y1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 + 1))));
|
||||
y0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 - 1))));
|
||||
x1 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2))));
|
||||
x0 = Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i * 2 - 2))));
|
||||
}
|
||||
equation += "Efficiency = "+y0+" + ("+y1+"-"+y0+") * (E - "+x0+") / ("+x1+" - "+x0+")";
|
||||
equation += "Efficiency = " + y0 + " + (" + y1 + "-" + y0 + ") * (E - " + x0 + ") / (" + x1 + " - " + x0 + ")";
|
||||
}
|
||||
break;
|
||||
case 5: // HT Efficiency: y = A*exp(-(E1/x)^k)*(1-exp(-(E2/x)^n))
|
||||
if(p_size == 5) {
|
||||
for(int i=1; i<=p_size; i++) {
|
||||
if(m_curParam.getP().get(i) <= 0) break;
|
||||
if (p_size == 5) {
|
||||
for (int i = 1; i <= p_size; i++) {
|
||||
if (m_curParam.getP().get(i) <= 0) break;
|
||||
}
|
||||
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
|
||||
"(1-exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
|
||||
equation += "Efficiency = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " * exp(-(" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " / E)<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3))) + "</sup>) * " +
|
||||
"(1-exp(-(" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4))) + " / E)<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5))) + "</sup>))";
|
||||
}
|
||||
break;
|
||||
case 6: // Polynomial in log(y) against log(x): log(y) = a0 + a1*log(x) +a2*log(x)^2+ a3*log(x)^3
|
||||
if(p_size >= 2) {
|
||||
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(E)";
|
||||
for(int i=3; i<=p_size; i++) {
|
||||
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
|
||||
if (p_size >= 2) {
|
||||
equation += "log(Efficiency) = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " + " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " * log(E)";
|
||||
for (int i = 3; i <= p_size; i++) {
|
||||
equation += " + " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i))) + " * log(E)<sup style=\"vertical-align:super;\">" + (i - 1) + "</sup>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8: // Polynomial in log(y) against log(1/x): log(y) = a0 + a1*log(c/x) + a2*log(c/x)^2 + a3*log(c/x)^3 + a4*log(c/x)^4
|
||||
if(p_size >= 3) {
|
||||
equation += "log(Efficiency) = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" * log(C/E)";
|
||||
for(int i=3; i<=p_size; i++) {
|
||||
equation += " + "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i)))+" * log(C/E)<sup style=\"vertical-align:super;\">"+(i-1)+"</sup>";
|
||||
if (p_size >= 3) {
|
||||
equation += "log(Efficiency) = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " + " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " * log(C/E)";
|
||||
for (int i = 3; i <= p_size; i++) {
|
||||
equation += " + " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(i))) + " * log(C/E)<sup style=\"vertical-align:super;\">" + (i - 1) + "</sup>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 93: // HAE Efficiency (1-3): y=S*exp(-(E1/x)^k)*(1- exp(-(2*E3/(x-E3))^n))
|
||||
if(p_size == 5) {
|
||||
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
|
||||
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"</sup>))";
|
||||
if (p_size == 5) {
|
||||
equation += "Efficiency = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " * exp(-(" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " / E)<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3))) + "</sup>) * " +
|
||||
"(1 - exp(-(2 * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4))) + " / (E - " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4))) + "))<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5))) + "</sup>))";
|
||||
}
|
||||
break;
|
||||
case 94: // HAE Efficiency (1-2): y=S*exp(-(E1/x)^k)*(1- exp(-b*(1/(x-E2))^m))
|
||||
if(p_size == 6) {
|
||||
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
|
||||
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>))";
|
||||
if (p_size == 6) {
|
||||
equation += "Efficiency = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " * exp(-(" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " / E)<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3))) + "</sup>) * " +
|
||||
"(1 - exp(-" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4))) + " * (1 / (E - " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5))) + "))<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6))) + "</sup>))";
|
||||
}
|
||||
break;
|
||||
case 95: // HAE Efficiency (1-2-3): y = S * exp(-(E1/x)^k) * (1- exp(-b*(1/(x-E2))^m)) *(1 - exp(-(2*E3/(E-E3))^n))
|
||||
if(p_size == 8) {
|
||||
equation += "Efficiency = "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1)))+" * exp(-("+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2)))+" / E)<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3)))+"</sup>) * "+
|
||||
"(1 - exp(-"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4)))+" * (1 / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6)))+"</sup>)) * "+
|
||||
"(1 - exp(-(2 * "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+" / (E - "+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7)))+"))<sup style=\"vertical-align:super;\">"+NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(8)))+"</sup>))";
|
||||
if (p_size == 8) {
|
||||
equation += "Efficiency = " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(1))) + " * exp(-(" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(2))) + " / E)<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(3))) + "</sup>) * " +
|
||||
"(1 - exp(-" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(4))) + " * (1 / (E - " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(5))) + "))<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(6))) + "</sup>)) * " +
|
||||
"(1 - exp(-(2 * " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7))) + " / (E - " + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(7))) + "))<sup style=\"vertical-align:super;\">" + NumberFormatUtil.numberFormat(String.valueOf(m_curParam.getP().get(8))) + "</sup>))";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -346,7 +348,8 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 根据DLL解析GammaPHD内容 得到PHDFile实体
|
||||
* @param struct dll解析后的实体
|
||||
*
|
||||
* @param struct dll解析后的实体
|
||||
* @param fileName 文件名称
|
||||
* @param pathName 路径
|
||||
* @param g_counts beta卡出来的gamma数据
|
||||
|
@ -523,7 +526,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
}
|
||||
|
||||
// 初始化默认分析设置
|
||||
if(phd.getHeader().getSystem_type().equalsIgnoreCase("P")) {
|
||||
if (phd.getHeader().getSystem_type().equalsIgnoreCase("P")) {
|
||||
phd.getSetting().setECutAnalysis_Low(35.0);
|
||||
phd.getSetting().setBUpdateCal(true);
|
||||
}
|
||||
|
@ -551,12 +554,13 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 根据ROI卡出来的Gamma数据生成新的GammaPHD文件
|
||||
*
|
||||
* @param pathName 文件存储路径
|
||||
* @param fileName GammaPHD名称
|
||||
* @param struct BetaPHD内容
|
||||
* @param struct BetaPHD内容
|
||||
* @param g_counts ROI卡出来的Gamma数据
|
||||
*/
|
||||
public static void createGammaFile(String pathName,String fileName, EnergySpectrumStruct struct, List<Long> g_counts) {
|
||||
public static void createGammaFile(String pathName, String fileName, EnergySpectrumStruct struct, List<Long> g_counts) {
|
||||
File file = new File(pathName + StrUtil.SLASH + fileName);
|
||||
// 创建PrintWriter对象
|
||||
PrintWriter out = null;
|
||||
|
@ -597,21 +601,21 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
String beforeStr = "";
|
||||
for (int i = 0; i < g_counts.size(); i++) {
|
||||
String str = g_counts.get(i).toString();
|
||||
if(i % 5 == 0) {
|
||||
if (i % 5 == 0) {
|
||||
if (i == 0) {
|
||||
out.printf((i+1)+"");
|
||||
out.printf((i + 1) + "");
|
||||
} else {
|
||||
out.printf("\n" + (i+1) );
|
||||
out.printf("\n" + (i + 1));
|
||||
}
|
||||
beforeStr = i+"";
|
||||
beforeStr = i + "";
|
||||
}
|
||||
|
||||
if(StrUtil.isEmpty(beforeStr)){
|
||||
if (StrUtil.isEmpty(beforeStr)) {
|
||||
beforeStr = str;
|
||||
}
|
||||
// 根据前一个字符长度计算需要的空格
|
||||
out.printf("%" + (str.length() + (6 - beforeStr.length()))+ "s" , g_counts.get(i));
|
||||
if(i == g_counts.size() - 1) {
|
||||
out.printf("%" + (str.length() + (6 - beforeStr.length())) + "s", g_counts.get(i));
|
||||
if (i == g_counts.size() - 1) {
|
||||
out.println();
|
||||
}
|
||||
beforeStr = str;
|
||||
|
@ -628,20 +632,21 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param aList 第一列数据
|
||||
* @param bList 第二列数据
|
||||
* @param cList 第三列数据
|
||||
* @param out
|
||||
*/
|
||||
private static void format(List<Double> aList, List<Double> bList,List<Double> cList,PrintWriter out) {
|
||||
private static void format(List<Double> aList, List<Double> bList, List<Double> cList, PrintWriter out) {
|
||||
for (int i = 0; i < aList.size(); i++) {
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.000000");
|
||||
String a = decimalFormat.format(aList.get(i));
|
||||
String b = decimalFormat.format(bList.get(i));
|
||||
String c = decimalFormat.format(cList.get(i));
|
||||
out.print(a);
|
||||
out.printf("%" + ( b.length() + (17 - a.length())) + "s", b);
|
||||
out.printf("%" + ( c.length() + (17 - b.length())) + "s", c+"\n");
|
||||
out.printf("%" + (b.length() + (17 - a.length())) + "s", b);
|
||||
out.printf("%" + (c.length() + (17 - b.length())) + "s", c + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,22 +657,22 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
String dataType = struct.data_type;
|
||||
//Collection Start
|
||||
Date CollectionStart = null;
|
||||
if ( StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time) ){
|
||||
if (StringUtils.isNotBlank(struct.collection_start_date) && StringUtils.isNotBlank(struct.collection_start_time)) {
|
||||
CollectionStart = DateUtils.parseDate(struct.collection_start_date + StringPool.SPACE + struct.collection_start_time);
|
||||
}
|
||||
//Collection Stop
|
||||
Date CollectionStop = null;
|
||||
if ( StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time) ){
|
||||
if (StringUtils.isNotBlank(struct.collection_stop_date) && StringUtils.isNotBlank(struct.collection_stop_time)) {
|
||||
CollectionStop = DateUtils.parseDate(struct.collection_stop_date + StringPool.SPACE + struct.collection_stop_time);
|
||||
}
|
||||
//Collection Time
|
||||
String CollectionTime = "";
|
||||
if ( Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop) ){
|
||||
CollectionTime = String.format ("%.2f",Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime())/ 1000));
|
||||
if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) {
|
||||
CollectionTime = String.format("%.2f", Double.valueOf((CollectionStop.getTime() - CollectionStart.getTime()) / 1000));
|
||||
}
|
||||
//Acquisition Start
|
||||
Date AcquisitionStart = null;
|
||||
if ( StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time) ){
|
||||
if (StringUtils.isNotBlank(struct.acquisition_start_date) && StringUtils.isNotBlank(struct.acquisition_start_time)) {
|
||||
AcquisitionStart = DateUtils.parseDate(struct.acquisition_start_date + StringPool.SPACE + struct.acquisition_start_time);
|
||||
}
|
||||
//Acq Real Time
|
||||
|
@ -687,7 +692,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
//measurementId
|
||||
String measurementId = struct.measurement_id;
|
||||
detailedMap.put("sampleId", sampleId);
|
||||
detailedMap.put("stationCode",struct.site_code);
|
||||
detailedMap.put("stationCode", struct.site_code);
|
||||
detailedMap.put("detectorCode", struct.detector_code);
|
||||
detailedMap.put("systemType", struct.system_type);
|
||||
detailedMap.put("dataType", dataType);
|
||||
|
@ -699,7 +704,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
detailedMap.put("collectionTime", CollectionTime);
|
||||
double timeSpan = 0.0;
|
||||
if (Objects.nonNull(CollectionStart) && Objects.nonNull(CollectionStop)) {
|
||||
timeSpan = (CollectionStop.getTime()/1000 - CollectionStart.getTime()/1000) / 3600.0;
|
||||
timeSpan = (CollectionStop.getTime() / 1000 - CollectionStart.getTime() / 1000) / 3600.0;
|
||||
}
|
||||
// detailedMap.put("samplingTime", String.format("%.2f", timeSpan));
|
||||
detailedMap.put("airVolume", String.format("%.5f", airVolume));
|
||||
|
@ -712,7 +717,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
detailedMap.put("acquisitionLiveTime", String.format("%.2f", AcquisitionLiveTime));
|
||||
double timespan = 0.0;
|
||||
if (Objects.nonNull(AcquisitionStart) && Objects.nonNull(CollectionStop)) {
|
||||
timespan = (AcquisitionStart.getTime()/1000 - CollectionStop.getTime()/1000);
|
||||
timespan = (AcquisitionStart.getTime() / 1000 - CollectionStop.getTime() / 1000);
|
||||
}
|
||||
// detailedMap.put("acquisitionDecayTime", String.format("%.2f", timespan / 3600.0));
|
||||
// todo 分级暂时定为1
|
||||
|
@ -727,15 +732,16 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* beta分析
|
||||
* @param nuclideMap 核素参数
|
||||
* @param POI_G_y1 limit gamma
|
||||
* @param POI_G_y2 limit gamma
|
||||
* @param betaPhdFile betaPhd文件地址
|
||||
*
|
||||
* @param nuclideMap 核素参数
|
||||
* @param POI_G_y1 limit gamma
|
||||
* @param POI_G_y2 limit gamma
|
||||
* @param betaPhdFile betaPhd文件地址
|
||||
* @param gammaPhdFiles gammaPHD
|
||||
* @throws JsonProcessingException
|
||||
*/
|
||||
public static List<GardsXeResultsSpectrum> betaAnalyse(HashMap<String, NuclideLine> nuclideMap, List<Double> POI_G_y1,
|
||||
List<Double> POI_G_y2, String betaPhdFile, PHDFile ... gammaPhdFiles) {
|
||||
List<Double> POI_G_y2, String betaPhdFile, PHDFile... gammaPhdFiles) {
|
||||
List<GardsXeResultsSpectrum> xeDataList = Lists.newArrayList();
|
||||
|
||||
// 获取峰面积、半衰期、发射几率
|
||||
|
@ -747,29 +753,39 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
if (StrUtil.isNotBlank(resultStr)) {
|
||||
xeDataList = JSON.parseArray(resultStr, GardsXeResultsSpectrum.class);
|
||||
xeDataList.forEach(GardsXeResultsSpectrum::getMdc);
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)){
|
||||
for (GardsXeResultsSpectrum xeData:xeDataList) {
|
||||
if (CollectionUtils.isNotEmpty(xeDataList)) {
|
||||
for (GardsXeResultsSpectrum xeData : xeDataList) {
|
||||
Double conc = xeData.getConc();
|
||||
Double mdc = xeData.getMdc();
|
||||
if (conc <= 0){
|
||||
if (conc <= 0) {
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
} else if (0 < conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
HashMap<String, Object> param = (HashMap<String, Object>) nuclideParam.get(xeData.getNuclideName());
|
||||
// 如果gamma谱没有识别出对应的核素 nidFlag则置为0
|
||||
if (xeData.getNidFlag() == 1) {
|
||||
HashMap<String, Object> param = (HashMap<String, Object>) nuclideParam.get(xeData.getNuclideName());
|
||||
xeData.setNidFlag((boolean) param.get("exist") ? 1 : 0);
|
||||
}
|
||||
xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc()))));
|
||||
xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc()))));
|
||||
xeData.setConcErr(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConcErr()))));
|
||||
xeData.setMda(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMda()))));
|
||||
if ((boolean) param.get("exist")) {
|
||||
xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc()))));
|
||||
xeData.setConc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConc()))));
|
||||
xeData.setConcErr(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getConcErr()))));
|
||||
xeData.setMda(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMda()))));
|
||||
xeData.setRoiOrPeakFit("P");
|
||||
}
|
||||
else {
|
||||
xeData.setMdc(Double.valueOf(NumberFormatUtil.numberSixLen(String.valueOf(xeData.getMdc()))));
|
||||
xeData.setConc(0.0);
|
||||
xeData.setConcErr(0.0);
|
||||
xeData.setRoiOrPeakFit("R");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -778,10 +794,11 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 获取
|
||||
*
|
||||
* @param xeResultsList
|
||||
* @return
|
||||
*/
|
||||
public static List<GardsROIResultsSpectrum> getRoiResult (List<GardsXeResultsSpectrum> xeResultsList) {
|
||||
public static List<GardsROIResultsSpectrum> getRoiResult(List<GardsXeResultsSpectrum> xeResultsList) {
|
||||
List<GardsROIResultsSpectrum> results = Lists.newArrayList();
|
||||
for (GardsXeResultsSpectrum xe : xeResultsList) {
|
||||
GardsROIResultsSpectrum gardsRoiResults = new GardsROIResultsSpectrum();
|
||||
|
@ -807,11 +824,12 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 获取结算结果需要的参数(峰面积、半衰期、发射几率)
|
||||
*
|
||||
* @param gStart RoiLimit Gamma Start
|
||||
* @param gStop RoiLimit Gamma Stop
|
||||
* @param gStop RoiLimit Gamma Stop
|
||||
*/
|
||||
public static HashMap<String, Object> getBetaAnalyseNuclideParam(HashMap<String, NuclideLine> nuclideMap,
|
||||
List<Double> gStart, List<Double> gStop, PHDFile ...phdFiles) {
|
||||
List<Double> gStart, List<Double> gStop, PHDFile... phdFiles) {
|
||||
HashMap<String, Object> param = Maps.newHashMap();
|
||||
String mapKey = "";
|
||||
// 遍历roiLimit
|
||||
|
@ -840,11 +858,10 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
// 发射几率
|
||||
nuclideParam.put("yield", nuclideMap.get(nuclideName).getYield().toString());
|
||||
// 半衰期
|
||||
nuclideParam.put("halflife", nuclideMap.get(nuclideName).getHalflife().toString());
|
||||
// baseline 计数,这里使用的energy是固定的 从配置文件中取出
|
||||
nuclideParam.put("lcConst", "2.33");
|
||||
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) +"");
|
||||
nuclideParam.put("baseline", getBetaAnalyseBaseLineCount(phdFiles[g], nuclideName, nuclideMap.get(nuclideName).getEnergy()) + "");
|
||||
for (PeakInfo info : vPeak) {
|
||||
double energy = info.energy;
|
||||
// 找匹配roi范围的 energy
|
||||
|
@ -853,7 +870,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
// 峰如果没有识别到核素则跳过
|
||||
if (info.nuclides.contains(nuclideName)) {
|
||||
// 峰面积
|
||||
nuclideParam.put("area", area+"");
|
||||
nuclideParam.put("area", area + "");
|
||||
nuclideParam.put("exist", true);
|
||||
break;
|
||||
} else {
|
||||
|
@ -870,6 +887,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
switch (nuclideName) {
|
||||
case "Xe131M":
|
||||
phd = phdFiles[0];
|
||||
fwhm = 0.2;
|
||||
// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()),
|
||||
// nuclideMap.get(nuclideName).getEnergy()) * 1.25;
|
||||
// left = 29.7 - fwhm;
|
||||
|
@ -877,25 +895,28 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
break;
|
||||
case "Xe133M":
|
||||
phd = phdFiles[1];
|
||||
fwhm = 0.2;
|
||||
// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), nuclideMap.get(nuclideName).getEnergy());
|
||||
// left = 29.7 - fwhm;
|
||||
// right = 29.7 + fwhm;
|
||||
break;
|
||||
case "Xe133":
|
||||
phd = phdFiles[2];
|
||||
fwhm = 0.5;
|
||||
// fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), nuclideMap.get(nuclideName).getEnergy());
|
||||
// left = 81 - fwhm;
|
||||
// right = 81 + fwhm;
|
||||
break;
|
||||
case "Xe135":
|
||||
phd = phdFiles[3];
|
||||
fwhm = 0.5;
|
||||
// left = 249.8 - fwhm;
|
||||
// right = 249.8 + fwhm;
|
||||
break;
|
||||
}
|
||||
energy = nuclideMap.get(nuclideName).getEnergy();
|
||||
counts = phd.getSpec().getCounts();
|
||||
fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), energy) * 1.25;
|
||||
//fwhm = getFwhm(phd.getMapResoPara().get(phd.getUsedReso()), energy) * 1.25;
|
||||
|
||||
// 能量转化为道址
|
||||
// 能量转化道址公式参数
|
||||
|
@ -917,11 +938,11 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
double rc = gFittingPara.get(0) + gFittingPara.get(1) * right + gFittingPara.get(2) * Math.sqrt(right);*/
|
||||
// 面积=计数总和:通过能量卡一个范围,将范围内的计数加和
|
||||
int area = 0;
|
||||
for (int i = (int)lc; i <= (int) rc; i++) {
|
||||
for (int i = (int) lc; i <= (int) rc; i++) {
|
||||
area += counts.get(i);
|
||||
}
|
||||
nuclideParam.put("exist", false);
|
||||
nuclideParam.put("area", area+"");
|
||||
nuclideParam.put("area", area + "");
|
||||
|
||||
}
|
||||
param.put(mapKey, nuclideParam);
|
||||
|
@ -931,9 +952,10 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 得到 baseline计数
|
||||
* @param phd PHDFile
|
||||
*
|
||||
* @param phd PHDFile
|
||||
* @param nuclideName 核素名称
|
||||
* @param energy 能量
|
||||
* @param energy 能量
|
||||
* @return
|
||||
*/
|
||||
public static double getBetaAnalyseBaseLineCount(PHDFile phd, String nuclideName, Double energy) {
|
||||
|
@ -961,7 +983,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
Console.log("nuclide:{},energy:{},fwhmR:{},endChannel:{}",nuclideName, energy, (fwhm + Math.pow(fwhm, 1.25)), end);
|
||||
if (begin >= 0 && end <= vBase.size()) {
|
||||
for (long i = begin; i < end; i++) {
|
||||
baseLineCount += vBase.get((int)i);
|
||||
baseLineCount += vBase.get((int) i);
|
||||
}
|
||||
}
|
||||
return baseLineCount;
|
||||
|
@ -970,11 +992,11 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
public static Double getFwhm(ParameterInfo m_curParam, Double energy) {
|
||||
Double fwhm = 0.0;
|
||||
// 公式参数
|
||||
int p_size = m_curParam.getP().size()-1;
|
||||
if(p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
|
||||
int p_size = m_curParam.getP().size() - 1;
|
||||
if (p_size >= 2 && m_curParam.getP().get(1) > 0 && m_curParam.getP().get(2) > 0) {
|
||||
fwhm = m_curParam.getP().get(1) + energy * m_curParam.getP().get(2);
|
||||
for(int i=3; i<=p_size; i++) {
|
||||
fwhm += (Math.pow(energy, (i-1)) * m_curParam.getP().get(i));
|
||||
for (int i = 3; i <= p_size; i++) {
|
||||
fwhm += (Math.pow(energy, (i - 1)) * m_curParam.getP().get(i));
|
||||
}
|
||||
fwhm = Math.pow(fwhm, 0.5);
|
||||
}
|
||||
|
@ -987,9 +1009,10 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
/**
|
||||
* 自建台站beta报告
|
||||
*
|
||||
* @param sampleId
|
||||
* @param sampleStruct sample
|
||||
* @param qcStruct qc
|
||||
* @param sampleStruct sample
|
||||
* @param qcStruct qc
|
||||
* @param selfXeResults 分析结果
|
||||
* @return
|
||||
*/
|
||||
|
@ -1007,27 +1030,28 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
handleNetCount(selfXeResults);
|
||||
handleConcetration(selfXeResults);
|
||||
handleResult(selfXeResults);
|
||||
if(null != sampleStruct) {
|
||||
if (null != sampleStruct) {
|
||||
SelfBaseUtil.qcStruct = qcStruct;
|
||||
}
|
||||
|
||||
return reportContent.toString();
|
||||
}
|
||||
|
||||
public static void createReport(Integer sampleId, String finalReportPath, EnergySpectrumStruct sampleStruct,
|
||||
EnergySpectrumStruct qcStruct, List<GardsXeResultsSpectrum> selfXeResults) {
|
||||
getReport(sampleId, sampleStruct, qcStruct, selfXeResults);
|
||||
|
||||
if(!FileUtil.exist(finalReportPath)){
|
||||
FileUtil.writeString(reportContent.toString(), finalReportPath,"utf-8");
|
||||
}else {
|
||||
FileUtil.appendString(reportContent.toString(), finalReportPath,"utf-8");
|
||||
if (!FileUtil.exist(finalReportPath)) {
|
||||
FileUtil.writeString(reportContent.toString(), finalReportPath, "utf-8");
|
||||
} else {
|
||||
FileUtil.appendString(reportContent.toString(), finalReportPath, "utf-8");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理报告头
|
||||
*/
|
||||
private static void handleReportHeader(){
|
||||
private static void handleReportHeader() {
|
||||
String header_1 = "%-64s CNL06 GENERATED REPORT";
|
||||
String header_2 = "%-63s AUTO RADIONUCLIDE REPORT";
|
||||
String header_3 = "%-65s (Noble Gas Version) ";
|
||||
|
@ -1035,18 +1059,18 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
final String createDate = DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss");
|
||||
reportContent.append(String.format(header_1, StringConstant.SPACE));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(header_2,StringConstant.SPACE));
|
||||
reportContent.append(String.format(header_2, StringConstant.SPACE));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(header_3,StringConstant.SPACE));
|
||||
reportContent.append(String.format(header_3, StringConstant.SPACE));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(createDateLine,StringConstant.SPACE,createDate));
|
||||
reportContent.append(String.format(createDateLine, StringConstant.SPACE, createDate));
|
||||
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理#FILE INFORMATION 模块
|
||||
*/
|
||||
private static void handleFileInfoMation(){
|
||||
private static void handleFileInfoMation() {
|
||||
String fileBlock = "#FILE INFORMATION";
|
||||
String sampleMeasId = " SampleMeasID:%-36s %s";
|
||||
String gasMeasId = " GASBKMeasID:%-37s %s";
|
||||
|
@ -1055,22 +1079,22 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
String detectorType = " Detector Type:%-35s %s";
|
||||
reportContent.append(fileBlock);
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(sampleMeasId,StringConstant.SPACE,sampleStruct.measurement_id));
|
||||
reportContent.append(String.format(sampleMeasId, StringConstant.SPACE, sampleStruct.measurement_id));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(gasMeasId,StringConstant.SPACE,sampleStruct.gas_bk_measurement_id));
|
||||
reportContent.append(String.format(gasMeasId, StringConstant.SPACE, sampleStruct.gas_bk_measurement_id));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(detMeasId,StringConstant.SPACE,sampleStruct.detector_bk_measurement_id));
|
||||
reportContent.append(String.format(detMeasId, StringConstant.SPACE, sampleStruct.detector_bk_measurement_id));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(srId,StringConstant.SPACE,sampleStruct.sample_ref_id));
|
||||
reportContent.append(String.format(srId, StringConstant.SPACE, sampleStruct.sample_ref_id));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(detectorType,StringConstant.SPACE,"3D b-g"));
|
||||
reportContent.append(String.format(detectorType, StringConstant.SPACE, "3D b-g"));
|
||||
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理#COLLECTION INFORMATION 模块
|
||||
*/
|
||||
private static void handleCollectionInfoMation(Integer sampleId){
|
||||
private static void handleCollectionInfoMation(Integer sampleId) {
|
||||
String collectionInfoBlock = "#COLLECTION INFORMATION";
|
||||
String stationId = " Station ID:%-38s %s";
|
||||
String detectorId = " Detector ID:%-37s %s";
|
||||
|
@ -1082,55 +1106,55 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
String xeVolume = " Xe Volume[cm3]:%-34s %s";
|
||||
reportContent.append(collectionInfoBlock);
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(stationId,StringConstant.SPACE,sampleStruct.site_code));
|
||||
reportContent.append(String.format(stationId, StringConstant.SPACE, sampleStruct.site_code));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(detectorId,StringConstant.SPACE,sampleStruct.detector_code));
|
||||
reportContent.append(String.format(detectorId, StringConstant.SPACE, sampleStruct.detector_code));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(sampleIdLabel,StringConstant.SPACE, sampleId));
|
||||
reportContent.append(String.format(sampleIdLabel, StringConstant.SPACE, sampleId));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(collectionStart,StringConstant.SPACE,sampleStruct.collection_start_date+StringConstant.SPACE+sampleStruct.collection_start_time));
|
||||
reportContent.append(String.format(collectionStart, StringConstant.SPACE, sampleStruct.collection_start_date + StringConstant.SPACE + sampleStruct.collection_start_time));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(collectionStop,StringConstant.SPACE,sampleStruct.collection_stop_date+StringConstant.SPACE+sampleStruct.collection_stop_time));
|
||||
reportContent.append(String.format(collectionStop, StringConstant.SPACE, sampleStruct.collection_stop_date + StringConstant.SPACE + sampleStruct.collection_stop_time));
|
||||
reportContent.append(System.lineSeparator());
|
||||
DateTime collectStart = DateUtil.parse(sampleStruct.collection_start_date + StringConstant.SPACE + sampleStruct.collection_start_time);
|
||||
DateTime collectStop = DateUtil.parse(sampleStruct.collection_stop_date + StringConstant.SPACE + sampleStruct.collection_stop_time);
|
||||
|
||||
reportContent.append(String.format(collectionTime,StringConstant.SPACE,String.valueOf((collectStop.getTime() - collectStart.getTime())/1000)));
|
||||
reportContent.append(String.format(collectionTime, StringConstant.SPACE, String.valueOf((collectStop.getTime() - collectStart.getTime()) / 1000)));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(airVolume,StringConstant.SPACE,String.valueOf(sampleStruct.air_volume)));
|
||||
reportContent.append(String.format(airVolume, StringConstant.SPACE, String.valueOf(sampleStruct.air_volume)));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(xeVolume,StringConstant.SPACE,String.valueOf(sampleStruct.sample_volume_of_Xe)));
|
||||
reportContent.append(String.format(xeVolume, StringConstant.SPACE, String.valueOf(sampleStruct.sample_volume_of_Xe)));
|
||||
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理#ACQUISITION INFORMATION 模块
|
||||
*/
|
||||
private static void handleAcquisitionInfoMation(){
|
||||
private static void handleAcquisitionInfoMation() {
|
||||
String acqInfoBlock = "#ACQUISITION INFORMATION";
|
||||
String acquisitionStart = " Acquisition Start:%-31s %s";
|
||||
String acqRealTime = " Acq Real Time(s):%-32s %s";
|
||||
String acqLiveTime = " Acq Live Time(s):%-32s %s";
|
||||
reportContent.append(acqInfoBlock);
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(acquisitionStart,StringConstant.SPACE,sampleStruct.acquisition_start_date+StringConstant.SPACE+sampleStruct.acquisition_start_time));
|
||||
reportContent.append(String.format(acquisitionStart, StringConstant.SPACE, sampleStruct.acquisition_start_date + StringConstant.SPACE + sampleStruct.acquisition_start_time));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(acqRealTime,StringConstant.SPACE,String.valueOf(sampleStruct.acquisition_real_time)));
|
||||
reportContent.append(String.format(acqRealTime, StringConstant.SPACE, String.valueOf(sampleStruct.acquisition_real_time)));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(String.format(acqLiveTime,StringConstant.SPACE,String.valueOf(sampleStruct.acquisition_live_time)));
|
||||
reportContent.append(String.format(acqLiveTime, StringConstant.SPACE, String.valueOf(sampleStruct.acquisition_live_time)));
|
||||
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理#SOFTWARE 模块
|
||||
*/
|
||||
private static void handleSoftware(){
|
||||
private static void handleSoftware() {
|
||||
String softwareBlock = "#SOFTWARE";
|
||||
String version = " version:%-42s %s";
|
||||
reportContent.append(softwareBlock);
|
||||
reportContent.append(System.lineSeparator());
|
||||
// reportContent.append(String.format(version,StringConstant.SPACE, spectrumServiceQuotes.getSoftwareProperties().getSwVersion()));
|
||||
reportContent.append(String.format(version,StringConstant.SPACE, "1.0"));
|
||||
reportContent.append(String.format(version, StringConstant.SPACE, "1.0"));
|
||||
reportContent.append(System.lineSeparator()).append(System.lineSeparator());
|
||||
}
|
||||
|
||||
|
@ -1140,7 +1164,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
reportContent.append(String.format("%sNew Beta%-43sNew Gamma%-42s", StringPool.SPACE, StringPool.SPACE, StringPool.SPACE));
|
||||
reportContent.append(System.lineSeparator());
|
||||
|
||||
if(null == struct) {
|
||||
if (null == struct) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1176,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
//计算得到C to E公式数据
|
||||
List<Double> bFittingPara = EnergySpectrumHandler.GetFileFittingPara(bChannel, bElectronEnergy);
|
||||
List<String> bFittingParaStr = new LinkedList<>();
|
||||
for (Double para:bFittingPara) {
|
||||
for (Double para : bFittingPara) {
|
||||
bFittingParaStr.add(String.valueOf(para));
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("0.000000");
|
||||
|
@ -1169,7 +1193,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
//计算C to E公式参数
|
||||
List<Double> gFittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel, gEnergy);
|
||||
List<String> gFittingParaStr = new LinkedList<>();
|
||||
for (Double para:gFittingPara) {
|
||||
for (Double para : gFittingPara) {
|
||||
gFittingParaStr.add(String.valueOf(para));
|
||||
}
|
||||
String newGammaGasCHStr = String.format("CH(x) = (%s)+(%s)*x+(%s)x*x%-24s",
|
||||
|
@ -1177,13 +1201,13 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
(NumberFormatUtil.numberSixLen(gFittingParaStr.get(1))),
|
||||
(NumberFormatUtil.numberSixLen(gFittingParaStr.get(2))),
|
||||
StringPool.SPACE);
|
||||
reportContent.append(String.format("%s%-"+(52-newBetaGasCHStr.length())+"s%s", newBetaGasCHStr, StringPool.SPACE, newGammaGasCHStr));
|
||||
reportContent.append(String.format("%s%-" + (52 - newBetaGasCHStr.length()) + "s%s", newBetaGasCHStr, StringPool.SPACE, newGammaGasCHStr));
|
||||
reportContent.append(System.lineSeparator());
|
||||
|
||||
//E to C
|
||||
List<Double> bFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel);
|
||||
List<String> bFittingParaToUiStr = new LinkedList<>();
|
||||
for (Double para:bFittingParaToUi) {
|
||||
for (Double para : bFittingParaToUi) {
|
||||
bFittingParaToUiStr.add(String.valueOf(para));
|
||||
}
|
||||
//拼接新计算公式 E
|
||||
|
@ -1195,7 +1219,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
//计算E to C公式参数
|
||||
List<Double> gFittingParaToUi = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel);
|
||||
List<String> gFittingParaToUiStr = new LinkedList<>();
|
||||
for (Double para:gFittingParaToUi) {
|
||||
for (Double para : gFittingParaToUi) {
|
||||
gFittingParaToUiStr.add(String.valueOf(para));
|
||||
}
|
||||
String newGammaGasEStr = String.format("E(x) = (%s)+(%s)*x+(%s)x*x%-24s",
|
||||
|
@ -1203,7 +1227,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
(NumberFormatUtil.numberSixLen(gFittingParaToUiStr.get(1))),
|
||||
(NumberFormatUtil.numberSixLen(gFittingParaToUiStr.get(2))),
|
||||
StringPool.SPACE);
|
||||
reportContent.append(String.format("%s%"+(52-newBetaGasEStr.length())+"s%s", newBetaGasEStr, StringPool.SPACE, newGammaGasEStr));
|
||||
reportContent.append(String.format("%s%" + (52 - newBetaGasEStr.length()) + "s%s", newBetaGasEStr, StringPool.SPACE, newGammaGasEStr));
|
||||
reportContent.append(System.lineSeparator());
|
||||
reportContent.append(System.lineSeparator());
|
||||
}
|
||||
|
@ -1216,7 +1240,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
reportContent.append(System.lineSeparator());
|
||||
for (int i = 0; i < sampleStruct.POI_B_x1.size(); i++) {
|
||||
reportContent.append(String.format(limitRoi, StringPool.SPACE, i + 1,
|
||||
sampleStruct.POI_B_x1.get(i)+" to " + sampleStruct.POI_B_x2.get(i),
|
||||
sampleStruct.POI_B_x1.get(i) + " to " + sampleStruct.POI_B_x2.get(i),
|
||||
sampleStruct.POI_G_y1.get(i) + " to " + sampleStruct.POI_G_y2.get(i)));
|
||||
reportContent.append(System.lineSeparator());
|
||||
}
|
||||
|
@ -1235,7 +1259,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
for (GardsROIResultsSpectrum result : roiResult) {
|
||||
reportContent.append(String.format(netRoi, StringPool.SPACE, result.getRoi(),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getNet())) +" +/- "+
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getNet())) + " +/- " +
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getNetErr())),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getLc()))));
|
||||
reportContent.append(System.lineSeparator());
|
||||
|
@ -1253,7 +1277,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
|
||||
for (GardsROIResultsSpectrum result : roiResult) {
|
||||
reportContent.append(String.format(conLcRoi, StringPool.SPACE, result.getRoi(),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) +" +/- "+
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) + " +/- " +
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getLc())),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getMdc())))
|
||||
|
@ -1273,7 +1297,7 @@ public class SelfBaseUtil extends AbstractLogOrReport {
|
|||
reportContent.append(System.lineSeparator());
|
||||
for (GardsROIResultsSpectrum result : roiResult) {
|
||||
reportContent.append(String.format(resultSum, StringPool.SPACE, result.getRoi(),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) +" +/- "+
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConc())) + " +/- " +
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getConcErr())),
|
||||
NumberFormatUtil.numberSixLen(String.valueOf(result.getMdc())),
|
||||
|
|
Loading…
Reference in New Issue
Block a user