Skip to content

Commit dcb4ff4

Browse files
committed
Increase allowed channel count to 128k.
1 parent a27bb48 commit dcb4ff4

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

SpecUtils/EnergyCalibration.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ namespace SpecUtils
276276
277277
Values larger than this will cause an exception to be thrown when setting the calibration.
278278
*/
279-
static const size_t sm_max_channels; // = 65536 + 8
279+
static const size_t sm_max_channels; // 131072 (previous to 20241112, used 65536 + 8)
280280

281281
/** The largest positive value of the offset (zeroth energy cal term) allowed for normal polynomial energy calibration.
282282
i.e., if a gamma spectrum has a larger value than this, then the calibration coefficients will be considered garbage and not used.

src/EnergyCalibration.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using namespace std;
4747
namespace SpecUtils
4848
{
4949
const size_t EnergyCalibration::sm_min_channels = 1;
50-
const size_t EnergyCalibration::sm_max_channels = 65536 + 8;
50+
const size_t EnergyCalibration::sm_max_channels = 131072; //65536 + 8;
5151

5252
const float EnergyCalibration::sm_polynomial_offset_limit = 5500.0f;
5353

@@ -121,7 +121,9 @@ void EnergyCalibration::set_polynomial( const size_t num_channels,
121121
throw runtime_error( "EnergyCalibration::set_polynomial: requires >=1 channels" );
122122

123123
if( num_channels > sm_max_channels )
124-
throw runtime_error( "EnergyCalibration::set_polynomial: must be called with <= 64k channels" );
124+
throw runtime_error( "EnergyCalibration::set_polynomial: must be called with <= "
125+
+ std::to_string(sm_max_channels) + " channels"
126+
" (called for " + std::to_string(num_channels) + ")" );
125127

126128
//Find the last non-zero coefficients (e.g., strip off trailing zeros)
127129
size_t last_iter = coeffs.size();

src/SpecFile.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -6515,7 +6515,12 @@ void SpecFile::set_detector_type_from_other_info()
65156515
else if( icontains(instrument_model_,"uDetective")
65166516
|| (icontains(instrument_model_,"Detective") && icontains(instrument_model_,"micro")) )
65176517
detector_type_ = DetectorType::MicroDetective;
6518-
else if( iequals_ascii(instrument_model_,"Detective X") )
6518+
else if( iequals_ascii(instrument_model_,"Detective X")
6519+
|| iequals_ascii(instrument_model_,"Detective-X")
6520+
|| iequals_ascii(instrument_model_,"DetectiveX")
6521+
|| iequals_ascii(instrument_model_,"DetX")
6522+
|| iequals_ascii(instrument_model_,"Det-X")
6523+
|| iequals_ascii(instrument_model_,"Det X"))
65196524
detector_type_ = DetectorType::DetectiveX;
65206525
else if( icontains(instrument_model_,"Detective") )
65216526
detector_type_ = DetectorType::DetectiveUnknown;

0 commit comments

Comments
 (0)