Skip to content

Commit

Permalink
refs #10904. Resolve conflict with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Feb 9, 2015
2 parents 8996ec6 + 85a4f43 commit f910af2
Show file tree
Hide file tree
Showing 234 changed files with 13,969 additions and 9,417 deletions.
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
@@ -1,14 +1,13 @@
The [developer documentation](http://www.mantidproject.org/Category:Development) has information on how to participate in the mantid project as a developer. This document is meant to outline the steps for contributing to mantid without becomming a developer.
The [developer documentation](http://www.mantidproject.org/Category:Development) has information on how to participate in the mantid project as a developer. This document is meant to outline the steps for contributing to mantid without becomming a developer. We aspire to have similar guidelines as [github](https://github.com/blog/1943-how-to-write-the-perfect-pull-request).

1. [Fork](https://help.github.com/articles/fork-a-repo) the repository.
2. Make changes as you see fit. Please still follow the guidelines for [running the unit tests](http://www.mantidproject.org/Running_the_unit_tests) and the [build servers](http://www.mantidproject.org/The_automated_build_process).
3. Before submitting pull requests email mantid-help@mantidproject.org, and a developer will set up a branch that you can submit pull requests to.
4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch.
4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. This is a start to the conversation.
3. (Optional) email mantid-help@mantidproject.org requests to.


Hints to make the integration of your changes easy:
Hints to make the integration of your changes easy (and happen faster):
- Keep your pull requests small
- Some comments are part of the build server infrastructure (e.g. 'test this please')
- Don't forget your unit tests
- All algorithms need documentation, don't forget the .rst file
- Contact us before creating the pull request
- Don't take changes requests to change your code personally
3 changes: 1 addition & 2 deletions Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp
Expand Up @@ -10,7 +10,6 @@
#include <cmath>

const double IGNOREDCHANGE = 1.0E-9;
const double PI = 3.14159265358979323846264338327950288419716939937510582;

namespace Mantid {
namespace API {
Expand Down Expand Up @@ -271,7 +270,7 @@ std::complex<double> E1(std::complex<double> z) {
exp_e1 = exp_e1 * exp(-z);
if (rz < 0.0 && fabs(imag(z)) < 1.0E-10) {
std::complex<double> u(0.0, 1.0);
exp_e1 = exp_e1 - (PI * u);
exp_e1 = exp_e1 - (M_PI * u);
}
}

Expand Down
20 changes: 6 additions & 14 deletions Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
Expand Up @@ -3,6 +3,7 @@
//----------------------------------------------------------------------
#include "MantidAlgorithms/ConvertSpectrumAxis2.h"
#include "MantidAPI/NumericAxis.h"
#include "MantidKernel/UnitConversion.h"
#include "MantidKernel/UnitFactory.h"
#include "MantidAPI/WorkspaceValidators.h"
#include "MantidAPI/Run.h"
Expand Down Expand Up @@ -133,28 +134,19 @@ void ConvertSpectrumAxis2::createElasticQMap(const std::string &targetUnit) {
else if (emodeStr == "Indirect")
emode = 2;

// Get conversion factor from energy(meV) to wavelength(angstroms)
Kernel::Units::Energy energyUnit;
double wavelengthFactor(0.0), wavelengthPower(0.0);
energyUnit.quickConversion("Wavelength", wavelengthFactor, wavelengthPower);

for (size_t i = 0; i < m_nHist; i++) {
IDetector_const_sptr detector = m_inputWS->getDetector(i);
double theta(0.0), efixed(0.0);
double twoTheta(0.0), efixed(0.0);
if (!detector->isMonitor()) {
theta = m_inputWS->detectorTwoTheta(detector) / 2.0;
twoTheta = m_inputWS->detectorTwoTheta(detector) / 2.0;
efixed = getEfixed(detector, m_inputWS, emode); // get efixed
} else {
theta = 0.0;
twoTheta = 0.0;
efixed = DBL_MIN;
}

const double stheta = std::sin(theta);

// Calculate the wavelength to allow it to be used to convert to elasticQ.
double wavelength = wavelengthFactor * std::pow(efixed, wavelengthPower);
// The MomentumTransfer value.
double elasticQInAngstroms = 4.0 * M_PI * stheta / wavelength;
// Convert to MomentumTransfer
double elasticQInAngstroms = Kernel::UnitConversion::run(twoTheta, efixed);

if (targetUnit == "ElasticQ") {
m_indexMap.insert(std::make_pair(elasticQInAngstroms, i));
Expand Down
9 changes: 5 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/MonteCarloAbsorption.cpp
Expand Up @@ -452,10 +452,11 @@ void MonteCarloAbsorption::initCaches() {

m_numVolumeElements = m_blocks.size();
g_log.debug() << "Sample + container divided into " << m_numVolumeElements
<< " blocks.";
if (m_numVolumeElements == numPossibleVolElements)
g_log.debug("\n");
else
<< " blocks.\n";
if (m_numVolumeElements == 0) {
throw std::runtime_error("No intersection with sample + container.");
}
if (m_numVolumeElements != numPossibleVolElements)
g_log.debug()
<< " Skipped " << (numPossibleVolElements - m_numVolumeElements)
<< " blocks that do not intersect with the sample + container\n";
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/RayTracerTester.cpp
Expand Up @@ -6,6 +6,8 @@
#include "MantidKernel/System.h"
#include "MantidKernel/V3D.h"

#include <cmath>

using namespace Mantid::Kernel;
using namespace Mantid::API;
using namespace Mantid::DataObjects;
Expand Down Expand Up @@ -66,9 +68,9 @@ void RayTracerTester::exec() {
Progress prog(this, 0.3, 1.0, NumAzimuth);
for (int iaz = 0; iaz < NumAzimuth; iaz++) {
prog.report();
double az = double(iaz) * 3.14159 * 2.0 / double(NumAzimuth);
double az = double(iaz) * M_PI * 2.0 / double(NumAzimuth);
for (int iz = 0; iz < NumZenith; iz++) {
double zen = double(iz) * 3.14159 * 1.0 / double(NumZenith);
double zen = double(iz) * M_PI / double(NumZenith);
double x = cos(az);
double z = sin(az);
double y = cos(zen);
Expand Down
Expand Up @@ -19,6 +19,7 @@
#include "MantidGeometry/Instrument/Component.h"
#include "MantidDataHandling/LoadEmptyInstrument.h"
#include "MantidGeometry/Instrument/ComponentHelper.h"
#include <cmath>
#include <stdexcept>


Expand Down Expand Up @@ -227,7 +228,7 @@ class CopyInstrumentParametersTestPerformance : public CxxTest::TestSuite
for(size_t i=0;i<n_detectors;i++)
{
IComponent_const_sptr det =instrument->getDetector(static_cast<Mantid::detid_t>(i+1));
Geometry::ComponentHelper::moveComponent(*det, *pmap, V3D(sin(3.1415926*double(i)),cos(3.1415926*double(i/500)),7), Absolute );
Geometry::ComponentHelper::moveComponent(*det, *pmap, V3D(sin(M_PI*double(i)),cos(M_PI*double(i/500)),7), Absolute );
}

// Create output workspace with another parameterized instrument and put into data store
Expand Down Expand Up @@ -285,8 +286,8 @@ class CopyInstrumentParametersTestPerformance : public CxxTest::TestSuite
int id = deto1->getID();
V3D newPos1 = deto1->getPos();
TS_ASSERT_EQUALS( id, i+1);
TS_ASSERT_DELTA( newPos1.X() ,sin(3.1415926*double(i)), 0.0001);
TS_ASSERT_DELTA( newPos1.Y() ,cos(3.1415926*double(i/500)), 0.0001);
TS_ASSERT_DELTA( newPos1.X() ,sin(M_PI*double(i)), 0.0001);
TS_ASSERT_DELTA( newPos1.Y() ,cos(M_PI*double(i/500)), 0.0001);
TS_ASSERT_DELTA( newPos1.Z() , 7, 1.e-6);

}
Expand Down
11 changes: 6 additions & 5 deletions Code/Mantid/Framework/Algorithms/test/CorrectFlightPathsTest.h
Expand Up @@ -11,6 +11,7 @@
#include "MantidKernel/ArrayProperty.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/IAlgorithm.h"
#include <cmath>

using namespace Mantid::API;
using namespace Mantid;
Expand Down Expand Up @@ -46,13 +47,13 @@ class CorrectFlightPathsTest: public CxxTest::TestSuite {
std::string outputWSName("test_output_ws");

std::vector<double> L2(5, 5);
std::vector<double> polar(5, (30. / 180.) * 3.1415926);
std::vector<double> polar(5, (30. / 180.) * M_PI);
polar[0] = 0;
std::vector<double> azimutal(5, 0);
azimutal[1] = (45. / 180.) * 3.1415936;
azimutal[2] = (90. / 180.) * 3.1415936;
azimutal[3] = (135. / 180.) * 3.1415936;
azimutal[4] = (180. / 180.) * 3.1415936;
azimutal[1] = (45. / 180.) * M_PI;
azimutal[2] = (90. / 180.) * M_PI;
azimutal[3] = (135. / 180.) * M_PI;
azimutal[4] = (180. / 180.) * M_PI;

int numBins = 10;
Mantid::API::MatrixWorkspace_sptr dataws = WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar,
Expand Down
12 changes: 5 additions & 7 deletions Code/Mantid/Framework/Algorithms/test/ExportTimeSeriesLogTest.h
Expand Up @@ -4,8 +4,11 @@
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <cmath>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

#include "MantidAlgorithms/ExportTimeSeriesLog.h"
#include "MantidDataObjects/EventWorkspace.h"
Expand All @@ -21,10 +24,6 @@
#include "MantidDataHandling/LoadInstrument.h"
#include "MantidKernel/TimeSeriesProperty.h"
#include "MantidKernel/UnitFactory.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

using namespace Mantid;
using namespace Mantid::Algorithms;
Expand Down Expand Up @@ -164,7 +163,6 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite
DataObjects::EventWorkspace_sptr createEventWorkspace()
{
using namespace WorkspaceCreationHelper;
double PI = 3.14159265;

// 1. Empty workspace
DataObjects::EventWorkspace_sptr eventws =
Expand Down Expand Up @@ -199,7 +197,7 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(PI*static_cast<double>(curtime_ns)/period*0.25);
double value = sin(M_PI*static_cast<double>(curtime_ns)/period*0.25);
sinlog->addValue(curtime, value);
curtime_ns += pulsetime_ns/4;
++ numevents;
Expand All @@ -214,7 +212,7 @@ class ExportTimeSeriesLogTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(2*PI*static_cast<double>(curtime_ns)/period);
double value = sin(2*M_PI*static_cast<double>(curtime_ns)/period);
coslog->addValue(curtime, value);
curtime_ns += pulsetime_ns*2;
}
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/test/FFTTest.h
@@ -1,6 +1,7 @@
#ifndef FFT_TEST_H_
#define FFT_TEST_H_

#include <cmath>
#include <cxxtest/TestSuite.h>

#include "MantidAlgorithms/FFT.h"
Expand All @@ -20,7 +21,7 @@ class FFTTest : public CxxTest::TestSuite
static FFTTest *createSuite() { return new FFTTest(); }
static void destroySuite( FFTTest *suite ) { delete suite; }

FFTTest():dX(0.2),PI(3.1415926535897932384626433832795),h(sqrt(PI/3)),a(PI*PI/3)
FFTTest():dX(0.2),h(sqrt(M_PI/3)),a(M_PI*M_PI/3)
{
}
~FFTTest()
Expand Down Expand Up @@ -446,7 +447,6 @@ class FFTTest : public CxxTest::TestSuite
}

const double dX;
const double PI;
const double h;
const double a;
};
Expand Down
12 changes: 5 additions & 7 deletions Code/Mantid/Framework/Algorithms/test/GenerateEventsFilterTest.h
Expand Up @@ -4,8 +4,11 @@
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <cmath>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

#include "MantidAlgorithms/GenerateEventsFilter.h"
#include "MantidDataObjects/EventWorkspace.h"
Expand All @@ -22,10 +25,6 @@
#include "MantidDataHandling/LoadInstrument.h"
#include "MantidKernel/TimeSeriesProperty.h"
#include "MantidKernel/UnitFactory.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

using namespace Mantid;
using namespace Mantid::Algorithms;
Expand Down Expand Up @@ -413,7 +412,6 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite
DataObjects::EventWorkspace_sptr createEventWorkspace()
{
using namespace WorkspaceCreationHelper;
double PI = 3.14159265;

// Empty workspace
DataObjects::EventWorkspace_sptr eventws =
Expand Down Expand Up @@ -447,7 +445,7 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(PI*static_cast<double>(curtime_ns)/period*0.25);
double value = sin(M_PI*static_cast<double>(curtime_ns)/period*0.25);
sinlog->addValue(curtime, value);
curtime_ns += pulsetime_ns/4;
}
Expand All @@ -460,7 +458,7 @@ class GenerateEventsFilterTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(2*PI*static_cast<double>(curtime_ns)/period);
double value = sin(2*M_PI*static_cast<double>(curtime_ns)/period);
coslog->addValue(curtime, value);
curtime_ns += pulsetime_ns*2;
}
Expand Down
Expand Up @@ -4,8 +4,11 @@
#include <cxxtest/TestSuite.h>
#include "MantidKernel/Timer.h"
#include "MantidKernel/System.h"
#include <cmath>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

#include "MantidAlgorithms/GetTimeSeriesLogInformation.h"
#include "MantidDataObjects/EventWorkspace.h"
Expand All @@ -21,10 +24,6 @@
#include "MantidDataHandling/LoadInstrument.h"
#include "MantidKernel/TimeSeriesProperty.h"
#include "MantidKernel/UnitFactory.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <Poco/File.h>

using namespace Mantid;
using namespace Mantid::Algorithms;
Expand Down Expand Up @@ -72,7 +71,6 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite
DataObjects::EventWorkspace_sptr createEventWorkspace()
{
using namespace WorkspaceCreationHelper;
double PI = 3.14159265;

// 1. Empty workspace
DataObjects::EventWorkspace_sptr eventws =
Expand Down Expand Up @@ -108,7 +106,7 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(PI*static_cast<double>(curtime_ns)/period*0.25);
double value = sin(M_PI*static_cast<double>(curtime_ns)/period*0.25);
sinlog->addValue(curtime, value);
curtime_ns += pulsetime_ns/4;
}
Expand All @@ -121,7 +119,7 @@ class GetTimeSeriesLogInformationTest : public CxxTest::TestSuite
while (curtime_ns < runstoptime_ns)
{
Kernel::DateAndTime curtime(curtime_ns);
double value = sin(2*PI*static_cast<double>(curtime_ns)/period);
double value = sin(2*M_PI*static_cast<double>(curtime_ns)/period);
coslog->addValue(curtime, value);
curtime_ns += pulsetime_ns*2;
}
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/Algorithms/test/RRFMuonTest.h
Expand Up @@ -5,6 +5,7 @@
#include "MantidAlgorithms/RRFMuon.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/Workspace.h"
#include <cmath>
#include <Poco/File.h>
#include <stdexcept>

Expand Down Expand Up @@ -104,16 +105,15 @@ class RRFMuonTest : public CxxTest::TestSuite
MatrixWorkspace_sptr createDummyWorkspace()
{
int nBins = 300;
double pi = 3.14159;
MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 2, nBins+1, nBins);

for (int i=0; i<nBins; i++)
{
double x = i/static_cast<int>(nBins);
ws->dataX(0)[i] = x;
ws->dataY(0)[i] = cos(2*pi*x);
ws->dataY(0)[i] = cos(2*M_PI*x);
ws->dataX(1)[i] = x;
ws->dataY(1)[i] = sin(2*pi*x);
ws->dataY(1)[i] = sin(2*M_PI*x);
}

ws->dataX(0)[nBins] = nBins;
Expand All @@ -124,4 +124,4 @@ class RRFMuonTest : public CxxTest::TestSuite

};

#endif /* MANTID_ALGORITHMS_RRFMUON_H_ */
#endif /* MANTID_ALGORITHMS_RRFMUON_H_ */

0 comments on commit f910af2

Please sign in to comment.