Commit a7ff8f7f authored by Stephen's avatar Stephen
Browse files

Make LoadISISNexus use specnum_t for spectrum based integers.

Fix datablock test
parent cdd44b8e
......@@ -8,10 +8,13 @@
#include "MantidDataHandling/DllConfig.h"
#include "MantidNexus/NexusClasses.h"
#include "MantidGeometry/IDTypes.h"
namespace Mantid {
namespace DataHandling {
using spectrumPair = std::pair<specnum_t, specnum_t>;
class DataBlockGenerator;
/** DataBlock: The DataBlock class holds information about a contiguous
......@@ -29,11 +32,11 @@ public:
virtual ~DataBlock() = default;
virtual int64_t getMinSpectrumID() const;
virtual void setMinSpectrumID(int64_t minSpecID);
virtual specnum_t getMinSpectrumID() const;
virtual void setMinSpectrumID(specnum_t minSpecID);
virtual int64_t getMaxSpectrumID() const;
virtual void setMaxSpectrumID(int64_t minSpecID);
virtual specnum_t getMaxSpectrumID() const;
virtual void setMaxSpectrumID(specnum_t minSpecID);
virtual size_t getNumberOfSpectra() const;
virtual int getNumberOfPeriods() const;
......@@ -51,9 +54,9 @@ protected:
size_t m_numberOfChannels;
// minimal spectra Id (by default 1, undefined -- max_value)
int64_t m_minSpectraID;
specnum_t m_minSpectraID;
// maximal spectra Id (by default 1, undefined -- 0)
int64_t m_maxSpectraID;
specnum_t m_maxSpectraID;
};
} // namespace DataHandling
......
......@@ -18,11 +18,11 @@ namespace DataHandling {
*/
class DLLExport DataBlockComposite : public DataBlock {
public:
int64_t getMinSpectrumID() const override;
void setMinSpectrumID(int64_t) override;
specnum_t getMinSpectrumID() const override;
void setMinSpectrumID(specnum_t) override;
int64_t getMaxSpectrumID() const override;
void setMaxSpectrumID(int64_t) override;
specnum_t getMaxSpectrumID() const override;
void setMaxSpectrumID(specnum_t) override;
size_t getNumberOfSpectra() const override;
size_t getNumberOfChannels() const override;
......@@ -37,8 +37,8 @@ public:
std::vector<DataBlock> getDataBlocks();
DataBlockComposite operator+(const DataBlockComposite &other);
void removeSpectra(DataBlockComposite &toRemove);
void truncate(int64_t specMin, int64_t specMax);
std::vector<int64_t> getAllSpectrumNumbers();
void truncate(specnum_t specMin, specnum_t specMax);
std::vector<specnum_t> getAllSpectrumNumbers();
bool isEmpty();
private:
......@@ -62,8 +62,8 @@ template <typename T>
void DLLExport populateDataBlockCompositeWithContainer(
DataBlockComposite &dataBlockComposite, T &indexContainer, int64_t nArray,
int numberOfPeriods, size_t numberOfChannels,
std::vector<int64_t> monitorSpectra) {
auto isMonitor = [&monitorSpectra](int64_t index) {
std::vector<specnum_t> monitorSpectra) {
auto isMonitor = [&monitorSpectra](specnum_t index) {
return std::find(std::begin(monitorSpectra), std::end(monitorSpectra),
index) != std::end(monitorSpectra);
};
......@@ -77,7 +77,7 @@ void DLLExport populateDataBlockCompositeWithContainer(
void
operator()(Mantid::DataHandling::DataBlockComposite &dataBlockComposite,
int numberOfPeriods, size_t numberOfChannels,
int64_t previousValue, int64_t startValue) {
specnum_t previousValue, specnum_t startValue) {
if (previousValue - startValue > 0) {
auto numberOfSpectra =
previousValue - startValue; /* Should be from [start,
......@@ -103,7 +103,7 @@ void DLLExport populateDataBlockCompositeWithContainer(
void
operator()(Mantid::DataHandling::DataBlockComposite &dataBlockComposite,
int numberOfPeriods, size_t numberOfChannels,
int64_t previousValue, int64_t startValue) {
specnum_t previousValue, specnum_t startValue) {
auto numberOfSpectra = previousValue - startValue + 1;
DataBlock dataBlock(numberOfPeriods, numberOfSpectra, numberOfChannels);
dataBlock.setMinSpectrumID(startValue);
......
......@@ -6,10 +6,8 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataHandling/DataBlock.h"
#include <boost/optional.hpp>
#include <memory>
#include <vector>
namespace Mantid {
namespace DataHandling {
......@@ -22,7 +20,7 @@ class DataBlock;
*/
class DLLExport DataBlockGenerator {
public:
DataBlockGenerator(const std::vector<std::pair<int64_t, int64_t>> &intervals);
DataBlockGenerator(const std::vector<spectrumPair> &intervals);
class DataBlock;
DataBlockGenerator &operator++();
DataBlockGenerator operator++(int);
......@@ -31,7 +29,7 @@ public:
void next();
public:
std::vector<std::pair<int64_t, int64_t>> m_intervals;
std::vector<spectrumPair> m_intervals;
int64_t m_currentSpectrum;
boost::optional<size_t> m_currentIntervalIndex;
......
......@@ -99,7 +99,7 @@ private:
bool checkOptionalProperties(bool bseparateMonitors, bool bexcludeMonitor);
/// Prepare a vector of SpectraBlock structures to simplify loading
size_t prepareSpectraBlocks(std::map<int64_t, std::string> &monitors,
size_t prepareSpectraBlocks(std::map<specnum_t, std::string> &monitors,
DataBlockComposite &LoadBlock);
/// Run LoadInstrument as a ChildAlgorithm
void runLoadInstrument(DataObjects::Workspace2D_sptr &);
......@@ -168,11 +168,11 @@ private:
/// Time channels
std::shared_ptr<HistogramData::HistogramX> m_tof_data;
/// Spectra numbers
std::vector<int> m_spec;
std::vector<specnum_t> m_spec;
/// Pointer to one-past-the-end of spectrum number array (m_spec)
const int *m_spec_end;
const specnum_t *m_spec_end;
/// Monitors, map spectrum index to monitor group name
std::map<int64_t, std::string> m_monitors;
std::map<specnum_t, std::string> m_monitors;
/// A pointer to the ISISRunLogs creator
boost::scoped_ptr<ISISRunLogs> m_logCreator;
/// Progress reporting object
......@@ -185,9 +185,9 @@ private:
// clang-format on
bool findSpectraDetRangeInFile(NeXus::NXEntry &entry,
std::vector<int> &spectrum_index,
std::vector<specnum_t> &spectrum_index,
int64_t ndets, int64_t n_vms_compat_spectra,
std::map<int64_t, std::string> &monitors,
std::map<specnum_t, std::string> &monitors,
bool excludeMonitors, bool separateMonitors);
/// Check if is the file is a multiple time regime file
......
......@@ -17,28 +17,28 @@ namespace DataHandling {
DataBlock::DataBlock()
: m_numberOfPeriods(0), m_numberOfSpectra(0), m_numberOfChannels(0),
m_minSpectraID(std::numeric_limits<int64_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
DataBlock::DataBlock(const Mantid::NeXus::NXInt &data)
: m_numberOfPeriods(data.dim0()), m_numberOfSpectra(data.dim1()),
m_numberOfChannels(data.dim2()),
m_minSpectraID(std::numeric_limits<int64_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
DataBlock::DataBlock(int numberOfPeriods, size_t numberOfSpectra,
size_t numberOfChannels)
: m_numberOfPeriods(numberOfPeriods), m_numberOfSpectra(numberOfSpectra),
m_numberOfChannels(numberOfChannels),
m_minSpectraID(std::numeric_limits<int64_t>::max()), m_maxSpectraID(0) {}
m_minSpectraID(std::numeric_limits<specnum_t>::max()), m_maxSpectraID(0) {}
int64_t DataBlock::getMinSpectrumID() const { return m_minSpectraID; }
specnum_t DataBlock::getMinSpectrumID() const { return m_minSpectraID; }
void DataBlock::setMinSpectrumID(int64_t minSpecID) {
void DataBlock::setMinSpectrumID(specnum_t minSpecID) {
m_minSpectraID = minSpecID;
}
int64_t DataBlock::getMaxSpectrumID() const { return m_maxSpectraID; }
specnum_t DataBlock::getMaxSpectrumID() const { return m_maxSpectraID; }
void DataBlock::setMaxSpectrumID(int64_t maxSpecID) {
void DataBlock::setMaxSpectrumID(specnum_t maxSpecID) {
m_maxSpectraID = maxSpecID;
}
......@@ -49,7 +49,7 @@ int DataBlock::getNumberOfPeriods() const { return m_numberOfPeriods; }
size_t DataBlock::getNumberOfChannels() const { return m_numberOfChannels; }
std::unique_ptr<DataBlockGenerator> DataBlock::getGenerator() const {
std::vector<std::pair<int64_t, int64_t>> interval{
std::vector<spectrumPair> interval{
std::make_pair(m_minSpectraID, m_maxSpectraID)};
return std::make_unique<DataBlockGenerator>(interval);
}
......
......@@ -11,8 +11,9 @@
namespace {
const int64_t invalidIntervalValue = std::numeric_limits<int64_t>::min();
using Mantid::specnum_t;
const specnum_t invalidIntervalValue = std::numeric_limits<specnum_t>::min();
using Mantid::DataHandling::spectrumPair;
/**
* Gets all removal intervals which have an overlap with the original interval.
* This can be either
......@@ -22,13 +23,13 @@ const int64_t invalidIntervalValue = std::numeric_limits<int64_t>::min();
* 3. remove interval contains original interval: check start value of original
* in range
*/
std::vector<std::pair<int64_t, int64_t>>
std::vector<spectrumPair>
getRemovalIntervalsRelevantForTheCurrentOriginalInterval(
const std::pair<int64_t, int64_t> &original,
const std::vector<std::pair<int64_t, int64_t>> &removeIntervals) {
const spectrumPair &original,
const std::vector<spectrumPair> &removeIntervals) {
auto hasOverlap = [](const std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
auto hasOverlap = [](const spectrumPair &original,
const spectrumPair &toRemove) {
return ((original.first <= toRemove.first) &&
(toRemove.first <= original.second)) ||
((original.first <= toRemove.second) &&
......@@ -37,7 +38,7 @@ getRemovalIntervalsRelevantForTheCurrentOriginalInterval(
(original.first <= toRemove.second));
};
std::vector<std::pair<int64_t, int64_t>> overlaps;
std::vector<spectrumPair> overlaps;
for (auto &removeInterval : removeIntervals) {
if (hasOverlap(original, removeInterval)) {
overlaps.emplace_back(removeInterval);
......@@ -54,8 +55,8 @@ getRemovalIntervalsRelevantForTheCurrentOriginalInterval(
cut |---....
return: NONE
*/
void handleLeftHandSideOverlap(std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
void handleLeftHandSideOverlap(spectrumPair &original,
const spectrumPair &toRemove) {
original.first = toRemove.second + 1;
}
......@@ -67,9 +68,8 @@ void handleLeftHandSideOverlap(std::pair<int64_t, int64_t> &original,
cut we are at the end, set interval to invalid
return ...-|
*/
std::pair<int64_t, int64_t>
handleRightHandSideOverlap(std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
spectrumPair handleRightHandSideOverlap(spectrumPair &original,
const spectrumPair &toRemove) {
auto newInterval = std::make_pair(original.first, toRemove.first - 1);
original.first = invalidIntervalValue;
original.second = invalidIntervalValue;
......@@ -84,21 +84,20 @@ handleRightHandSideOverlap(std::pair<int64_t, int64_t> &original,
cut |---...
return ...--|
*/
std::pair<int64_t, int64_t>
handleFullyContained(std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
spectrumPair handleFullyContained(spectrumPair &original,
const spectrumPair &toRemove) {
// It is important to first creat the new pair and then perform the cut
auto newPair = std::make_pair(original.first, toRemove.first - 1);
original.first = toRemove.second + 1;
return newPair;
}
std::vector<std::pair<int64_t, int64_t>> getSlicedIntervals(
std::pair<int64_t, int64_t> original,
const std::vector<std::pair<int64_t, int64_t>> &removeIntervals) {
std::vector<spectrumPair>
getSlicedIntervals(spectrumPair original,
const std::vector<spectrumPair> &removeIntervals) {
// If there is nothing to remove return the original
if (removeIntervals.empty()) {
return std::vector<std::pair<int64_t, int64_t>>{original};
return std::vector<spectrumPair>{original};
}
// There are several overlap scenarios.
......@@ -115,31 +114,30 @@ std::vector<std::pair<int64_t, int64_t>> getSlicedIntervals(
// original : ...-------...
// toRemove: |---|
auto isFullOverlap = [](const std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
auto isFullOverlap = [](const spectrumPair &original,
const spectrumPair &toRemove) {
return (toRemove.first <= original.first) &&
(original.first <= toRemove.second) &&
(toRemove.first <= original.second) &&
(original.second <= toRemove.second);
};
auto isLeftHandSideOverlap = [](const std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
auto isLeftHandSideOverlap = [](const spectrumPair &original,
const spectrumPair &toRemove) {
return (toRemove.first <= original.first) &&
(original.first <= toRemove.second) &&
(toRemove.second < original.second);
};
auto isRightHandSideOverlap =
[](const std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
return (original.first < toRemove.first) &&
(toRemove.first <= original.second) &&
(original.second <= toRemove.second);
};
auto isRightHandSideOverlap = [](const spectrumPair &original,
const spectrumPair &toRemove) {
return (original.first < toRemove.first) &&
(toRemove.first <= original.second) &&
(original.second <= toRemove.second);
};
auto isFullyContained = [](const std::pair<int64_t, int64_t> &original,
const std::pair<int64_t, int64_t> &toRemove) {
auto isFullyContained = [](const spectrumPair &original,
const spectrumPair &toRemove) {
return (original.first < toRemove.first) &&
(toRemove.first < original.second) &&
(original.first < toRemove.second) &&
......@@ -148,7 +146,7 @@ std::vector<std::pair<int64_t, int64_t>> getSlicedIntervals(
// Use that removeIntervals has oredred, non-overlapping intervals
// Subtract all the removeIntervals
std::vector<std::pair<int64_t, int64_t>> newIntervals;
std::vector<spectrumPair> newIntervals;
for (auto &removeInterval : removeIntervals) {
if (isFullOverlap(original, removeInterval)) {
......@@ -204,9 +202,9 @@ template <typename T> void sortDataBlocks(T &dataBlcokCollection) {
comparison);
}
std::vector<std::pair<int64_t, int64_t>> spectrumIDIntervals(
std::vector<spectrumPair> spectrumIDIntervals(
const std::vector<Mantid::DataHandling::DataBlock> &blocks) {
std::vector<std::pair<int64_t, int64_t>> intervals;
std::vector<spectrumPair> intervals;
intervals.reserve(blocks.size());
std::transform(blocks.begin(), blocks.end(), std::back_inserter(intervals),
......@@ -221,8 +219,8 @@ std::vector<std::pair<int64_t, int64_t>> spectrumIDIntervals(
namespace Mantid {
namespace DataHandling {
int64_t DataBlockComposite::getMinSpectrumID() const {
int64_t min = std::numeric_limits<int64_t>::max();
specnum_t DataBlockComposite::getMinSpectrumID() const {
specnum_t min = std::numeric_limits<specnum_t>::max();
for (const auto &child : m_dataBlocks) {
auto temp = child.getMinSpectrumID();
if (temp < min) {
......@@ -232,12 +230,12 @@ int64_t DataBlockComposite::getMinSpectrumID() const {
return min;
}
void DataBlockComposite::setMinSpectrumID(int64_t /*minSpecID*/) {
void DataBlockComposite::setMinSpectrumID(specnum_t /*minSpecID*/) {
// DO NOTHING
}
int64_t DataBlockComposite::getMaxSpectrumID() const {
int64_t max = std::numeric_limits<int64_t>::min();
specnum_t DataBlockComposite::getMaxSpectrumID() const {
specnum_t max = std::numeric_limits<specnum_t>::min();
for (const auto &child : m_dataBlocks) {
auto temp = child.getMaxSpectrumID();
if (temp > max) {
......@@ -247,7 +245,7 @@ int64_t DataBlockComposite::getMaxSpectrumID() const {
return max;
}
void DataBlockComposite::setMaxSpectrumID(int64_t /*minSpecID*/) {
void DataBlockComposite::setMaxSpectrumID(specnum_t /*minSpecID*/) {
// DO NOTHING
}
......@@ -282,8 +280,8 @@ int DataBlockComposite::getNumberOfPeriods() const {
return m_dataBlocks.empty() ? 0 : m_dataBlocks[0].getNumberOfPeriods();
}
DataBlockComposite DataBlockComposite::
operator+(const DataBlockComposite &other) {
DataBlockComposite
DataBlockComposite::operator+(const DataBlockComposite &other) {
DataBlockComposite output;
output.m_dataBlocks.insert(std::end(output.m_dataBlocks),
std::begin(m_dataBlocks), std::end(m_dataBlocks));
......@@ -299,7 +297,7 @@ std::vector<DataBlock> DataBlockComposite::getDataBlocks() {
return m_dataBlocks;
}
void DataBlockComposite::truncate(int64_t specMin, int64_t specMax) {
void DataBlockComposite::truncate(specnum_t specMin, specnum_t specMax) {
sortDataBlocks(m_dataBlocks);
// Find the first data block which is not completely cut off by specMin
// original: |-----| |--------| |------|
......@@ -426,7 +424,7 @@ void DataBlockComposite::removeSpectra(DataBlockComposite &toRemove) {
// Now create the new intervals which don't include the removeInterval
// values
std::vector<std::pair<int64_t, int64_t>> newIntervals;
std::vector<spectrumPair> newIntervals;
for (auto &originalInterval : originalIntervals) {
// Find all relevant remove intervals. In principal this could
// be made more efficient.
......@@ -458,9 +456,9 @@ void DataBlockComposite::removeSpectra(DataBlockComposite &toRemove) {
* Provides a container with all spectrum numbers
* @returns a container with all sepctrum numbers
*/
std::vector<int64_t> DataBlockComposite::getAllSpectrumNumbers() {
std::vector<specnum_t> DataBlockComposite::getAllSpectrumNumbers() {
auto generator = getGenerator();
std::vector<int64_t> allSpectra;
std::vector<specnum_t> allSpectra;
for (; !generator->isDone(); generator->next()) {
allSpectra.emplace_back(generator->getValue());
......
......@@ -14,11 +14,11 @@ namespace DataHandling {
// DataBlock Generator
// -------------------------------------------------------------
DataBlockGenerator::DataBlockGenerator(
const std::vector<std::pair<int64_t, int64_t>> &intervals)
const std::vector<spectrumPair> &intervals)
: m_intervals(intervals) {
// We need to sort the data items.
auto comparison = [](const std::pair<int64_t, int64_t> &el1,
const std::pair<int64_t, int64_t> &el2) {
auto comparison = [](const spectrumPair &el1,
const spectrumPair &el2) {
return el1.first < el2.first;
};
std::sort(m_intervals.begin(), m_intervals.end(), comparison);
......
......@@ -107,12 +107,13 @@ void LoadISISNexus2::init() {
declareProperty(std::make_unique<WorkspaceProperty<Workspace>>(
"OutputWorkspace", "", Direction::Output));
auto mustBePositive = std::make_shared<BoundedValidator<int64_t>>();
mustBePositive->setLower(0);
declareProperty("SpectrumMin", static_cast<int64_t>(0), mustBePositive);
declareProperty("SpectrumMax", static_cast<int64_t>(EMPTY_INT()),
mustBePositive);
declareProperty(std::make_unique<ArrayProperty<int64_t>>("SpectrumList"));
auto mustBePositiveSpectrum = std::make_shared<BoundedValidator<specnum_t>>();
mustBePositiveSpectrum->setLower(0);
declareProperty("SpectrumMin", static_cast<specnum_t>(0), mustBePositiveSpectrum);
declareProperty("SpectrumMax", static_cast<specnum_t>(EMPTY_INT()),
mustBePositiveSpectrum);
declareProperty(std::make_unique<ArrayProperty<specnum_t>>("SpectrumList"));
auto mustBePositive= std::make_shared<BoundedValidator<int64_t>>();
declareProperty("EntryNumber", static_cast<int64_t>(0), mustBePositive,
"0 indicates that every entry is loaded, into a separate "
"workspace within a group. "
......@@ -206,7 +207,7 @@ void LoadISISNexus2::exec() {
NXInt index =
entry.openNXInt(std::string(it->nxname) + "/spectrum_index");
index.load();
int64_t ind = *index();
specnum_t ind = static_cast<specnum_t>(*index());
// Spectrum index of 0 means no spectrum associated with that monitor,
// so only count those with index > 0
if (ind > 0) {
......@@ -431,21 +432,6 @@ void LoadISISNexus2::exec() {
m_monitors.clear();
m_wsInd2specNum_map.clear();
}
// Function object for remove_if STL algorithm
namespace {
// Check the numbers supplied are not in the range and erase the ones that are
struct range_check {
range_check(int64_t min, int64_t max) : m_min(min), m_max(max) {}
bool operator()(int64_t x) { return (x >= m_min && x <= m_max); }
private:
int64_t m_min;
int64_t m_max;
};
} // namespace
/**
Check for a set of synthetic logs associated with multi-period log data. Raise
warnings where necessary.
......@@ -477,8 +463,8 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors,
bool range_supplied(false);
// Get the spectrum selection which were specfied by the user
int64_t spec_min = getProperty("SpectrumMin");
int64_t spec_max = getProperty("SpectrumMax");
specnum_t spec_min = getProperty("SpectrumMin");
specnum_t spec_max = getProperty("SpectrumMax");
// If spearate monitors or excluded monitors is selected then we
// need to build up a wsIndex to spectrum number map as well,
......@@ -530,7 +516,7 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors,
}
// Did the user provide a spectrum list
std::vector<int64_t> spec_list = getProperty("SpectrumList");
std::vector<specnum_t> spec_list = getProperty("SpectrumList");
auto hasSpecList = false;
if (!spec_list.empty()) {
......@@ -585,7 +571,7 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors,
if (range_supplied) {
// First remove all entries which are inside of the min and max spectrum,
// to avoid duplicates
auto isInRange = [&spec_min, &spec_max](int64_t x) {
auto isInRange = [&spec_min, &spec_max](specnum_t x) {
return (spec_min <= x) && (x <= spec_max);
};
......@@ -593,12 +579,10 @@ bool LoadISISNexus2::checkOptionalProperties(bool bseparateMonitors,
spec_list.end());
// The spec_min - spec_max range needs to be added to the spec list
for (int64_t i = spec_min; i < spec_max + 1; ++i) {
auto spec_num = static_cast<specnum_t>(i);
spec_list.emplace_back(spec_num);
std::sort(spec_list.begin(), spec_list.end());
// supplied range converted into the list, so no more supplied range
for (auto i = spec_min; i < spec_max + 1; ++i) {
spec_list.emplace_back(i);
}
std::sort(spec_list.begin(), spec_list.end());
}
auto monitorSpectra = m_monBlockInfo.getAllSpectrumNumbers();
......@@ -696,12 +680,12 @@ void LoadISISNexus2::buildSpectraInd2SpectraNumMap(
* @return :: Number of spectra to load.
*/
size_t
LoadISISNexus2::prepareSpectraBlocks(std::map<int64_t, std::string> &monitors,
LoadISISNexus2::prepareSpectraBlocks(std::map<specnum_t, std::string> &monitors,
DataBlockComposite &LoadBlock) {
std::vector<int64_t> includedMonitors;
std::vector<specnum_t> includedMonitors;
// Setup the SpectraBlocks based on the DataBlocks
auto dataBlocks = LoadBlock.getDataBlocks();
auto isMonitor = [&monitors](int64_t spectrumNumber) {
auto isMonitor = [&monitors](specnum_t spectrumNumber) {
return monitors.find(spectrumNumber) != monitors.end();
};
for (const auto &dataBlock : dataBlocks) {
......@@ -1046,8 +1030,8 @@ double LoadISISNexus2::dblSqrt(double in) { return sqrt(in); }
*
*/
bool LoadISISNexus2::findSpectraDetRangeInFile(
NXEntry &entry, std::vector<int> &spectrum_index, int64_t ndets,
int64_t n_vms_compat_spectra, std::map<int64_t, std::string> &monitors,
NXEntry &entry, std::vector<specnum_t> &spectrum_index, int64_t ndets,
int64_t n_vms_compat_spectra, std::map<specnum_t, std::string> &monitors,
bool excludeMonitors, bool separateMonitors) {
size_t nmons = monitors.size();
......@@ -1056,7 +1040,7 @@ bool LoadISISNexus2::findSpectraDetRangeInFile(
// Iterate over each monitor and create a data block for each monitor
for (const auto &monitor : monitors) {
auto monID = static_cast<int64_t>(monitor.first);
auto monID = monitor.first;
auto monTemp = DataBlock(chans);
monTemp.setMinSpectrumID(monID);
monTemp.setMaxSpectrumID(monID);
......
......@@ -15,6 +15,7 @@
using Mantid::DataHandling::DataBlock;
using Mantid::DataHandling::DataBlockComposite;
using Mantid::specnum_t;