本文整理汇总了C++中api::MatrixWorkspace_sptr::flagMasked方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_sptr::flagMasked方法的具体用法?C++ MatrixWorkspace_sptr::flagMasked怎么用?C++ MatrixWorkspace_sptr::flagMasked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::MatrixWorkspace_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_sptr::flagMasked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unwrapYandE
/** Unwraps the Y & E vectors of a spectrum according to the ranges found in
* unwrapX.
* @param tempWS :: A pointer to the temporary workspace in which the
* results are being stored
* @param spectrum :: The workspace index
* @param rangeBounds :: The upper and lower ranges for the unwrapping
*/
void UnwrapMonitor::unwrapYandE(const API::MatrixWorkspace_sptr &tempWS,
const int &spectrum,
const std::vector<int> &rangeBounds) {
// Copy over the relevant ranges of Y & E data
MantidVec &Y = tempWS->dataY(spectrum);
MantidVec &E = tempWS->dataE(spectrum);
// Get references to the input data
const MantidVec &YIn = m_inputWS->dataY(spectrum);
const MantidVec &EIn = m_inputWS->dataE(spectrum);
if (rangeBounds[2] != -1) {
// Copy in the upper range
Y.assign(YIn.begin() + rangeBounds[2], YIn.end());
E.assign(EIn.begin() + rangeBounds[2], EIn.end());
// Propagate masking, if necessary
if (m_inputWS->hasMaskedBins(spectrum)) {
const MatrixWorkspace::MaskList &inputMasks =
m_inputWS->maskedBins(spectrum);
MatrixWorkspace::MaskList::const_iterator it;
for (it = inputMasks.begin(); it != inputMasks.end(); ++it) {
if (static_cast<int>((*it).first) >= rangeBounds[2])
tempWS->flagMasked(spectrum, (*it).first - rangeBounds[2],
(*it).second);
}
}
} else {
// Y & E are references to existing vector. Assign above clears them, so
// need to explicitly here
Y.clear();
E.clear();
}
if (rangeBounds[0] != -1 && rangeBounds[1] > 0) {
// Now append the lower range
MantidVec::const_iterator YStart = YIn.begin();
MantidVec::const_iterator EStart = EIn.begin();
Y.insert(Y.end(), YStart + rangeBounds[0], YStart + rangeBounds[1]);
E.insert(E.end(), EStart + rangeBounds[0], EStart + rangeBounds[1]);
// Propagate masking, if necessary
if (m_inputWS->hasMaskedBins(spectrum)) {
const MatrixWorkspace::MaskList &inputMasks =
m_inputWS->maskedBins(spectrum);
MatrixWorkspace::MaskList::const_iterator it;
for (it = inputMasks.begin(); it != inputMasks.end(); ++it) {
const int maskIndex = static_cast<int>((*it).first);
if (maskIndex >= rangeBounds[0] && maskIndex < rangeBounds[1])
tempWS->flagMasked(spectrum, maskIndex - rangeBounds[0],
(*it).second);
}
}
}
}
示例2: readBinMasking
/**
* Read the bin masking information from the mantid_workspace_i/workspace group.
* @param wksp_cls :: The data group
* @param local_workspace :: The workspace to read into
*/
void LoadNexusProcessed::readBinMasking(NXData & wksp_cls, API::MatrixWorkspace_sptr local_workspace)
{
if (wksp_cls.getDataSetInfo("masked_spectra").stat == NX_ERROR)
{
return;
}
NXInt spec = wksp_cls.openNXInt("masked_spectra");
spec.load();
NXInt bins = wksp_cls.openNXInt("masked_bins");
bins.load();
NXDouble weights = wksp_cls.openNXDouble("mask_weights");
weights.load();
const int n = spec.dim0();
const int n1 = n - 1;
for(int i = 0; i < n; ++i)
{
int si = spec(i,0);
int j0 = spec(i,1);
int j1 = i < n1 ? spec(i+1,1) : bins.dim0();
for(int j = j0; j < j1; ++j)
{
local_workspace->flagMasked(si,bins[j],weights[j]);
}
}
}