コード例 #1
0
 /** Change the number of steps between start/end.
  *
  * @param nsteps :: the number of steps to take between start and end
  * @param start :: Starting progress
  * @param end :: Ending progress
  */
 void ProgressBase::resetNumSteps(int64_t nsteps, double start, double end)
 {
   m_start = start;
   m_end = end;
   m_i = 0;
   setNumSteps(nsteps);
 }
コード例 #2
0
ファイル: ProgressBase.cpp プロジェクト: mantidproject/mantid
/** Change the number of steps between start/end.
 *
 * @param nsteps :: the number of steps to take between start and end
 * @param start :: Starting progress
 * @param end :: Ending progress
 */
void ProgressBase::resetNumSteps(int64_t nsteps, double start, double end) {
  if (start < 0. || start >= end) {
    std::stringstream msg;
    msg << "Progress range invalid 0 <= start=" << start << " <= end=" << end;
    throw std::invalid_argument(msg.str());
  }
  m_start = start;
  m_end = end;
  m_i = 0;
  m_last_reported = 0;
  m_timeElapsed->reset();
  setNumSteps(nsteps);
}
コード例 #3
0
/*--------------------------------------------*/
void Quantize_Class::quantizeDemo()
{
	setNumSteps();

	for(uint8_t i=0; i<4; i++)
	{
	  if(i == currentQuantizePot && utils->holdingThisPot[testPot] == false) fu2->dpotVals2b[i] = fu2->analogPotVals[testPot];	//if its the current editable pot and not holding test using the analog pot val
	  else fu2->dpotVals2b[i] = fu2->savedPerformVals[i];																		//otherwise use the savedPerformVal
	}
	testVal = fu2->dpotVals2b[currentQuantizePot];																				//then set the test val after deciding where we get dpotVals2b

	utils->processFeatures_editMode();	//do everything so we get to the actual value

	quantizeDemo_display();			//display
}
コード例 #4
0
/** Executes the algorithm. Reading in the file and creating and populating
 *  the output workspace
 *
 *  @throw Exception::FileError If the Nexus file cannot be found/opened
 *  @throw std::invalid_argument If the optional properties are set to invalid
 *values
 */
void LoadTOFRawNexus::exec() {
  // The input properties
  std::string filename = getPropertyValue("Filename");
  m_signalNo = getProperty("Signal");
  m_spec_min = getProperty("SpectrumMin");
  m_spec_max = getProperty("SpectrumMax");

  // Find the entry name we want.
  std::string entry_name = LoadTOFRawNexus::getEntryName(filename);

  // Count pixels and other setup
  auto prog = new Progress(this, 0.0, 1.0, 10);
  prog->doReport("Counting pixels");
  std::vector<std::string> bankNames;
  countPixels(filename, entry_name, bankNames);
  g_log.debug() << "Workspace found to have " << m_numPixels << " pixels and "
                << m_numBins << " bins" << std::endl;

  prog->setNumSteps(bankNames.size() + 5);

  prog->doReport("Creating workspace");
  // Start with a dummy WS just to hold the logs and load the instrument
  MatrixWorkspace_sptr WS = WorkspaceFactory::Instance().create(
      "Workspace2D", m_numPixels, m_numBins + 1, m_numBins);

  // Load the logs
  prog->doReport("Loading DAS logs");
  g_log.debug() << "Loading DAS logs" << std::endl;

  int nPeriods = 1; // Unused
  std::unique_ptr<const TimeSeriesProperty<int>> periodLog(
      new const TimeSeriesProperty<int>("period_log")); // Unused
  LoadEventNexus::runLoadNexusLogs<MatrixWorkspace_sptr>(
      filename, WS, *this, false, nPeriods, periodLog);

  // Load the instrument
  prog->report("Loading instrument");
  g_log.debug() << "Loading instrument" << std::endl;
  LoadEventNexus::runLoadInstrument<MatrixWorkspace_sptr>(filename, WS,
                                                          entry_name, this);

  // Load the meta data, but don't stop on errors
  prog->report("Loading metadata");
  g_log.debug() << "Loading metadata" << std::endl;
  try {
    LoadEventNexus::loadEntryMetadata(filename, WS, entry_name);
  } catch (std::exception &e) {
    g_log.warning() << "Error while loading meta data: " << e.what()
                    << std::endl;
  }

  // Set the spectrum number/detector ID at each spectrum. This is consistent
  // with LoadEventNexus for non-ISIS files.
  prog->report("Building Spectra Mapping");
  g_log.debug() << "Building Spectra Mapping" << std::endl;
  WS->rebuildSpectraMapping(false);
  // And map ID to WI
  g_log.debug() << "Mapping ID to WI" << std::endl;
  const auto id_to_wi = WS->getDetectorIDToWorkspaceIndexMap();

  // Load each bank sequentially
  // PARALLEL_FOR1(WS)
  for (auto bankName : bankNames) {
    //    PARALLEL_START_INTERUPT_REGION
    prog->report("Loading bank " + bankName);
    g_log.debug() << "Loading bank " << bankName << std::endl;
    loadBank(filename, entry_name, bankName, WS, id_to_wi);
    //    PARALLEL_END_INTERUPT_REGION
  }
  //  PARALLEL_CHECK_INTERUPT_REGION

  // Set some units
  if (m_xUnits == "Ang")
    WS->getAxis(0)->setUnit("dSpacing");
  else if (m_xUnits == "invAng")
    WS->getAxis(0)->setUnit("MomentumTransfer");
  else
    // Default to TOF for any other string
    WS->getAxis(0)->setUnit("TOF");
  WS->setYUnit("Counts");

  // Set to the output
  setProperty("OutputWorkspace", WS);

  delete prog;
}