Skip to content

Commit 1c93509

Browse files
committed
Add in reading "SPEC_CAL" section for SPE files.
1 parent bfbfb36 commit 1c93509

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/SpecFile_spe.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,21 @@ bool SpecFile::load_from_iaea( std::istream& istr )
752752
const string valuestr = remove_label( line );
753753
if( !parse_float( valuestr.c_str(), valuestr.size(), cal_coeffs[2] ) )
754754
throw runtime_error( "NCF: Failed to parse quadratic." );
755+
}else if( starts_with(line,"$SPEC_CAL:") )
756+
{
757+
if( !SpecUtils::safe_get_line( istr, line ) )
758+
throw runtime_error("Error reading SPEC_CAL section of IAEA file");
759+
trim(line);
760+
761+
if( starts_with(line,"$") )
762+
{
763+
skip_getline = true;
764+
break;
765+
}//if( we have overrun the data section )
766+
767+
vector<float> parts;
768+
if( SpecUtils::split_to_floats(line.c_str(), line.size(), parts) && (parts.size() >= 2) )
769+
cal_coeffs = parts;
755770
}else if( is_ncf && starts_with(line,"$RLTIME:") )
756771
{
757772
const string valuestr = remove_label( line );

0 commit comments

Comments
 (0)