Skip to content

Commit

Permalink
Merge branch 'master' into feature/10638_idr_ungroup_output
Browse files Browse the repository at this point in the history
Refs #10638
  • Loading branch information
DanNixon committed Nov 28, 2014
2 parents fc10f5e + 4427370 commit 35ad27a
Show file tree
Hide file tree
Showing 28 changed files with 1,417 additions and 922 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Build/dev-packages/deb/mantid-developer/README
Expand Up @@ -2,5 +2,5 @@ This directory contains the structure required to build the simple mantid-develo

To build the package:
* Switch to the directory containing this file
* Run "dpkg --build mantid-developer-1.2.1"
* A file called mantid-developer-1.2.1.deb will appear in the current directory.
* Run "dpkg --build mantid-developer-1.2.2"
* A file called mantid-developer-1.2.2.deb will appear in the current directory.
@@ -0,0 +1,13 @@
Package: mantid-developer
Version: 1.2.2
Section: main
Priority: optional
Architecture: all
Depends: git, cmake-qt-gui(>=2.8.12), qt4-qmake, qt4-dev-tools, libqt4-dbg, libpoco-dev(>=1.4.2), libboost-all-dev, libboost-dbg, libnexus0-dev, libgoogle-perftools-dev, libqwt5-qt4-dev, libqwtplot3d-qt4-dev, python-qt4-dev, libgsl0-dev, liboce-visualization-dev, libmuparser-dev, python-numpy, libssl-dev, libqscintilla2-dev, texlive,texlive-latex-extra, dvipng, libhdf4-dev, doxygen, python-sphinx, python-scipy, ipython-qtconsole (>=1.2.0), libhdf5-dev, libhdf4-dev, libpococrypto11-dbg, libpocodata11-dbg, libpocofoundation11-dbg, libpocomysql11-dbg, libpoconet11-dbg, libpoconetssl11-dbg, libpocoodbc11-dbg, libpocosqlite11-dbg, libpocoutil11-dbg, libpocoxml11-dbg, libpocozip11-dbg, python-qt4-dbg, qt4-default, ninja-build, libjsoncpp-dev, python-dateutil
Installed-Size: 0
Maintainer: Mantid Project <mantid-help@mantidproject.org>
Description: Installs all packages required for a Mantid developer
A metapackage which requires all the dependencies and tools that are
required for Mantid development. It works for Ubuntu version 14.04, 14.10
Some packages (poco) must be newer than thiose in the Ubuntu repository. Please
follow instructions at http://www.mantidproject.org/Mantid_Prerequisites#Repositories
14 changes: 13 additions & 1 deletion Code/Mantid/Framework/API/src/ExperimentInfo.cpp
Expand Up @@ -114,6 +114,19 @@ namespace API
<< inst->getValidFromDate().toFormattedString("%Y-%b-%d")
<< " to " << inst->getValidToDate().toFormattedString("%Y-%b-%d") << ")";
out << "\n";
if (!inst->getFilename().empty())
{
out << "Instrument from: " << inst->getFilename();
out << "\n";
}

//parameter files loaded
auto paramFileVector = this->instrumentParameters().getParameterFilenames();
for (auto itFilename = paramFileVector.begin(); itFilename != paramFileVector.end(); ++itFilename)
{
out << "Parameters from: " << *itFilename;
out << "\n";
}

