Skip to content

Commit

Permalink
Fix when exporting spectrum files, and summing multiple records, but …
Browse files Browse the repository at this point in the history
…only part of the file - an error was produced (something about invalid sample numbers).

The underlying cause was we were mapping the original sample numbers to instead start at 1, instead of whatever they previously did - but we werent updating the list of sample numbers that we wanted to sum, so the summing was throwning an error because some of the input sample numbers were not in the now re-numbered file.
  • Loading branch information
wcjohns committed Nov 7, 2024
1 parent 2f8fead commit 1042c14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ExportSpecFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2987,12 +2987,14 @@ std::shared_ptr<const SpecMeas> ExportSpecFileTool::generateFileToSave()
samples.erase( sample );

// Now lets map sample numbers to 1 through N
samples.clear();
int new_sample_number = 0;
vector<pair<int,int>> old_to_new_samplenum;
for( const int old_sample_number : answer->sample_numbers() )
{
++new_sample_number;
old_to_new_samplenum.emplace_back( old_sample_number, new_sample_number );
samples.insert( new_sample_number );
}//for( loop over sample numbers )

answer->change_sample_numbers( old_to_new_samplenum );
Expand Down

0 comments on commit 1042c14

Please sign in to comment.