示例#1
0
文件: LoadLLB.cpp 项目: mducle/mantid
void LoadLLB::loadTimeDetails(NeXus::NXEntry &entry) {

  m_wavelength = entry.getFloat("nxbeam/incident_wavelength");
  // Apparently this is in the wrong units
  // http://iramis.cea.fr/Phocea/file.php?class=page&reload=1227895533&file=21/How_to_install_and_use_the_Fitmib_suite_v28112008.pdf
  m_channelWidth = entry.getInt("nxmonitor/channel_width") * 0.1;

  g_log.debug("Nexus Data:");
  g_log.debug() << " ChannelWidth: " << m_channelWidth << '\n';
  g_log.debug() << " Wavelength: " << m_wavelength << '\n';
}
示例#2
0
/*
 * Loads metadata present in the nexus file
 */
void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry,
                               const std::string &instrumentNamePath) {

  g_log.debug("Loading metadata...");

  API::Run &runDetails = m_localWorkspace->mutableRun();

  int runNum = entry.getInt("run_number");
  std::string run_num = std::to_string(runNum);
  runDetails.addProperty("run_number", run_num);

  if (entry.getFloat("mode") == 0.0) { // Not TOF
    runDetails.addProperty<std::string>("tof_mode", "Non TOF");
  } else {
    runDetails.addProperty<std::string>("tof_mode", "TOF");
  }

  std::string desc =
      m_loader.getStringFromNexusPath(entry, "sample_description");
  runDetails.addProperty("sample_description", desc);

  std::string start_time = entry.getString("start_time");
  start_time = m_loader.dateTimeInIsoFormat(start_time);
  runDetails.addProperty("run_start", start_time);

  std::string end_time = entry.getString("end_time");
  end_time = m_loader.dateTimeInIsoFormat(end_time);
  runDetails.addProperty("run_end", end_time);

  double duration = entry.getFloat("duration");
  runDetails.addProperty("timer", duration);

  double wavelength =
      entry.getFloat(instrumentNamePath + "/selector/wavelength");
  g_log.debug() << "Wavelength found in the nexus file: " << wavelength << '\n';

  if (wavelength <= 0) {
    g_log.debug() << "Mode = " << entry.getFloat("mode") << '\n';
    g_log.information("The wavelength present in the NeXus file <= 0.");
    if (entry.getFloat("mode") == 0.0) { // Not TOF
      throw std::runtime_error("Working in Non TOF mode and the wavelength in "
                               "the file is <=0 !!! Check with the instrument "
                               "scientist!");
    }
  } else {
    double wavelengthRes =
        entry.getFloat(instrumentNamePath + "/selector/wavelength_res");
    runDetails.addProperty<double>("wavelength", wavelength);
    double ei = m_loader.calculateEnergy(wavelength);
    runDetails.addProperty<double>("Ei", ei, true);
    // wavelength
    m_defaultBinning[0] = wavelength - wavelengthRes * wavelength * 0.01 / 2;
    m_defaultBinning[1] = wavelength + wavelengthRes * wavelength * 0.01 / 2;
  }

  // Put the detector distances:
  //	std::string detectorPath(instrumentNamePath + "/detector");
  //	// Just for Sample - RearDetector
  //	double sampleDetectorDistance =
  // m_loader.getDoubleFromNexusPath(entry,detectorPath + "/det2_calc");
  //	runDetails.addProperty("sample_detector_distance",
  // sampleDetectorDistance);
}