fix:引用 module-beta-gamma, 增加#b_eff内容

This commit is contained in:
xiaoguangbin 2024-09-30 11:07:54 +08:00
parent d763b1c6b2
commit e9201cb9a6
7 changed files with 69 additions and 596 deletions

View File

@ -236,7 +236,7 @@ public class EnergySpectrumStruct {
/**
* γ -nuclide
*/
public List<Double> g_e_nuclide;
public List<String> g_e_nuclide_name;
/**
* γ -energy (keV)
*/
@ -254,12 +254,13 @@ public class EnergySpectrumStruct {
/************************* g_Efficiency Block ******************/
/**
* β -energy (keV)
* γ -nuclide
*/
public List<Double> b_e_energy;
public List<String> b_e_nuclide_name;
/**
* efficiency (counts in peak/photon emitted)
*/
public List<Double> b_e_energy;
public List<Double> b_e_efficiency;
/**
* uncertainty (counts in peak/photon emitted)

View File

@ -16,6 +16,10 @@
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
</dependency>
<!-- 引入jeecg-boot-starter-cloud依赖 -->
<dependency>

View File

@ -7,6 +7,8 @@ import java.io.Serializable;
@Data
public class GEfficiency implements Serializable {
private String nuclideName;
private Double energy;
private Double efficiency;

View File

@ -28,6 +28,8 @@ public class Report implements Serializable {
private List<BEfficiency> bgEfficiencyBlock;
private List<BEfficiency> bEfficiencyBlock;
private List<Roi> roiLimitsBlock;
private List<Ratios> ratiosBlock;

View File

@ -1,17 +0,0 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
/**
* 能谱处理本地类
*/
public class EnergySpectrumHandler {
/**
* 获取能谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native EnergySpectrumStruct getSourceData(String path);
}

View File

@ -1,559 +0,0 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
* 消息类型
*/
public String msg_type;
/**
* 消息id
*/
public String msg_id;
/**
* 数据类型
*/
public String data_type;
/************************* Header Black ******************/
/**
* designator
*/
public String designator;
/**
* site code
*/
public String site_code;
/**
* detector code
*/
public String detector_code;
/**
* system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and
*/
public String system_type;
/**
* sample geometry
*/
public String sample_geometry;
/**
* spectrum qualifier: preliminary ( PREL )or full ( FULL)
*/
public String spectrum_quantity;
/**
* sample reference identification
*/
public String sample_ref_id;
/**
* measurement identification
*/
public String measurement_id;
/**
* detector background measurement identification
*/
public String detector_bk_measurement_id;
/**
* gas background measurement identification (memory effect)
*/
public String gas_bk_measurement_id;
/**
* transmit date (yyyy / mm / dd)
*/
public String transmit_date;
/**
* transmit time (hh : mm : ss . s)
*/
public String transmit_time;
/************************* Sample ******************/
public double dimension_1;
public double dimension_2;
/************************* Comment ******************/
public String comment;
/************************* Acquisition Block ******************/
/**
* acquisition start date (yyyy / mm / dd)
*/
public String acquisition_start_date;
/**
* acquisition start time (hh : mm : ss . s)
*/
public String acquisition_start_time;
/**
* acquisition real time (s)
*/
public double acquisition_real_time;
/**
* acquisition live time (s)
*/
public double acquisition_live_time;
/************************* Collection Block ******************/
/**
* collection start date (yyyy / mm / dd)
*/
public String collection_start_date;
/**
* collection start time (hh : mm : ss . s)
*/
public String collection_start_time;
/**
* collection stop date (yyyy / mm / dd)
*/
public String collection_stop_date;
/**
* collection stop time (hh : mm : ss . s)
*/
public String collection_stop_time;
/**
* total air volume sampled (standard cubic meters [scm])
*/
public double air_volume;
/************************* Processing Block ******************/
/**
* sample volume of Xe (cm 3 )
*/
public double sample_volume_of_Xe;
/**
* uncertainty (cm 3 )
*/
public double uncertainty_1;
/**
* Xe collection yield (Xe gas in sample/total Xe gas sampled)
*/
public double Xe_collection_yield;
/**
* uncertainty (Xe gas in sample/total Xe gas sampled)
*/
public double uncertainty_2;
/**
* archive bottle identification
*/
public String archive_bottle_id;
/************************* Calibration Block ******************/
/**
* date of last calibration (yyyy / mm / dd)
*/
public String date_calibration;
/**
* time of last calibration (hh : mm : ss)
*/
public String time_calibration;
/************************* g_Energy Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_energy;
/**
* centroid channel
*/
public List<Double> g_centroid_channel;
/**
* uncertainty (channels)
*/
public List<Double> g_uncertainty;
public int g_record_count;
/************************* b_Energy Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_electron_energy;
/**
* decay mode descriptor: B for β-particle, C for conversion electron (CE)
*/
public List<String> b_decay_mode;
/**
* maximum channel of β-particle distribution or centroid channel of CE (channels)
*/
public List<Double> b_channel;
/**
* uncertainty (channels)
*/
public List<Double> b_uncertainty;
public int b_record_count;
/************************* g_Resolution Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_r_energy;
/**
* FWHM (keV)
*/
public List<Double> g_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> g_r_uncertainty;
public int g_r_record_count;
/************************* b_Resolution Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_r_electron_energy;
/**
* FWHM (keV)
*/
public List<Double> b_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> b_r_uncertainty;
public int b_r_record_count;
/************************* g_Efficiency Block ******************/
/**
* γ -nuclide
*/
public List<Double> g_e_nuclide;
/**
* γ -energy (keV)
*/
public List<Double> g_e_energy;
/**
* efficiency (counts in peak/photon emitted)
*/
public List<Double> g_e_efficiency;
/**
* uncertainty (counts in peak/photon emitted)
*/
public List<Double> g_e_uncertainty;
public int g_e_record_count;
/************************* ROI_Limits Block ******************/
/**
* ROI number
*/
public List<String> ROI_number;
/**
* 2-D ROI β-range start, x 1 (keV)
*/
public List<Double> POI_B_x1;
/**
* 2-D ROI β-range stop, x 2 (keV)
*/
public List<Double> POI_B_x2;
/**
* 2-D ROI γ-range start, y 1 (keV)
*/
public List<Double> POI_G_y1;
/**
* 2-D ROI γ-range stop, y 2 (keV)
*/
public List<Double> POI_G_y2;
public int roi_record_count;
/************************* b-gEfficiency Block ******************/
/**
* nuclide name
*/
public List<String> bg_nuclide_name;
/**
* ROI number
*/
public List<Double> bg_ROI_number;
/**
* β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_efficiency;
/**
* uncertainty (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_uncertainty;
public int bg_record_count;
/************************* Ratios Block ******************/
/**
* ratio identifier
*/
public List<String> ratio_id;
/**
* ROI number for the higher γ -energy ROI
*/
public List<String> ROI_num_highter_G_energy_ROI;
/**
* ROI number for the lower γ -energy ROI
*/
public List<String> ROI_num_lower_G_energy_ROI;
/**
* Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI)
*/
public List<Double> count_ratio;
/**
* count ratio uncertainty (percent)
*/
public List<Double> count_ratio_uncertainty;
public int ratio_record_count;
/************************* g_Spectrum Block ******************/
/**
* number of γ channels
*/
public long num_g_channel;
/**
* γ-energy span (keV)
*/
public long g_energy_span;
/**
* begin of channels
*/
public long g_begin_channel;
/**
* count at channel
*/
public List<Long> g_counts;
/************************* b_Spectrum Block ******************/
/**
* number of β -channels
*/
public long num_b_channel;
/**
* β -energy span (keV)
*/
public long b_energy_span;
/**
* begin of channels
*/
public long b_begin_channel;
/**
* counts at channels
*/
public List<Long> b_counts;
/************************* Histogram Block ******************/
/**
* β-channels
*/
public long b_channels;
/**
* γ-channels
*/
public long g_channels;
/**
* β-energy span
*/
public long b_h_energy_span;
/**
* γ-energy span
*/
public long g_h_energy_span;
/**
* counts at channels
*/
public List<Long> h_counts;
/************************* Certificate_Block ******************/
/**
* total source activity (Bq)
*/
public double total_source_activity;
/**
* assay date (yyyy / mm / dd)
*/
public String assay_date;
/**
* assay time (hh : mm : ss)
*/
public String assay_time;
/**
* units of activity: B, b for Bq or [blank]; if nothing, then B is assigned
*/
public String units_activity;
/**
* nuclide name
*/
public List<String> nuclide_name;
/**
* half-life in seconds, hours, days, or years
*/
public List<String> half_life_time;
/**
* time unit(Y, D, H, S)
*/
public List<String> time_unit;
/**
* activity of nuclide at time of assay
*/
public List<Double> activity_nuclide_time_assay;
/**
* uncertainty (%)
*/
public List<Double> uncertainty;
/**
* γ-energy (keV)
*/
public List<Double> cer_g_energy;
/**
* γ-intensity (percent)
*/
public List<Double> g_intensity;
/**
* electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source)
*/
public List<String> electron_decay_mode;
/**
* maximum β-particle energy or CE energy (keV)
*/
public List<Double> maximum_energy;
/**
* intensity of β-particle (percent)
*/
public List<Double> intensity_b_particle;
public int record_count;
/************************* Totaleff Block ******************/
/**
* γ-energy (keV)
*/
public List<Double> t_g_energy;
/**
* total efficiency (counts/photon emitted)
*/
public List<Double> total_efficiency;
/**
* uncertainty (counts/photon emitted)
*/
public List<Double> t_uncertainty;
public int t_record_count;
public EnergySpectrumStruct() {
super();
}
@Override
public String toString() {
return "EnergySpectrumStruct{" +
"msg_type='" + msg_type + '\'' +
", msg_id='" + msg_id + '\'' +
", data_type='" + data_type + '\'' +
", designator='" + designator + '\'' +
", site_code='" + site_code + '\'' +
", detector_code='" + detector_code + '\'' +
", system_type='" + system_type + '\'' +
", sample_geometry='" + sample_geometry + '\'' +
", spectrum_quantity='" + spectrum_quantity + '\'' +
", sample_ref_id='" + sample_ref_id + '\'' +
", measurement_id='" + measurement_id + '\'' +
", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' +
", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' +
", transmit_date='" + transmit_date + '\'' +
", transmit_time='" + transmit_time + '\'' +
", comment='" + comment + '\'' +
", acquisition_start_date='" + acquisition_start_date + '\'' +
", acquisition_start_time='" + acquisition_start_time + '\'' +
", acquisition_real_time=" + acquisition_real_time +
", acquisition_live_time=" + acquisition_live_time +
", collection_start_date='" + collection_start_date + '\'' +
", collection_start_time='" + collection_start_time + '\'' +
", collection_stop_date='" + collection_stop_date + '\'' +
", collection_stop_time='" + collection_stop_time + '\'' +
", air_volume=" + air_volume +
", sample_volume_of_Xe=" + sample_volume_of_Xe +
", uncertainty_1=" + uncertainty_1 +
", Xe_collection_yield=" + Xe_collection_yield +
", uncertainty_2=" + uncertainty_2 +
", archive_bottle_id='" + archive_bottle_id + '\'' +
", date_calibration='" + date_calibration + '\'' +
", time_calibration='" + time_calibration + '\'' +
", g_energy=" + g_energy +
", g_centroid_channel=" + g_centroid_channel +
", g_uncertainty=" + g_uncertainty +
", g_record_count=" + g_record_count +
", b_electron_energy=" + b_electron_energy +
", b_decay_mode=" + b_decay_mode +
", b_channel=" + b_channel +
", b_uncertainty=" + b_uncertainty +
", b_record_count=" + b_record_count +
", g_r_energy=" + g_r_energy +
", g_r_FWHM=" + g_r_FWHM +
", g_r_uncertainty=" + g_r_uncertainty +
", g_r_record_count=" + g_r_record_count +
", b_r_electron_energy=" + b_r_electron_energy +
", b_r_FWHM=" + b_r_FWHM +
", b_r_uncertainty=" + b_r_uncertainty +
", b_r_record_count=" + b_r_record_count +
", g_e_energy=" + g_e_energy +
", g_e_efficiency=" + g_e_efficiency +
", g_e_uncertainty=" + g_e_uncertainty +
", g_e_record_count=" + g_e_record_count +
", ROI_number=" + ROI_number +
", POI_B_x1=" + POI_B_x1 +
", POI_B_x2=" + POI_B_x2 +
", POI_G_y1=" + POI_G_y1 +
", POI_G_y2=" + POI_G_y2 +
", roi_record_count=" + roi_record_count +
", bg_nuclide_name=" + bg_nuclide_name +
", bg_ROI_number=" + bg_ROI_number +
", bg_efficiency=" + bg_efficiency +
", bg_uncertainty=" + bg_uncertainty +
", bg_record_count=" + bg_record_count +
", ratio_id=" + ratio_id +
", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI +
", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI +
", count_ratio=" + count_ratio +
", count_ratio_uncertainty=" + count_ratio_uncertainty +
", ratio_record_count=" + ratio_record_count +
", num_g_channel=" + num_g_channel +
", g_energy_span=" + g_energy_span +
", g_begin_channel=" + g_begin_channel +
", g_counts=" + g_counts +
", num_b_channel=" + num_b_channel +
", b_energy_span=" + b_energy_span +
", b_begin_channel=" + b_begin_channel +
", b_counts=" + b_counts +
", b_channels=" + b_channels +
", g_channels=" + g_channels +
", b_h_energy_span=" + b_h_energy_span +
", g_h_energy_span=" + g_h_energy_span +
", h_counts=" + h_counts +
", total_source_activity=" + total_source_activity +
", assay_date='" + assay_date + '\'' +
", assay_time='" + assay_time + '\'' +
", units_activity='" + units_activity + '\'' +
", nuclide_name=" + nuclide_name +
", half_life_time=" + half_life_time +
", time_unit=" + time_unit +
", activity_nuclide_time_assay=" + activity_nuclide_time_assay +
", uncertainty=" + uncertainty +
", cer_g_energy=" + cer_g_energy +
", g_intensity=" + g_intensity +
", electron_decay_mode=" + electron_decay_mode +
", maximum_energy=" + maximum_energy +
", intensity_b_particle=" + intensity_b_particle +
", record_count=" + record_count +
'}';
}
public static void main(String[] args) {
EnergySpectrumStruct s = new EnergySpectrumStruct();
System.out.println(s);
System.out.println(s.gas_bk_measurement_id);
}
}

View File

@ -28,7 +28,6 @@ import org.jeecg.modules.base.enums.SystemType;
import org.jeecg.modules.base.enums.XeNuclideName;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.entity.dto.SampleDataDto;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import org.jeecg.modules.mapper.*;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
@ -135,7 +134,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
if (StringUtils.isNotBlank(filePath)) {
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath);
if (Objects.nonNull(file)) {
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
EnergySpectrumStruct sourceData = null;
if (file.length() > 1024 * 1024 * 4) {
sourceData = SelfBaseUtil.getSourceDataNotHis(file.getAbsolutePath());
} else {
sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
}
//查询info
this.findInfo(sampleId, report);
//查询G_energy
@ -150,6 +154,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
this.findGEfficiency(sourceData, report);
//查询B_gEfficiency
this.findBgEfficiency(sourceData, report);
this.findBEfficiency(sourceData, report);
//查询ROI
this.findRoiLimits(sourceData, report);
//查询RATIOS
@ -501,6 +506,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
gEfficiencySubBlock = new LinkedList<>();
for (int i=0; i<sourceData.g_e_energy.size(); i++) {
GEfficiency gEfficiency = new GEfficiency();
gEfficiency.setNuclideName(sourceData.g_e_nuclide_name.get(i));
gEfficiency.setEnergy(sourceData.g_e_energy.get(i));
gEfficiency.setEfficiency(sourceData.g_e_efficiency.get(i));
gEfficiency.setUncertainty(sourceData.g_e_uncertainty.get(i));
@ -518,15 +524,31 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
if (CollectionUtils.isNotEmpty(sourceData.bg_ROI_number) && CollectionUtils.isNotEmpty(sourceData.bg_nuclide_name) && CollectionUtils.isNotEmpty(sourceData.bg_efficiency) && CollectionUtils.isNotEmpty(sourceData.bg_uncertainty)){
bgEfficiencySubBlock = new LinkedList<>();
for (int i=0; i<sourceData.bg_ROI_number.size(); i++) {
BEfficiency BGEfficiency = new BEfficiency();
BGEfficiency.setRoiNumber(sourceData.bg_ROI_number.get(i).intValue());
BGEfficiency.setNuclideName(sourceData.bg_nuclide_name.get(i));
BGEfficiency.setCoincidenceEfficiency(sourceData.bg_efficiency.get(i));
BGEfficiency.setUncertainty(sourceData.bg_uncertainty.get(i));
bgEfficiencySubBlock.add(BGEfficiency);
}
report.setBgEfficiencyBlock(bgEfficiencySubBlock);
}
}
private void findBEfficiency(EnergySpectrumStruct sourceData, Report report) {
List<BEfficiency> bgEfficiencySubBlock = null;
if (CollectionUtils.isNotEmpty(sourceData.b_e_nuclide_name) &&
CollectionUtils.isNotEmpty(sourceData.b_e_efficiency) && CollectionUtils.isNotEmpty(sourceData.b_e_uncertainty)){
bgEfficiencySubBlock = new LinkedList<>();
for (int i=0; i<sourceData.b_e_efficiency.size(); i++) {
BEfficiency bEfficiency = new BEfficiency();
bEfficiency.setRoiNumber(sourceData.bg_ROI_number.get(i).intValue());
bEfficiency.setNuclideName(sourceData.bg_nuclide_name.get(i));
bEfficiency.setCoincidenceEfficiency(sourceData.bg_efficiency.get(i));
bEfficiency.setUncertainty(sourceData.bg_uncertainty.get(i));
bEfficiency.setNuclideName(sourceData.b_e_nuclide_name.get(i));
bEfficiency.setCoincidenceEfficiency(sourceData.b_e_efficiency.get(i));
bEfficiency.setUncertainty(sourceData.b_e_uncertainty.get(i));
bgEfficiencySubBlock.add(bEfficiency);
}
report.setBEfficiencyBlock(bgEfficiencySubBlock);
}
report.setBgEfficiencyBlock(bgEfficiencySubBlock);
}
private void findRoiLimits(EnergySpectrumStruct sourceData, Report report) {
@ -695,20 +717,38 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
public List<HistogramData> readValue(EnergySpectrumStruct sourceData) {
List<HistogramData> result = new LinkedList<>();
if (CollectionUtils.isNotEmpty(sourceData.h_counts) && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) {
for (int i=0; i<sourceData.g_channels; i++) {
for (int j=0; j<sourceData.b_channels; j++) {
List<Long> subList = sourceData.h_counts.subList((int) (i * sourceData.b_channels), (int) ((i + 1) * sourceData.b_channels));
if (!"0".equals(String.valueOf(subList.get(j)))){
HistogramData histogramData = new HistogramData();
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(subList.get(j).intValue());
result.add(histogramData);
if (!sourceData.system_type.equals("C")) {
if (CollectionUtils.isNotEmpty(sourceData.h_counts) && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) {
for (int i=0; i<sourceData.g_channels; i++) {
for (int j=0; j<sourceData.b_channels; j++) {
List<Long> subList = sourceData.h_counts.subList((int) (i * sourceData.b_channels), (int) ((i + 1) * sourceData.b_channels));
if (!"0".equals(String.valueOf(subList.get(j)))){
HistogramData histogramData = new HistogramData();
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(subList.get(j).intValue());
result.add(histogramData);
}
}
}
}
} else {
if (null != sourceData.h_count_arr && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) {
for (int i=0; i<sourceData.g_channels; i++) {
for (int j=0; j<sourceData.b_channels; j++) {
Long count = sourceData.h_count_arr[i][j];
if (count > 0){
HistogramData his = new HistogramData();
his.setG(i);
his.setB(j);
his.setC(count.intValue());
result.add(his);
}
}
}
}
}
return result;
}