Skip to content

Commit

Permalink
Refs #8550. Handle zero groups better.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Dec 9, 2013
1 parent 726d568 commit 958d00f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Code/Mantid/Framework/DataHandling/src/LoadMuonNexus1.cpp
Expand Up @@ -557,7 +557,9 @@ namespace Mantid
{
// Simpliest case - one grouping entry per spectra
TableWorkspace_sptr table = createDetectorGroupingTable( grouping.begin(), grouping.end() );
setProperty("DetectorGroupingTable", table);

if ( table->rowCount() != 0 )
setProperty("DetectorGroupingTable", table);
}
else
{
Expand All @@ -573,9 +575,15 @@ namespace Mantid

for ( auto it = grouping.begin(); it != grouping.end(); it += m_numberOfSpectra )
{
tableGroup->addWorkspace( createDetectorGroupingTable(it, it + m_numberOfSpectra) );
TableWorkspace_sptr table = createDetectorGroupingTable(it, it + m_numberOfSpectra);

if ( table->rowCount() != 0 )
tableGroup->addWorkspace(table);
}

if ( tableGroup->size() != static_cast<size_t>(m_numberOfPeriods) )
throw Exception::FileError("Zero grouping for some of the periods", m_filename);

setProperty("DetectorGroupingTable", tableGroup);
}
}
Expand Down Expand Up @@ -632,8 +640,11 @@ namespace Mantid

for ( auto it = grouping.begin(); it != grouping.end(); ++it )
{
if ( it->first != 0) // Skip 0 group
{
TableRow newRow = detectorGroupingTable->appendRow();
newRow << it->second;
}
}

return detectorGroupingTable;
Expand Down

0 comments on commit 958d00f

Please sign in to comment.