Skip to content

Commit 21928fc

Browse files
authored
Merge pull request #236 from aglowacki/master
ROI processing and macOS release bug fixes
2 parents e0e4fd1 + a3e9172 commit 21928fc

7 files changed

Lines changed: 177 additions & 165 deletions

File tree

reference/Scaler_to_PV_map.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ BeamLines:
1414
US_IC: 2idd:scaler1_cts1.C
1515
DS_IC:
1616
- 2idd:scaler1_cts1.B
17-
- 2iddtmm1:Current4:MeanValue_RBV
18-
- 2iddtmm1:Current4
1917
DS_IC_SCALE_FACTOR: 2iddtmm1:CurrentScale4
2018
ELT1: 2iddXMAP:mca1.ELTM
2119
ELT2: 2iddXMAP:mca2.ELTM

src/core/process_whole.cpp

Lines changed: 140 additions & 135 deletions
Large diffs are not rendered by default.

src/data_struct/detector.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ void Detector<T_real>::update_element_quants(Fitting_Routines routine,
186186
// e_cal_ratio defined as 0 , add this value. If we have multiple standards
187187
// then we will normalize this later .
188188
eq_itr.e_cal_ratio += (T_real)1.0 / e_cal;
189+
logI<<"Ecal : "<<eq_itr.e_cal_ratio<<"\n";
189190

190191
}
191192
else
@@ -248,15 +249,15 @@ void Detector<T_real>::avg_element_quants(Fitting_Routines routine,
248249
template<typename T_real>
249250
void Detector<T_real>::generage_avg_quantification_scalers()
250251
{
251-
T_real avg_sr_current = 0.0;
252-
T_real avg_US_IC = 0.0;
253-
T_real avg_US_FM = 0.0;
254-
T_real avg_DS_IC = 0.0;
255-
256-
T_real crnt_cnt = 0.0;
257-
T_real us_cnt = 0.0;
258-
T_real us_fm_cnt = 0.0;
259-
T_real ds_cnt = 0.0;
252+
T_real avg_sr_current = (T_real)0.0;
253+
T_real avg_US_IC = (T_real)0.0;
254+
T_real avg_US_FM = (T_real)0.0;
255+
T_real avg_DS_IC = (T_real)0.0;
256+
257+
T_real crnt_cnt = (T_real)0.0;
258+
T_real us_cnt = (T_real)0.0;
259+
T_real us_fm_cnt = (T_real)0.0;
260+
T_real ds_cnt = (T_real)0.0;
260261

261262
//average quantification scalers
262263
for (const auto& itr : quantification_standards)

src/data_struct/fit_parameters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void Fit_Parameters<T_real>::from_array_d(const std::vector<double> &arr)
210210
{
211211
if (itr.second.opt_array_index != -1 && itr.second.opt_array_index < arr.size())
212212
{
213-
itr.second.value = arr[itr.second.opt_array_index];
213+
itr.second.value = static_cast<T_real>(arr[itr.second.opt_array_index]);
214214
}
215215
}
216216
}

src/io/file/aps/aps_roi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ DLL_EXPORT bool load_v10_rois(std::string path, std::map<std::string, std::vecto
129129
&& json_spectra.isMember(STR_ICR.c_str())
130130
&& json_spectra.isMember(STR_OCR.c_str()))
131131
{
132-
std::string filename = json_spectra[STR_MAP_ROI_INT_SPEC_FILENAME.c_str()].asString();
132+
std::string filename = json_spectra[STR_MAP_ROI_INT_SPEC_FILENAME.c_str()].asString() + roi_name;
133133
const Json::Value json_spectra_values = json_spectra[STR_SPECTRA.c_str()];
134134
int_specs[filename].resize(json_spectra_values.size());
135135
int_specs[filename].elapsed_livetime(json_spectra[STR_ELT.c_str()].asDouble());

src/io/file/netcdf_io.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
265265
}
266266

267267

268-
unsigned short i1 = _data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(idx_detector*8)];
269-
unsigned short i2 = _data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(idx_detector*8)+1];
270-
unsigned int ii = i1 | i2<<16;
268+
unsigned int i1 = static_cast<unsigned int>(_data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(idx_detector*8)]);
269+
unsigned int i2 = static_cast<unsigned int>(_data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(idx_detector*8)+1]);
270+
i1 = (0x0000ffff & i1);
271+
i2 = (i2 << 16) & 0xffff0000;
272+
unsigned int ii = i1 | i2;
271273
elapsed_livetime = ((T_real)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
272274
if (ltype == E_load_type::LINE)
273275
{
@@ -298,9 +300,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
298300
callback_spectra->elapsed_livetime(elapsed_livetime);
299301
}
300302

301-
i1 = _data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(idx_detector*8)];
302-
i2 = _data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(idx_detector*8)+1];
303-
ii = i1 | i2<<16;
303+
i1 = static_cast<unsigned int>(_data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(idx_detector*8)]);
304+
i2 = static_cast<unsigned int>(_data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(idx_detector*8)+1]);
305+
i1 = (0x0000ffff & i1);
306+
i2 = (i2 << 16) & 0xffff0000;
307+
ii = i1 | i2;
304308
elapsed_realtime = ((T_real)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
305309
if (ltype == E_load_type::LINE)
306310
{
@@ -331,9 +335,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
331335
callback_spectra->elapsed_realtime(elapsed_realtime);
332336
}
333337

334-
i1 = _data_in[0][0][l+INPUT_COUNTS_OFFSET+(idx_detector*8)];
335-
i2 = _data_in[0][0][l+INPUT_COUNTS_OFFSET+(idx_detector*8)+1];
336-
ii = i1 | i2<<16;
338+
i1 = static_cast<unsigned int>(_data_in[0][0][l+INPUT_COUNTS_OFFSET+(idx_detector*8)]);
339+
i2 = static_cast<unsigned int>(_data_in[0][0][l+INPUT_COUNTS_OFFSET+(idx_detector*8)+1]);
340+
i1 = (0x0000ffff & i1);
341+
i2 = (i2 << 16) & 0xffff0000;
342+
ii = i1 | i2;
337343
input_counts = ((T_real)ii) / elapsed_livetime;
338344
if (ltype == E_load_type::LINE)
339345
{
@@ -365,9 +371,11 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
365371
}
366372

367373

368-
i1 = _data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(idx_detector*8)];
369-
i2 = _data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(idx_detector*8)+1];
370-
ii = i1 | i2<<16;
374+
i1 = static_cast<unsigned int>(_data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(idx_detector*8)]);
375+
i2 = static_cast<unsigned int>(_data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(idx_detector*8)+1]);
376+
i1 = (0x0000ffff & i1);
377+
i2 = (i2 << 16) & 0xffff0000;
378+
ii = i1 | i2;
371379
output_counts = ((T_real)ii) / elapsed_realtime;
372380
if (ltype == E_load_type::LINE)
373381
{

src/quantification/models/quantification_model.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ void Quantification_Model<T_real>::init_element_quant(Element_Quant<T_real>& ele
9595
//fit_t_ge == GE_DEAD_LAYER * 1000 if detector is not Si
9696
//add_float['a'] == DET_CHIP_THICKNESS * 1000
9797

98-
T_real beta;
99-
T_real shell_factor = 0.0;
100-
T_real ev;
101-
T_real jump_factor = 0.0;
102-
T_real total_jump_factor = 0.0;
98+
T_real beta = (T_real)0.0;
99+
T_real shell_factor = (T_real)0.0;
100+
T_real ev = (T_real)0.0;
101+
T_real jump_factor = (T_real)0.0;
102+
T_real total_jump_factor = (T_real)0.0;
103103

104104

105105

0 commit comments

Comments
 (0)