std::string runStart = getAvailableWorkspaceStartDate();
std::string runEnd = getAvailableWorkspaceEndDate();
Expand Down Expand Up @@ -376,7 +389,6 @@ namespace API
{
if(m_detgroups.empty())
{
g_log.debug("No detector mapping cached, getting detector from instrument");
return getInstrument()->getDetector(detID);
}
else
Expand Down
9 changes: 1 addition & 8 deletions Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp
Expand Up @@ -14,9 +14,6 @@
#include <Poco/DOM/DOMParser.h>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/Element.h>
#include <Poco/DOM/NodeList.h>
#include <Poco/DOM/NodeIterator.h>
#include <Poco/DOM/NodeFilter.h>
#include <Poco/File.h>
#include <Poco/Path.h>
#include <boost/algorithm/string/split.hpp>
Expand All @@ -25,10 +22,6 @@
using Poco::XML::DOMParser;
using Poco::XML::Document;
using Poco::XML::Element;
using Poco::XML::Node;
using Poco::XML::NodeList;
using Poco::XML::NodeIterator;
using Poco::XML::NodeFilter;


namespace Mantid
Expand Down Expand Up @@ -87,7 +80,7 @@ namespace Mantid

// Set up the DOM parser and parse xml file
DOMParser pParser;
Document* pDoc;
Poco::AutoPtr<Document> pDoc;
try
{
pDoc = pParser.parse(directoryName+instshort);
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/ReadGroupsFromFile.cpp
Expand Up @@ -203,7 +203,7 @@ namespace Algorithms
void ReadGroupsFromFile::readXMLGroupingFile(const std::string& filename)
{
Poco::XML::DOMParser xmlParser;
Poco::XML::Document* file;
Poco::AutoPtr<Poco::XML::Document> file;
try
{
file = xmlParser.parse(filename);
Expand All @@ -220,7 +220,7 @@ namespace Algorithms
throw Kernel::Exception::FileError("No root element in XML grouping file: ", filename);
}

Poco::XML::NodeList* groups = root->getElementsByTagName("group");
Poco::AutoPtr<Poco::XML::NodeList> groups = root->getElementsByTagName("group");

if ( groups->length() == 0 )
{
Expand Down
16 changes: 15 additions & 1 deletion Code/Mantid/Framework/Algorithms/src/SofQW.cpp
Expand Up @@ -6,6 +6,7 @@
#include "MantidAlgorithms/SofQW.h"
#include "MantidDataObjects/Histogram1D.h"
#include "MantidAPI/BinEdgeAxis.h"
#include "MantidAPI/SpectrumDetectorMapping.h"
#include "MantidAPI/WorkspaceValidators.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/RebinParamsValidator.h"
Expand Down Expand Up @@ -79,6 +80,7 @@ void SofQW::exec()
using namespace Geometry;

MatrixWorkspace_const_sptr inputWorkspace = getProperty("InputWorkspace");

// Do the full check for common binning
if ( ! WorkspaceHelpers::commonBoundaries(inputWorkspace) )
{
Expand All @@ -90,6 +92,10 @@ void SofQW::exec()
MatrixWorkspace_sptr outputWorkspace = setUpOutputWorkspace(inputWorkspace, getProperty("QAxisBinning"), verticalAxis);
setProperty("OutputWorkspace",outputWorkspace);

// Holds the spectrum-detector mapping
std::vector<specid_t> specNumberMapping;
std::vector<detid_t> detIDMapping;

m_EmodeProperties.initCachedValues(inputWorkspace,this);
int emode = m_EmodeProperties.m_emode;

Expand Down Expand Up @@ -200,7 +206,11 @@ void SofQW::exec()
if ( q < verticalAxis.front() || q > verticalAxis.back() ) continue;
// Find which q bin this point lies in
const MantidVec::difference_type qIndex =
std::upper_bound(verticalAxis.begin(),verticalAxis.end(),q) - verticalAxis.begin() - 1;
std::upper_bound(verticalAxis.begin(), verticalAxis.end(), q) - verticalAxis.begin() - 1;

// Add this spectra-detector pair to the mapping
specNumberMapping.push_back(outputWorkspace->getSpectrum(qIndex)->getSpectrumNo());
detIDMapping.push_back(det->getID());

// And add the data and it's error to that bin, taking into account the number of detectors contributing to this bin
outputWorkspace->dataY(qIndex)[j] += Y[j]/numDets_d;
Expand All @@ -219,6 +229,10 @@ void SofQW::exec()

// If the input workspace was a distribution, need to divide by q bin width
if (inputWorkspace->isDistribution()) this->makeDistribution(outputWorkspace,verticalAxis);

// Set the output spectrum-detector mapping
SpectrumDetectorMapping outputDetectorMap(specNumberMapping, detIDMapping);
outputWorkspace->updateSpectraUsing(outputDetectorMap);
}

/** Creates the output workspace, setting the axes according to the input binning parameters
Expand Down
35 changes: 29 additions & 6 deletions Code/Mantid/Framework/Algorithms/src/SofQW2.cpp
Expand Up @@ -4,6 +4,7 @@
#include "MantidAlgorithms/SofQW2.h"
#include "MantidAlgorithms/SofQW.h"
#include "MantidAPI/SpectraAxis.h"
#include "MantidAPI/SpectrumDetectorMapping.h"
#include "MantidGeometry/Math/LaszloIntersection.h"
#include "MantidGeometry/Math/Quadrilateral.h"
#include "MantidGeometry/Math/Vertex2D.h"
Expand Down Expand Up @@ -68,6 +69,10 @@ namespace Mantid

const size_t nTheta = m_thetaPts.size();
const MantidVec & X = inputWS->readX(0);

// Holds the spectrum-detector mapping
std::vector<specid_t> specNumberMapping;
std::vector<detid_t> detIDMapping;

// Select the calculate Q method based on the mode
// rather than doing this repeatedly in the loop
Expand All @@ -82,20 +87,23 @@ namespace Mantid
qCalculator = &SofQW2::calculateIndirectQ;
}

PARALLEL_FOR2(inputWS, outputWS)
/* PARALLEL_FOR2(inputWS, outputWS) */
for(int64_t i = 0; i < static_cast<int64_t>(nTheta); ++i) // signed for openmp
{
PARALLEL_START_INTERUPT_REGION
/* PARALLEL_START_INTERUPT_REGION */

const double theta = m_thetaPts[i];
if( theta < 0.0 ) // One to skip
{
continue;
}

IDetector_const_sptr det = inputWS->getDetector(i);
double halfWidth(0.5*m_thetaWidth);
const double thetaLower = theta - halfWidth;
const double thetaUpper = theta + halfWidth;
const double efixed = m_EmodeProperties.getEFixed(inputWS->getDetector(i));
const double efixed = m_EmodeProperties.getEFixed(det);

for(size_t j = 0; j < nenergyBins; ++j)
{
m_progress->report("Computing polygon intersections");
Expand All @@ -104,20 +112,35 @@ namespace Mantid
const double dE_j = X[j];
const double dE_jp1 = X[j+1];

const double lrQ = (this->*qCalculator)(efixed, dE_jp1,thetaLower,0.0);

const V2D ll(dE_j, (this->*qCalculator)(efixed, dE_j,thetaLower,0.0));
const V2D lr(dE_jp1, (this->*qCalculator)(efixed, dE_jp1,thetaLower,0.0));
const V2D lr(dE_jp1, lrQ);
const V2D ur(dE_jp1, (this->*qCalculator)(efixed, dE_jp1,thetaUpper,0.0));
const V2D ul(dE_j, (this->*qCalculator)(efixed, dE_j,thetaUpper,0.0));
Quadrilateral inputQ = Quadrilateral(ll, lr, ur, ul);

rebinToOutput(inputQ, inputWS, i, j, outputWS, m_Qout);

// Find which q bin this point lies in
const MantidVec::difference_type qIndex = std::upper_bound(m_Qout.begin(), m_Qout.end(), lrQ) - m_Qout.begin();
if(qIndex != 0 && qIndex < static_cast<int>(m_Qout.size()))
{
// Add this spectra-detector pair to the mapping
specNumberMapping.push_back(outputWS->getSpectrum(qIndex - 1)->getSpectrumNo());
detIDMapping.push_back(det->getID());
}
}

PARALLEL_END_INTERUPT_REGION
/* PARALLEL_END_INTERUPT_REGION */
}
PARALLEL_CHECK_INTERUPT_REGION
/* PARALLEL_CHECK_INTERUPT_REGION */

normaliseOutput(outputWS, inputWS);

// Set the output spectrum-detector mapping
SpectrumDetectorMapping outputDetectorMap(specNumberMapping, detIDMapping);
outputWS->updateSpectraUsing(outputDetectorMap);
}


Expand Down
30 changes: 25 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/SofQW3.cpp
Expand Up @@ -4,6 +4,7 @@
#include "MantidAlgorithms/SofQW3.h"
#include "MantidAlgorithms/SofQW.h"
#include "MantidAPI/BinEdgeAxis.h"
#include "MantidAPI/SpectrumDetectorMapping.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidGeometry/Instrument/DetectorGroup.h"
#include "MantidGeometry/Instrument/ReferenceFrame.h"
Expand Down Expand Up @@ -96,6 +97,10 @@ namespace Algorithms
const size_t nEnergyBins = inputWS->blocksize();
const size_t nHistos = inputWS->getNumberHistograms();

// Holds the spectrum-detector mapping
std::vector<specid_t> specNumberMapping;
std::vector<detid_t> detIDMapping;

// Progress reports & cancellation
const size_t nreports(nHistos * nEnergyBins);
m_progress = boost::shared_ptr<API::Progress>(new API::Progress(this, 0.0,
Expand All @@ -121,10 +126,10 @@ namespace Algorithms
const MantidVec & X = inputWS->readX(0);

int emode = m_EmodeProperties.m_emode;
PARALLEL_FOR2(inputWS, outputWS)
/* PARALLEL_FOR2(inputWS, outputWS) */
for (int64_t i = 0; i < static_cast<int64_t>(nHistos); ++i) // signed for openmp
{
PARALLEL_START_INTERUPT_REGION
/* PARALLEL_START_INTERUPT_REGION */

DetConstPtr detector = inputWS->getDetector(i);
if (detector->isMasked() || detector->isMonitor())
Expand Down Expand Up @@ -158,8 +163,10 @@ namespace Algorithms
const double dE_j = X[j];
const double dE_jp1 = X[j+1];

const double lrQ = this->calculateQ(efixed,emode, dE_jp1, thetaLower, phiLower);

const V2D ll(dE_j, this->calculateQ(efixed, emode,dE_j, thetaLower, phiLower));
const V2D lr(dE_jp1, this->calculateQ(efixed,emode, dE_jp1, thetaLower, phiLower));
const V2D lr(dE_jp1, lrQ);
const V2D ur(dE_jp1, this->calculateQ(efixed,emode, dE_jp1, thetaUpper, phiUpper));
const V2D ul(dE_j, this->calculateQ(efixed,emode, dE_j, thetaUpper, phiUpper));
if(g_log.is(Logger::Priority::PRIO_DEBUG))
Expand All @@ -172,18 +179,31 @@ namespace Algorithms
Quadrilateral inputQ = Quadrilateral(ll, lr, ur, ul);

this->rebinToFractionalOutput(inputQ, inputWS, i, j, outputWS, m_Qout);

// Find which q bin this point lies in
const MantidVec::difference_type qIndex = std::upper_bound(m_Qout.begin(), m_Qout.end(), lrQ) - m_Qout.begin();
if(qIndex != 0 && qIndex < static_cast<int>(m_Qout.size()))
{
// Add this spectra-detector pair to the mapping
specNumberMapping.push_back(outputWS->getSpectrum(qIndex - 1)->getSpectrumNo());
detIDMapping.push_back(detector->getID());
}
}
if(g_log.is(Logger::Priority::PRIO_DEBUG))
{
g_log.debug(logStream.str());
}

PARALLEL_END_INTERUPT_REGION
/* PARALLEL_END_INTERUPT_REGION */
}
PARALLEL_CHECK_INTERUPT_REGION
/* PARALLEL_CHECK_INTERUPT_REGION */

outputWS->finalize();
this->normaliseOutput(outputWS, inputWS);

// Set the output spectrum-detector mapping
SpectrumDetectorMapping outputDetectorMap(specNumberMapping, detIDMapping);
outputWS->updateSpectraUsing(outputDetectorMap);
}


Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/Framework/DataHandling/src/LoadParameterFile.cpp
Expand Up @@ -141,6 +141,10 @@ void LoadParameterFile::exec()

// populate parameter map of workspace
localWorkspace->populateInstrumentParameters();
if (!filename.empty())
{
localWorkspace->instrumentParameters().addParameterFilename(filename);
}

prog.resetNumSteps(1, 0.0, 1.0);
prog.report("Done");
Expand Down

0 comments on commit 35ad27a

Please sign in to comment.