feat:bgSpectrum数据

This commit is contained in:
nieziyan 2024-07-18 19:43:26 +08:00
parent 3d97ffb539
commit 5849612a3b
2 changed files with 30 additions and 3 deletions

View File

@ -10,7 +10,4 @@ public class SeriseData implements Serializable {
private double x; private double x;
private double y; private double y;
private double e;
} }

View File

@ -273,6 +273,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
resultMap.put("sample", map); resultMap.put("sample", map);
// 初始化Configure // 初始化Configure
initConfigure(struct, selfStationData); initConfigure(struct, selfStationData);
// 返回Beta和Gamma的数据
bGSpectrum(struct, map);
} }
} }
//判断det文件名是否为空 //判断det文件名是否为空
@ -335,6 +337,8 @@ public class SelfStationServiceImpl implements ISelfStationService {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
selfStationUtil.loadFile(selfStationData, null, null, "sample", map); selfStationUtil.loadFile(selfStationData, null, null, "sample", map);
resultMap.put("sample", map); resultMap.put("sample", map);
// 返回Beta和Gamma的数据
bGSpectrum(selfStationData.getSampleStruct(), map);
} }
if (StringUtils.isNotBlank(detFileName)) { if (StringUtils.isNotBlank(detFileName)) {
//返回结果map //返回结果map
@ -447,6 +451,32 @@ public class SelfStationServiceImpl implements ISelfStationService {
} }
} }
public void bGSpectrum(EnergySpectrumStruct struct, Map<String, Object> map){
List<SeriseData> seriseDataB = new LinkedList<>();
List<SeriseData> seriseDataG = new LinkedList<>();
long numBChannel = struct.num_b_channel;
long numGChannel = struct.num_g_channel;
List<Long> bCounts = struct.b_counts;
List<Long> gCounts = struct.g_counts;
for (int i = 0; i < numBChannel; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(i);
seriseData.setY(bCounts.get(i));
seriseDataB.add(seriseData);
}
for (int i = 0; i < numGChannel; i++) {
SeriseData seriseData = new SeriseData();
seriseData.setX(i);
seriseData.setY(gCounts.get(i));
seriseDataG.add(seriseData);
}
Map<String, Object> result = new HashMap<>();
map.put("bSpectrum", seriseDataB);
map.put("gSpectrum", seriseDataG);
}
@Override @Override
public void deleteSelfStationCache(String sampleFileName, HttpServletRequest request) { public void deleteSelfStationCache(String sampleFileName, HttpServletRequest request) {
String userName = JwtUtil.getUserNameByToken(request); String userName = JwtUtil.getUserNameByToken(request);