예제 #1
0
void MantidWSIndexDialog::checkForSpectraAxes()
{
  // Check to see if *all* workspaces have a spectrum axis.
  // If even one does not have a spectra axis, then we wont
  // ask the user to enter spectra IDs - only workspace indices.
  QList<QString>::const_iterator it = m_wsNames.constBegin();
  m_spectra = true;

  for ( ; it != m_wsNames.constEnd(); ++it )
  {
    Mantid::API::MatrixWorkspace_const_sptr ws = boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>(Mantid::API::AnalysisDataService::Instance().retrieve((*it).toStdString()));
    if ( NULL == ws ) continue;
    bool hasSpectra = false;
    for(int i = 0; i < ws->axes(); i++)
    {
      if(ws->getAxis(i)->isSpectra()) 
        hasSpectra = true;
    }
    if(hasSpectra == false)
    {
      m_spectra = false;
      break;
    }
  }
}