Skip to content

Commit 036e30b

Browse files
author
Arthur Glowacki
committed
Fixed bug where using double to load netcdf caused bad read for elt, ert, icr, and ocr
1 parent 2bd903f commit 036e30b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/io/file/netcdf_io.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
267267
unsigned short i1 = _data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(detector*8)];
268268
unsigned short i2 = _data_in[0][0][l+ELAPSED_LIVETIME_OFFSET+(detector*8)+1];
269269
unsigned int ii = i1 | i2<<16;
270-
elapsed_livetime = ((float)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
270+
elapsed_livetime = ((T_real)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
271271
if (ltype == E_load_type::LINE)
272272
{
273273
if (elapsed_livetime == 0)
@@ -300,7 +300,7 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
300300
i1 = _data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(detector*8)];
301301
i2 = _data_in[0][0][l+ELAPSED_REALTIME_OFFSET+(detector*8)+1];
302302
ii = i1 | i2<<16;
303-
elapsed_realtime = ((float)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
303+
elapsed_realtime = ((T_real)ii) * 320e-9f; // need to multiply by this value becuase of the way it is saved
304304
if (ltype == E_load_type::LINE)
305305
{
306306
if (elapsed_realtime == 0)
@@ -333,7 +333,7 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
333333
i1 = _data_in[0][0][l+INPUT_COUNTS_OFFSET+(detector*8)];
334334
i2 = _data_in[0][0][l+INPUT_COUNTS_OFFSET+(detector*8)+1];
335335
ii = i1 | i2<<16;
336-
input_counts = ((float)ii) / elapsed_livetime;
336+
input_counts = ((T_real)ii) / elapsed_livetime;
337337
if (ltype == E_load_type::LINE)
338338
{
339339
if (input_counts == 0)
@@ -367,7 +367,7 @@ size_t NetCDF_IO<T_real>::_load_spectra(E_load_type ltype,
367367
i1 = _data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(detector*8)];
368368
i2 = _data_in[0][0][l+OUTPUT_COUNTS_OFFSET+(detector*8)+1];
369369
ii = i1 | i2<<16;
370-
output_counts = ((float)ii) / elapsed_realtime;
370+
output_counts = ((T_real)ii) / elapsed_realtime;
371371
if (ltype == E_load_type::LINE)
372372
{
373373
if (output_counts == 0)

0 commit comments

Comments
 (0)