Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
f4876a5863
|
@ -1276,13 +1276,21 @@ public class FileFtransitUtil {
|
|||
char[] cal_info = new char[128];
|
||||
cal_info[0] = '0';
|
||||
int offset = 32; // 32 Bytes Calibration file name
|
||||
String temp = GetDate(datas.getCalibra_time().substring(0, 10));
|
||||
String temp = "";
|
||||
if (StringUtils.isNotBlank(datas.getCalibra_time())) {
|
||||
temp = GetDate(datas.getCalibra_time().substring(0, 10));
|
||||
} else {
|
||||
temp = GetDate("");
|
||||
}
|
||||
for(int i=0; i<temp.length(); ++i) {
|
||||
cal_info[i+offset] = temp.charAt(i);
|
||||
}
|
||||
|
||||
offset += 10; // 10 Bytes Cal_Date
|
||||
String str = datas.getCalibra_time().substring(datas.getCalibra_time().length()-10).substring(0, 8);
|
||||
String str = "";
|
||||
if (StringUtils.isNotBlank(datas.getCalibra_time())) {
|
||||
str = datas.getCalibra_time().substring(datas.getCalibra_time().length()-10).substring(0, 8);
|
||||
}
|
||||
for(int i=0; i<str.length(); ++i) {
|
||||
cal_info[i+offset] = str.charAt(i);
|
||||
}
|
||||
|
@ -1404,7 +1412,7 @@ public class FileFtransitUtil {
|
|||
}
|
||||
|
||||
public byte[] AnalyseSPC(SpcHead1 m_head1, SpcHead2 m_head2, GermaniumCalib m_calibParam) {
|
||||
String standard_spc = parameterProperties.getFilePath()+"/standard.SPC";
|
||||
String standard_spc = parameterProperties.getFilePath()+StringPool.SLASH+"standard.SPC";
|
||||
File standardSpc = new File(standard_spc);
|
||||
if(!standardSpc.exists()) {
|
||||
String Warning = standard_spc + " isn't exist.";
|
||||
|
@ -1602,28 +1610,35 @@ public class FileFtransitUtil {
|
|||
}
|
||||
|
||||
public String GetDate(String str) {
|
||||
str = str.substring(0, 10); // YYYY/MM/DD
|
||||
String temp = str.substring(str.length()-2)+ StringPool.DASH; // DD-
|
||||
int month = Integer.valueOf(str.substring(5, 7));
|
||||
switch(month) { // DD-MMM
|
||||
case 1: temp+="Jan"; break;
|
||||
case 2: temp+="Feb"; break;
|
||||
case 3: temp+="Mar"; break;
|
||||
case 4: temp+="Apr"; break;
|
||||
case 5: temp+="May"; break;
|
||||
case 6: temp+="Jun"; break;
|
||||
case 7: temp+="Jul"; break;
|
||||
case 8: temp+="Aug"; break;
|
||||
case 9: temp+="Sep"; break;
|
||||
case 10: temp+="Oct"; break;
|
||||
case 11: temp+="Nov"; break;
|
||||
case 12: temp+="Dec"; break;
|
||||
default: temp+="Jan"; break;
|
||||
}
|
||||
temp+=String.format("-%s", str.substring(2, 4)); // DD-MMM-YY
|
||||
if(str.substring(0, 2) == "20") { // DD-MMM-YY*
|
||||
temp+="1";
|
||||
String temp = "";
|
||||
if (StringUtils.isNotBlank(str)) {
|
||||
str = str.substring(0, 10); // YYYY/MM/DD
|
||||
temp = str.substring(str.length()-2)+ StringPool.DASH; // DD-
|
||||
int month = Integer.valueOf(str.substring(5, 7));
|
||||
switch(month) { // DD-MMM
|
||||
case 1: temp+="Jan"; break;
|
||||
case 2: temp+="Feb"; break;
|
||||
case 3: temp+="Mar"; break;
|
||||
case 4: temp+="Apr"; break;
|
||||
case 5: temp+="May"; break;
|
||||
case 6: temp+="Jun"; break;
|
||||
case 7: temp+="Jul"; break;
|
||||
case 8: temp+="Aug"; break;
|
||||
case 9: temp+="Sep"; break;
|
||||
case 10: temp+="Oct"; break;
|
||||
case 11: temp+="Nov"; break;
|
||||
case 12: temp+="Dec"; break;
|
||||
default: temp+="Jan"; break;
|
||||
}
|
||||
temp+=String.format("-%s", str.substring(2, 4)); // DD-MMM-YY
|
||||
if(str.substring(0, 2) == "20") { // DD-MMM-YY*
|
||||
temp+="1";
|
||||
} else {
|
||||
temp+="0";
|
||||
}
|
||||
} else {
|
||||
temp = StringPool.DASH;
|
||||
temp+="Jan";
|
||||
temp+="0";
|
||||
}
|
||||
return temp;
|
||||
|
|
|
@ -3,26 +3,25 @@ package org.jeecg.modules.entity.vo;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AnalyseExtInfo implements Serializable {
|
||||
|
||||
private Integer sampleId;
|
||||
private List<Double> eb;
|
||||
|
||||
private String dbName;
|
||||
private List<Double> nx;
|
||||
|
||||
private String sampleFileName;
|
||||
private List<Double> ny;
|
||||
|
||||
private String detFileName;
|
||||
|
||||
private Integer gammaBegin;
|
||||
|
||||
private Integer gammaEnd;
|
||||
private Double acqRealTime;
|
||||
|
||||
private Double minEnergy;
|
||||
|
||||
private Double halfLife;
|
||||
|
||||
private String acqStartTime;
|
||||
|
||||
private String fitType;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package org.jeecg.modules.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ChangeExtInfo implements Serializable {
|
||||
|
||||
private Integer sampleId;
|
||||
|
||||
private String dbName;
|
||||
|
||||
private String sampleFileName;
|
||||
|
||||
private String detFileName;
|
||||
|
||||
private Integer gammaBegin;
|
||||
|
||||
private Integer gammaEnd;
|
||||
|
||||
private Double minEnergy;
|
||||
|
||||
private Double halfLife;
|
||||
|
||||
private String fitType;
|
||||
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.modules.base.bizVo.GammaRLR;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.feignclient.SystemClient;
|
||||
|
@ -17,7 +15,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("gamma")
|
||||
|
@ -223,6 +220,11 @@ public class GammaController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("KorSumAnalyse")
|
||||
public Result KorSumAnalyse(@RequestBody List<InputData> inputDataList) {
|
||||
return gammaService.KorSumAnalyse(inputDataList);
|
||||
}
|
||||
|
||||
@GetMapping("energyCalibration")
|
||||
@ApiOperation(value = "查看Energy Calibration数据", notes = "查看Energy Calibration数据")
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width, HttpServletRequest request) {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.modules.base.bizVo.BetaRLR;
|
||||
import org.jeecg.modules.entity.GardsSampleDataSpectrum;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
|
@ -20,10 +15,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("spectrumAnalysis")
|
||||
|
@ -148,6 +139,11 @@ public class SpectrumAnalysesController {
|
|||
return spectrumAnalysisService.viewExtrapolation(sampleId, sampleFileName, request);
|
||||
}
|
||||
|
||||
@PostMapping("changeDataExtrapolation")
|
||||
public Result changeDataExtrapolation(@RequestBody ChangeExtInfo extInfo, HttpServletRequest request) {
|
||||
return spectrumAnalysisService.changeDataExtrapolation(extInfo, request);
|
||||
}
|
||||
|
||||
@PostMapping("analyseExtrapolation")
|
||||
public Result analyseExtrapolation(@RequestBody AnalyseExtInfo extInfo, HttpServletRequest request) {
|
||||
return spectrumAnalysisService.analyseExtrapolation(extInfo, request);
|
||||
|
|
|
@ -70,16 +70,14 @@ public interface IGammaService{
|
|||
|
||||
Result ZeroTimeAnalyse(String nuclide1, String nuclide2, Double product1, Double product2, String target, String energyTFH, String date, String time);
|
||||
|
||||
void exportZeroTimeAnalyse(String nuclide1, String nuclide2,
|
||||
Double product1, Double product2,
|
||||
String target, String energyTFH,
|
||||
String date, String time,
|
||||
HttpServletResponse response);
|
||||
void exportZeroTimeAnalyse(String nuclide1, String nuclide2, Double product1, Double product2, String target, String energyTFH, String date, String time, HttpServletResponse response);
|
||||
|
||||
Result Korsum();
|
||||
|
||||
List<InputData> KorSumInput(CoeffData coeffData);
|
||||
|
||||
Result KorSumAnalyse(List<InputData> inputDataList);
|
||||
|
||||
Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width, HttpServletRequest request);
|
||||
|
||||
Result changeDataEnergy(List<Double> m_vCurCentroid, List<Double> m_vCurEnergy, List<Double> m_vCurUncert, ParameterInfo m_curParam, Integer sampleId, String fileName, Double width, HttpServletRequest request);
|
||||
|
|
|
@ -52,6 +52,8 @@ public interface ISpectrumAnalysisService {
|
|||
|
||||
Result viewExtrapolation(Integer sampleId, String sampleFileName, HttpServletRequest request);
|
||||
|
||||
Result changeDataExtrapolation(ChangeExtInfo extInfo, HttpServletRequest request);
|
||||
|
||||
Result analyseExtrapolation(AnalyseExtInfo extInfo, HttpServletRequest request);
|
||||
|
||||
Result viewMDC(Integer sampleId, String sampleFileName, HttpServletRequest request);
|
||||
|
|
|
@ -2177,16 +2177,97 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
}else {
|
||||
effi = Math.exp( coeffData.Effciency1*ener + coeffData.Effciency2 + coeffData.Effciency3/ener + coeffData.Effciency4/Math.pow(ener,2) + coeffData.Effciency5/Math.pow(ener, 3) + coeffData.Effciency6/Math.pow(ener, 4) );
|
||||
totE = Math.exp( coeffData.totalEf1*ener + coeffData.totalEf2 + coeffData.totalEf3/ener + coeffData.totalEf4/Math.pow(ener,2) + coeffData.totalEf5/Math.pow(ener, 3) + coeffData.totalEf6/Math.pow(ener, 4) );
|
||||
data.setTotalEffi(totE);
|
||||
data.setPeakEffi(effi);
|
||||
data.setTotalEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(totE))));
|
||||
data.setPeakEffi(Double.parseDouble(NumberFormatUtil.numberFormat(String.valueOf(effi))));
|
||||
}
|
||||
data.setEnergy(energys.get(i));
|
||||
data.setUncertain(10.0);
|
||||
inputDataList.add(data);
|
||||
}
|
||||
inputDataList = inputDataList.stream().sorted((data1, data2) -> {
|
||||
return data1.getEnergy().compareTo(data2.getEnergy());
|
||||
}).collect(Collectors.toList());
|
||||
return inputDataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result KorSumAnalyse(List<InputData> inputDataList) {
|
||||
Result result = new Result();
|
||||
DecimalFormat df = new DecimalFormat("#.##########");
|
||||
//读取Remaining文件
|
||||
String readRemaining = ReadRemaining();
|
||||
//KORDAT文件的标准头部信息
|
||||
String m_kordatHeader = "0. 0. 0. 10 17.03.1988";
|
||||
//分析所需生成的文件
|
||||
String kordatPath = parameterProperties.getFilePath() + StringPool.SLASH + "KORDAT";
|
||||
//生成文件
|
||||
File kordat = new File(kordatPath);
|
||||
//向文件内写入内容
|
||||
BufferedWriter writer = null;
|
||||
try {
|
||||
writer = new BufferedWriter(new FileWriter(kordat));
|
||||
StringBuffer out = new StringBuffer();
|
||||
// 写头部信息
|
||||
out.append(m_kordatHeader);
|
||||
out.append(System.lineSeparator());
|
||||
//遍历数组写入表单数据
|
||||
for (int i=0; i<inputDataList.size(); i++) {
|
||||
InputData inputData = inputDataList.get(i);
|
||||
double energy = inputData.getEnergy();
|
||||
double totalEffi = inputData.getTotalEffi() * 1000;
|
||||
double peakEffi = inputData.getPeakEffi() * 1000;
|
||||
double uncertain = inputData.getUncertain();
|
||||
out.append(String.format("%-10s%-10s%-10s%-10s%-10s", df.format(energy), df.format(totalEffi), df.format(peakEffi), " ", df.format(uncertain)));
|
||||
out.append(System.lineSeparator());
|
||||
}
|
||||
out.append(System.lineSeparator());
|
||||
out.append(readRemaining);
|
||||
writer.write(out.toString());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
try {
|
||||
if (Objects.nonNull(writer)) {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建ProcessBuilder对象
|
||||
ProcessBuilder pb = new ProcessBuilder(parameterProperties.getFilePath() + StringPool.SLASH + "KORSUM.exe");
|
||||
// 设置工作目录
|
||||
pb.directory(new File(parameterProperties.getFilePath()));
|
||||
try {
|
||||
pb.start();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//读取生成的结果文件 并将数据存入对应的map中
|
||||
Map<String, NuclideInfo> m_mapNuclideInfo = new HashMap<>();
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(m_mapNuclideInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
private String ReadRemaining() {
|
||||
String txtPath = parameterProperties.getFilePath() + StringPool.SLASH + "Kordat_Remaining.txt";
|
||||
File file = new File(txtPath);
|
||||
StringBuilder m_remainingData = new StringBuilder();
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
m_remainingData.append(line).append(System.lineSeparator());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return m_remainingData.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result energyCalibration(Integer sampleId, String fileName, String currentText, Double width, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.google.common.cache.Cache;
|
|||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
@ -39,17 +38,13 @@ import org.jeecg.modules.base.enums.*;
|
|||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
import org.jeecg.modules.native_jni.CalValuesHandler;
|
||||
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
|
||||
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
|
||||
import org.jeecg.modules.native_jni.struct.BgBoundary;
|
||||
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||
|
@ -2117,7 +2112,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result analyseExtrapolation(AnalyseExtInfo extInfo, HttpServletRequest request) {
|
||||
public Result changeDataExtrapolation(ChangeExtInfo extInfo, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
|
@ -2183,7 +2178,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
if (CollectionUtils.isNotEmpty(detTmp.h_counts)) {
|
||||
detbgr_historgram = detTmp.h_counts;
|
||||
}
|
||||
|
||||
//计算
|
||||
//Ng
|
||||
double s_Ng = 0.0;
|
||||
|
@ -2230,25 +2224,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Nx.add((1-EbT)/EbT);
|
||||
index++;
|
||||
}
|
||||
int pos=0;
|
||||
String fittype = extInfo.getFitType();
|
||||
if(fittype.equals("liner")) {
|
||||
pos=1;
|
||||
} else if(fittype.equals("poly2")) {
|
||||
pos=0;
|
||||
} else if(fittype.equals("poly3")) {
|
||||
}
|
||||
double lamadaXe = Math.log(2)/(extInfo.getHalfLife()*24*60*60);
|
||||
List<Double> fittingPara = new LinkedList<>();
|
||||
fittingPara = EnergySpectrumHandler.GetFittingPara(Nx,Ny,fittype);
|
||||
if(CollectionUtils.isEmpty(fittingPara) && pos>fittingPara.size()-1) {
|
||||
return result;
|
||||
}
|
||||
double acqRealTime = sampleRealTime;
|
||||
double Xe_activity = fittingPara.get(pos)*(lamadaXe*acqRealTime)/(1-Math.exp(-lamadaXe*acqRealTime));
|
||||
List<SeriseData> line_serise_data = new LinkedList<>();
|
||||
List<SeriseData> scatter_serise_data = new LinkedList<>();
|
||||
|
||||
double maxLeft=0.0;
|
||||
double maxBottom=0.0;
|
||||
double minLeft=0.0;
|
||||
|
@ -2273,7 +2250,73 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
scatter_serise_data.add(temp);
|
||||
}
|
||||
String functionFit = "";
|
||||
String tempStr = "";
|
||||
if(fittype.equals("liner")) {
|
||||
functionFit = "y = a*x + b ";
|
||||
} else if(fittype.equals("poly2")) {
|
||||
functionFit = "y = a+ b*x + c*x^2 ";
|
||||
} else if(fittype.equals("poly3")) {
|
||||
functionFit = "y = a+ b*x + c*x^2 +d*x^3 ";
|
||||
}
|
||||
List<TableExtData> extDataList = new LinkedList<>();
|
||||
for(int i=0;i<Nx.size()&&i<Ny.size()&&i<Eb.size();i++) {
|
||||
TableExtData extData = new TableExtData();
|
||||
extData.setIndex(i);
|
||||
extData.setEb( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Eb.get(i)))) );
|
||||
extData.setNx( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Nx.get(i)))) );
|
||||
extData.setNy( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Ny.get(i)))) );
|
||||
extDataList.add(extData);
|
||||
}
|
||||
map.put("tableData", extDataList);
|
||||
map.put("resultViewScatterDataValue", scatter_serise_data);
|
||||
map.put("functionFit", functionFit);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result analyseExtrapolation(AnalyseExtInfo extInfo, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
//计算
|
||||
List<Double> Eb = extInfo.getEb();
|
||||
List<Double> Ny = extInfo.getNy();
|
||||
List<Double> Nx = extInfo.getNx();
|
||||
int pos=0;
|
||||
String fittype = extInfo.getFitType();
|
||||
if(fittype.equals("liner")) {
|
||||
pos=1;
|
||||
} else if(fittype.equals("poly2")) {
|
||||
pos=0;
|
||||
} else if(fittype.equals("poly3")) {
|
||||
}
|
||||
double lamadaXe = Math.log(2)/(extInfo.getHalfLife()*24*60*60);
|
||||
List<Double> fittingPara = new LinkedList<>();
|
||||
fittingPara = EnergySpectrumHandler.GetFittingPara(Nx,Ny,fittype);
|
||||
if(CollectionUtils.isEmpty(fittingPara) && pos>fittingPara.size()-1) {
|
||||
return result;
|
||||
}
|
||||
double acqRealTime = extInfo.getAcqRealTime();
|
||||
double Xe_activity = fittingPara.get(pos)*(lamadaXe*acqRealTime)/(1-Math.exp(-lamadaXe*acqRealTime));
|
||||
List<SeriseData> line_serise_data = new LinkedList<>();
|
||||
double maxLeft=0.0;
|
||||
double maxBottom=0.0;
|
||||
double minLeft=0.0;
|
||||
for(int i=0;i<Nx.size()&&i<Ny.size();i++) {
|
||||
if(maxBottom<Nx.get(i)) {
|
||||
maxBottom = Nx.get(i);
|
||||
}
|
||||
if(minLeft>Nx.get(i)) {
|
||||
minLeft = Nx.get(i);
|
||||
}
|
||||
if(maxLeft<Ny.get(i)) {
|
||||
maxLeft = Ny.get(i);
|
||||
}
|
||||
if(minLeft>Ny.get(i)) {
|
||||
minLeft = Ny.get(i);
|
||||
}
|
||||
}
|
||||
String functionFit = "";
|
||||
if(fittype.equals("liner")) {
|
||||
SeriseData left = new SeriseData();
|
||||
List<Double> data = new LinkedList<>();
|
||||
|
@ -2293,7 +2336,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
line_serise_data.add(left);
|
||||
line_serise_data.add(right);
|
||||
functionFit = "y = a*x + b ";
|
||||
if (scatter_serise_data.size()>1) {
|
||||
if (Nx.size()>1) {
|
||||
functionFit = String.format("y = %f*x + %f ", fittingPara.get(0), fittingPara.get(1));
|
||||
}
|
||||
} else if(fittype.equals("poly2")) {
|
||||
|
@ -2308,47 +2351,22 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
line_serise_data.add(temp);
|
||||
}
|
||||
functionFit = "y = a+ b*x + c*x^2 ";
|
||||
if (scatter_serise_data.size()>1) {
|
||||
if (Nx.size()>1) {
|
||||
functionFit = String.format("y = %f+ %f*x + %f*x^2 ",fittingPara.get(0),fittingPara.get(1),fittingPara.get(2));
|
||||
}
|
||||
} else if(fittype.equals("poly3")) {
|
||||
functionFit = "y = a+ b*x + c*x^2 +d*x^3 ";
|
||||
}
|
||||
List<TableExtData> extDataList = new LinkedList<>();
|
||||
for(int i=0;i<Nx.size()&&i<Ny.size()&&i<Eb.size();i++) {
|
||||
TableExtData extData = new TableExtData();
|
||||
extData.setIndex(i);
|
||||
extData.setEb( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Eb.get(i)))) );
|
||||
extData.setNx( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Nx.get(i)))) );
|
||||
extData.setNy( Double.valueOf(NumberFormatUtil.numberFormat(String.valueOf(Ny.get(i)))) );
|
||||
extDataList.add(extData);
|
||||
}
|
||||
String refTime = "";
|
||||
String xeAct = "";
|
||||
if (scatter_serise_data.size()>1) {
|
||||
refTime = sampleTmp.acquisition_start_date+" "+sampleTmp.acquisition_start_time;
|
||||
if (Nx.size()>1) {
|
||||
refTime = extInfo.getAcqStartTime();
|
||||
xeAct = String.valueOf(Xe_activity);
|
||||
}
|
||||
map.put("tableData", extDataList);
|
||||
map.put("functionFit", functionFit);
|
||||
map.put("refTime", refTime);
|
||||
map.put("xeAct", xeAct);
|
||||
map.put("resultViewScatterDataValue", scatter_serise_data);
|
||||
map.put("resultViewLineDataValue", line_serise_data);
|
||||
if(maxLeft<=0||maxBottom<=0||scatter_serise_data.size()<=1) {
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
if(maxLeft<4) {
|
||||
map.put("leftFormat", "%f");
|
||||
} else {
|
||||
map.put("leftFormat", "%i");
|
||||
}
|
||||
|
||||
maxBottom+=1;
|
||||
maxLeft*=1.5;
|
||||
minLeft-=1.5;
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue
Block a user