Commit 9ab980b1 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #21752 int peak number to fix OSX nexus

parent 006323ba
......@@ -52,7 +52,7 @@ private:
/// Read a single peak from peaks file
DataObjects::Peak readPeak(DataObjects::PeaksWorkspace_sptr outWS,
std::string &lastStr, std::ifstream &in,
size_t &seqNum, std::string bankName,
int &seqNum, std::string bankName,
double qSign);
int findPixelID(Geometry::Instrument_const_sptr inst, std::string bankName,
......
......@@ -65,7 +65,7 @@ private:
void calculateQAndAddToOutput(const Kernel::V3D &hkl,
const Kernel::DblMatrix &orientedUB,
const Kernel::DblMatrix &goniometerMatrix,
size_t &seqNum);
int &seqNum);
private:
/// Get the predicted detector direction from Q
......
......@@ -85,7 +85,7 @@ void LoadHKL::exec() {
double wl = std::stod(line.substr(32, 8));
double tbar, trans, scattering;
int run, bank;
size_t seqNum;
int seqNum;
if (cosines) {
tbar = std::stod(line.substr(40, 8)); // tbar
run = std::stoi(line.substr(102, 6));
......
......@@ -256,7 +256,7 @@ std::string LoadIsawPeaks::readHeader(PeaksWorkspace_sptr outWS,
*/
DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS,
std::string &lastStr,
std::ifstream &in, size_t &seqNum,
std::ifstream &in, int &seqNum,
std::string bankName, double qSign) {
double h;
double k;
......@@ -487,7 +487,7 @@ void LoadIsawPeaks::appendFile(PeaksWorkspace_sptr outWS,
oss << bankString << bankNum;
std::string bankName = oss.str();
size_t seqNum;
int seqNum;
try {
// Read the peak
......
......@@ -274,7 +274,7 @@ void PredictPeaks::exec() {
HKLFilterWavelength lambdaFilter(orientedUB, lambdaMin, lambdaMax);
size_t allowedPeakCount = 0;
size_t seqNum = 1;
int seqNum = 1;
bool useExtendedDetectorSpace = getProperty("PredictPeaksOutsideDetectors");
if (useExtendedDetectorSpace &&
......@@ -478,7 +478,7 @@ void PredictPeaks::setStructureFactorCalculatorFromSample(
void PredictPeaks::calculateQAndAddToOutput(const V3D &hkl,
const DblMatrix &orientedUB,
const DblMatrix &goniometerMatrix,
size_t &seqNum) {
int &seqNum) {
// The q-vector direction of the peak is = goniometer * ub * hkl_vector
// This is in inelastic convention: momentum transfer of the LATTICE!
// Also, q does have a 2pi factor = it is equal to 2pi/wavelength.
......
......@@ -345,7 +345,7 @@ void SaveHKL::exec() {
continue;
}
int run = p.getRunNumber();
size_t seqNum = p.getPeakNumber();
int seqNum = p.getPeakNumber();
int bank = 0;
std::string bankName = p.getBankName();
int nCols, nRows;
......
......@@ -261,8 +261,8 @@ void SaveIsawPeaks::exec() {
// =========================================
// Go in order of run numbers
size_t maxPeakNumb = 0;
size_t appendPeakNumb = 0;
int maxPeakNumb = 0;
int appendPeakNumb = 0;
runMap_t::iterator runMap_it;
for (runMap_it = runMap.begin(); runMap_it != runMap.end(); ++runMap_it) {
// Start of a new run
......
......@@ -1155,6 +1155,14 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) {
if (ival != -1)
peakWS->getPeak(r).setRunNumber(ival);
}
} else if (str == "column_17") {
NXInt nxInt = nx_tw.openNXInt(str);
nxInt.load();
for (int r = 0; r < numberPeaks; r++) {
int ival = nxInt[r];
peakWS->getPeak(r).setPeakNumber(ival);
}
} else if (str == "column_15") {
NXDouble nxDouble = nx_tw.openNXDouble(str);
nxDouble.load();
......
......@@ -150,8 +150,8 @@ public:
int getCol() const override;
void setRow(int m_row);
void setCol(int m_col);
void setPeakNumber(size_t m_peakNumber) override;
size_t getPeakNumber() const override;
void setPeakNumber(int m_peakNumber) override;
int getPeakNumber() const override;
virtual Mantid::Kernel::V3D getDetPos() const override;
double getL1() const override;
......@@ -246,7 +246,7 @@ private:
double m_orig_L;
// keep peak number
size_t m_peakNumber;
int m_peakNumber;
/// List of contributing detectors IDs
std::set<int> m_detIDs;
......
......@@ -884,7 +884,7 @@ int Peak::getCol() const { return m_col; }
// -------------------------------------------------------------------------------------
/**Returns the unique peak number
* Returns -1 if it could not find it. */
size_t Peak::getPeakNumber() const { return m_peakNumber; }
int Peak::getPeakNumber() const { return m_peakNumber; }
// -------------------------------------------------------------------------------------
/** For RectangularDetectors only, sets the row (y) of the pixel of the
......@@ -901,7 +901,7 @@ void Peak::setCol(int m_col) { this->m_col = m_col; }
// -------------------------------------------------------------------------------------
/** Sets the unique peak number
* @param m_peakNumber :: unique peak number value */
void Peak::setPeakNumber(size_t m_peakNumber) {
void Peak::setPeakNumber(int m_peakNumber) {
this->m_peakNumber = m_peakNumber;
}
......
......@@ -295,7 +295,7 @@ const void *PeakColumn::void_pointer(size_t index) const {
value = peak.getRunNumber();
return boost::get<int>(&value);
} else if (m_name == "PeakNumber") {
value = static_cast<int>(peak.getPeakNumber());
value = peak.getPeakNumber();
return boost::get<int>(&value);
} else if (m_name == "DetID") {
value = peak.getDetectorID();
......
......@@ -695,7 +695,7 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
std::vector<double> dSpacing(np);
std::vector<double> TOF(np);
std::vector<int> runNumber(np);
std::vector<size_t> peakNumber(np);
std::vector<int> peakNumber(np);
std::vector<double> goniometerMatrix(9 * np);
std::vector<std::string> shapes(np);
......@@ -865,8 +865,8 @@ void PeaksWorkspace::saveNexus(::NeXus::File *file) const {
file->closeData();
// Peak Number column
file->writeData("column_20", peakNumber);
file->openData("column_20");
file->writeData("column_17", peakNumber);
file->openData("column_17");
file->putAttr("name", "Peak Number");
file->putAttr("interpret_as", specifyInteger);
file->putAttr("units", "Not known"); // Units may need changing when known
......
......@@ -77,8 +77,8 @@ public:
virtual double getBinCount() const = 0;
virtual void setBinCount(double m_BinCount) = 0;
virtual size_t getPeakNumber() const = 0;
virtual void setPeakNumber(size_t m_PeakNumber) = 0;
virtual int getPeakNumber() const = 0;
virtual void setPeakNumber(int m_PeakNumber) = 0;
virtual Mantid::Kernel::Matrix<double> getGoniometerMatrix() const = 0;
virtual void setGoniometerMatrix(
......
......@@ -65,9 +65,9 @@ public:
MOCK_CONST_METHOD0(getDetector, Geometry::IDetector_const_sptr());
MOCK_CONST_METHOD0(getInstrument, Geometry::Instrument_const_sptr());
MOCK_CONST_METHOD0(getRunNumber, int());
MOCK_CONST_METHOD0(getPeakNumber, size_t());
MOCK_CONST_METHOD0(getPeakNumber, int());
MOCK_METHOD1(setRunNumber, void(int m_RunNumber));
MOCK_METHOD1(setPeakNumber, void(size_t m_PeakNumber));
MOCK_METHOD1(setPeakNumber, void(int m_PeakNumber));
MOCK_CONST_METHOD0(getMonitorCount, double());
MOCK_METHOD1(setMonitorCount, void(double m_MonitorCount));
MOCK_CONST_METHOD0(getH, double());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment