Exemplo n.º 1
0
void LoadNexus::runLoadTOFRawNexus() {
  IAlgorithm_sptr loadNexusPro =
      createChildAlgorithm("LoadTOFRawNexus", 0., 1.);
  // Pass through the same input filename
  loadNexusPro->setPropertyValue("Filename", m_filename);
  // Set the workspace property
  std::string outputWorkspace = "OutputWorkspace";
  loadNexusPro->setPropertyValue(outputWorkspace, m_workspace);
  // Get the array passed in the spectrum_list, if an empty array was passed use
  // the default
  std::vector<int> specList = getProperty("SpectrumList");
  if (!specList.empty())
    loadNexusPro->setPropertyValue("SpectrumList",
                                   getPropertyValue("SpectrumList"));
  //
  int specMax = getProperty("SpectrumMax");
  if (specMax != Mantid::EMPTY_INT()) {
    loadNexusPro->setPropertyValue("SpectrumMax",
                                   getPropertyValue("SpectrumMax"));
    loadNexusPro->setPropertyValue("SpectrumMin",
                                   getPropertyValue("SpectrumMin"));
  }

  // Now execute the Child Algorithm. Catch and log any error, but don't stop.
  try {
    loadNexusPro->execute();
  } catch (std::runtime_error &) {
    g_log.error("Unable to successfully run LoadTOFRawNexus Child Algorithm");
  }
  if (!loadNexusPro->isExecuted())
    g_log.error("Unable to successfully run LoadTOFRawNexus Child Algorithm");

  setOutputWorkspace(loadNexusPro);
}
Exemplo n.º 2
0
void Load::loadSingleFile() {
  std::string loaderName = getPropertyValue("LoaderName");
  if (loaderName.empty()) {
    m_loader = getFileLoader(getPropertyValue("Filename"));
    loaderName = m_loader->name();
  } else {
    m_loader = createLoader(0, 1);
    findFilenameProperty(m_loader);
  }
  g_log.information() << "Using " << loaderName << " version "
                      << m_loader->version() << ".\n";
  /// get the list properties for the concrete loader load algorithm
  const std::vector<Kernel::Property *> &loader_props =
      m_loader->getProperties();

  // Loop through and set the properties on the Child Algorithm
  std::vector<Kernel::Property *>::const_iterator itr;
  for (itr = loader_props.begin(); itr != loader_props.end(); ++itr) {
    const std::string propName = (*itr)->name();
    if (this->existsProperty(propName)) {
      m_loader->setPropertyValue(propName, getPropertyValue(propName));
    } else if (propName == m_filenamePropName) {
      m_loader->setPropertyValue(propName, getPropertyValue("Filename"));
    }
  }

  // Execute the concrete loader
  m_loader->execute();
  // Set the workspace. Deals with possible multiple periods
  setOutputWorkspace(m_loader);
}
Exemplo n.º 3
0
void LoadNexus::runLoadNexusProcessed() {
  IAlgorithm_sptr loadNexusPro =
      createChildAlgorithm("LoadNexusProcessed", 0., 1.);
  // Pass through the same input filename
  loadNexusPro->setPropertyValue("Filename", m_filename);
  // Set the workspace property
  loadNexusPro->setPropertyValue("OutputWorkspace", m_workspace);

  loadNexusPro->setPropertyValue("SpectrumMin",
                                 getPropertyValue("SpectrumMin"));
  loadNexusPro->setPropertyValue("SpectrumMax",
                                 getPropertyValue("SpectrumMax"));
  loadNexusPro->setPropertyValue("SpectrumList",
                                 getPropertyValue("SpectrumList"));

  /* !!! The spectrum min/max/list properties are currently missing from
     LoadNexus
         so don't pass them through here, just print a warning !!! */

  // Get the array passed in the spectrum_list, if an empty array was passed use
  // the default
  // std::vector<int> specList = getProperty("SpectrumList");
  // if ( !specList.empty() )
  //{
  //  g_log.warning("SpectrumList property ignored - it is not implemented in
  //  LoadNexusProcessed.");
  //  //loadNexusPro->setProperty("SpectrumList",specList);
  //}
  // int specMin = getProperty("SpectrumMin");
  // int specMax = getProperty("SpectrumMax");
  // if ( specMax != Mantid::EMPTY_INT() || specMin != 0 )
  //{
  //  g_log.warning("SpectrumMin/Max properties ignored - they are not
  //  implemented in LoadNexusProcessed.");
  //  //loadNexusPro->setProperty("SpectrumMax",specMin);
  //  //loadNexusPro->setProperty("SpectrumMin",specMax);
  //}

  loadNexusPro->setPropertyValue("EntryNumber",
                                 getPropertyValue("EntryNumber"));
  // Now execute the Child Algorithm. Catch and log any error, but don't stop.
  loadNexusPro->execute();
  if (!loadNexusPro->isExecuted())
    g_log.error(
        "Unable to successfully run LoadNexusProcessed Child Algorithm");

  setOutputWorkspace(loadNexusPro);
}