本文整理汇总了C++中api::MatrixWorkspace_sptr::setBinEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_sptr::setBinEdges方法的具体用法?C++ MatrixWorkspace_sptr::setBinEdges怎么用?C++ MatrixWorkspace_sptr::setBinEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::MatrixWorkspace_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_sptr::setBinEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getData
/**
* Read spectra from the DAE
* @param period :: Current period index
* @param index :: First spectrum number
* @param count :: Number of spectra to read
* @param workspace :: Workspace to store the data
* @param workspaceIndex :: index in workspace to store data
*/
void ISISHistoDataListener::getData(int period, int index, int count,
API::MatrixWorkspace_sptr workspace,
size_t workspaceIndex) {
const int numberOfBins = m_numberOfBins[m_timeRegime];
const size_t bufferSize = count * (numberOfBins + 1) * sizeof(int);
std::vector<int> dataBuffer(bufferSize);
// Read in spectra from DAE
int ndims = 2, dims[2];
dims[0] = count;
dims[1] = numberOfBins + 1;
int spectrumIndex = index + period * (m_totalNumberOfSpectra + 1);
if (IDCgetdat(m_daeHandle, spectrumIndex, count, dataBuffer.data(), dims,
&ndims) != 0) {
g_log.error("Unable to read DATA from DAE " + m_daeName);
throw Kernel::Exception::FileError("Unable to read DATA from DAE ",
m_daeName);
}
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
size_t wi = workspaceIndex + i;
workspace->setBinEdges(wi, m_bins[m_timeRegime]);
MantidVec &y = workspace->dataY(wi);
MantidVec &e = workspace->dataE(wi);
workspace->getSpectrum(wi).setSpectrumNo(index + static_cast<specnum_t>(i));
size_t shift = i * (numberOfBins + 1) + 1;
y.assign(dataBuffer.begin() + shift, dataBuffer.begin() + shift + y.size());
std::transform(y.begin(), y.end(), e.begin(), dblSqrt);
}
}
示例2: setTofInWS
void ConvertEmptyToTof::setTofInWS(const std::vector<double> &tofAxis,
API::MatrixWorkspace_sptr outputWS) {
const size_t numberOfSpectra = m_inputWS->getNumberHistograms();
g_log.debug() << "Setting the TOF X Axis for numberOfSpectra="
<< numberOfSpectra << '\n';
auto axisPtr = Kernel::make_cow<HistogramData::HistogramX>(tofAxis);
HistogramData::BinEdges edges(tofAxis);
Progress prog(this, 0.0, 0.2, numberOfSpectra);
for (size_t i = 0; i < numberOfSpectra; ++i) {
// Replace bin edges with tof axis
outputWS->setBinEdges(i, edges);
prog.report();
} // end for i
outputWS->getAxis(0)->unit() = UnitFactory::Instance().create("TOF");
}