Commit ee4285ed authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Remove quantification-related code

It is unused as users how gone in a different direction
with the project.
Refs #26223
parent 25a5c31a
......@@ -18,7 +18,6 @@ set(SRC_FILES
src/BoxController.cpp
src/CatalogManager.cpp
src/CatalogSession.cpp
src/ChopperModel.cpp
src/Column.cpp
src/ColumnFactory.cpp
src/CommonBinsValidator.cpp
......@@ -37,7 +36,6 @@ set(SRC_FILES
src/EqualBinSizesValidator.cpp
src/ExperimentInfo.cpp
src/Expression.cpp
src/FermiChopperModel.cpp
src/FileBackedExperimentInfo.cpp
src/FileFinder.cpp
src/FileLoaderRegistry.cpp
......@@ -80,7 +78,6 @@ set(SRC_FILES
src/IPowderDiffPeakFunction.cpp
src/ISpectrum.cpp
src/ITableWorkspace.cpp
src/IkedaCarpenterModerator.cpp
src/ImmutableCompositeFunction.cpp
src/ImplicitFunctionFactory.cpp
src/ImplicitFunctionParameterParserFactory.cpp
......@@ -102,7 +99,6 @@ set(SRC_FILES
src/MDGeometry.cpp
src/MatrixWorkspace.cpp
src/MatrixWorkspaceMDIterator.cpp
src/ModeratorModel.cpp
src/MuParserUtils.cpp
src/MultiDomainFunction.cpp
src/MultiPeriodGroupAlgorithm.cpp
......@@ -186,7 +182,6 @@ set(INC_FILES
inc/MantidAPI/CatalogFactory.h
inc/MantidAPI/CatalogManager.h
inc/MantidAPI/CatalogSession.h
inc/MantidAPI/ChopperModel.h
inc/MantidAPI/Column.h
inc/MantidAPI/ColumnFactory.h
inc/MantidAPI/CommonBinsValidator.h
......@@ -208,7 +203,6 @@ set(INC_FILES
inc/MantidAPI/EqualBinSizesValidator.h
inc/MantidAPI/ExperimentInfo.h
inc/MantidAPI/Expression.h
inc/MantidAPI/FermiChopperModel.h
inc/MantidAPI/FileBackedExperimentInfo.h
inc/MantidAPI/FileFinder.h
inc/MantidAPI/FileLoaderRegistry.h
......@@ -276,7 +270,6 @@ set(INC_FILES
inc/MantidAPI/ITableWorkspace_fwd.h
inc/MantidAPI/ITransformScale.h
inc/MantidAPI/IWorkspaceProperty.h
inc/MantidAPI/IkedaCarpenterModerator.h
inc/MantidAPI/ImmutableCompositeFunction.h
inc/MantidAPI/ImplicitFunctionBuilder.h
inc/MantidAPI/ImplicitFunctionFactory.h
......@@ -305,7 +298,6 @@ set(INC_FILES
inc/MantidAPI/MatrixWorkspaceMDIterator.h
inc/MantidAPI/MatrixWorkspaceValidator.h
inc/MantidAPI/MatrixWorkspace_fwd.h
inc/MantidAPI/ModeratorModel.h
inc/MantidAPI/MuParserUtils.h
inc/MantidAPI/MultiDomainFunction.h
inc/MantidAPI/MultiPeriodGroupAlgorithm.h
......@@ -405,7 +397,6 @@ set(TEST_FILES
EqualBinSizesValidatorTest.h
ExperimentInfoTest.h
ExpressionTest.h
FermiChopperModelTest.h
FileBackedExperimentInfoTest.h
FileFinderTest.h
FilePropertyTest.h
......@@ -431,7 +422,6 @@ set(TEST_FILES
ILatticeFunctionTest.h
IMDWorkspaceTest.h
ISpectrumTest.h
IkedaCarpenterModeratorTest.h
ImmutableCompositeFunctionTest.h
ImplicitFunctionParserFactoryTest.h
IncreasingAxisValidatorTest.h
......@@ -447,7 +437,6 @@ set(TEST_FILES
MDFrameValidatorTest.h
MDGeometryTest.h
MatrixWorkspaceMDIteratorTest.h
ModeratorModelTest.h
MuParserUtilsTest.h
MultiDomainFunctionTest.h
MultiPeriodGroupAlgorithmTest.h
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_API_CHOPPERMODEL_H_
#define MANTID_API_CHOPPERMODEL_H_
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/Run.h"
#include <string>
namespace Mantid {
namespace API {
//--------------------------------------------------------------------------
// Forward declaration
//--------------------------------------------------------------------------
class Run;
/**
* Defines an interface to a chopper model which allows
* calculating the variance in the time of the pulse through
* the chopper
*/
class MANTID_API_DLL ChopperModel {
public:
/// Default constructor required by the factory
ChopperModel();
/// Allow inheritance
virtual ~ChopperModel() = default;
/// Returns a clone of the current object
virtual boost::shared_ptr<ChopperModel> clone() const = 0;
/// Set the reference to the run object as we need a default constructor
/// for the factory
void setRun(const Run &exptRun);
/// Initialize with a string of parameters
void initialize(const std::string &params);
/// Set the rotation speed in rads/sec
void setAngularVelocityInHz(const double value);
/// Set the angular velocity log name
void setAngularVelocityLog(const std::string &logName);
/// Returns the current angular velocity in rads/sec
double getAngularVelocity() const;
/// Sets the chopper jitter sigma value in microseconds. This is the FWHH
/// value
void setJitterFWHH(const double value);
/// Returns the std deviation of the jitter value in seconds
inline double getStdDevJitter() const { return m_jitterSigma; }
/// Returns the variance of a the time pulse through this chopper in seconds^2
double pulseTimeVariance() const;
/// Returns a time sampled from the chopper distribution
virtual double sampleTimeDistribution(const double randomNo) const = 0;
/// Returns a time sampled from the jitter distribution
virtual double sampleJitterDistribution(const double randomNo) const = 0;
protected:
/// Set a named parameter from a string value
virtual void setParameterValue(const std::string &name,
const std::string &value) = 0;
/// The variance of a the time pulse through this chopper in seconds^2
virtual double calculatePulseTimeVariance() const = 0;
/// Cache a value of the pulse variance
void cachePulseVariance(const double value);
/// Return current pulse variance cache
inline double getCachedPulseVariance() const { return m_pulseVariance; }
/// Returns a reference to the run object
inline const Run &exptRun() const { return *m_exptRun; }
private:
/// Handle any base parameters before passing to derived
void setBaseParameters(std::map<std::string, std::string> &keyValues);
/// A pointer to the run object
const Run *m_exptRun;
/// Current rotation speed
double m_angularSpeed;
/// Rotation speed log name
std::string m_angularSpeedLog;
/// Std deviation of chopper jitter in seconds
double m_jitterSigma;
/// Current value of the variance of the pulse
double m_pulseVariance;
};
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_CHOPPERMODEL_H_ */
......@@ -16,7 +16,6 @@
#include "MantidKernel/V3D.h"
#include "MantidKernel/cow_ptr.h"
#include <list>
#include <mutex>
namespace Mantid {
......@@ -38,8 +37,6 @@ class XMLInstrumentParameter;
} // namespace Geometry
namespace API {
class ChopperModel;
class ModeratorModel;
class Run;
class Sample;
class SpectrumInfo;
......@@ -83,24 +80,10 @@ public:
// Add parameters to the instrument parameter map
void populateInstrumentParameters();
/// Cache a lookup of grouped detIDs to member IDs
virtual void cacheDetectorGroupings(const det2group_map &mapping);
void setNumberOfDetectorGroups(const size_t count) const;
void setDetectorGrouping(const size_t index,
const std::set<detid_t> &detIDs) const;
/// Set an object describing the source properties and take ownership
void setModeratorModel(ModeratorModel *source);
/// Returns a reference to the source properties object
ModeratorModel &moderatorModel() const;
/// Set a chopper description specified by index where 0 is closest to the
/// source
void setChopperModel(ChopperModel *chopper, const size_t index = 0);
/// Returns a reference to a chopper description
ChopperModel &chopperModel(const size_t index = 0) const;
/// Sample accessors
const Sample &sample() const;
/// Writable version of the sample object
......@@ -184,8 +167,6 @@ public:
void invalidateSpectrumDefinition(const size_t index);
void updateSpectrumDefinitionIfNecessary(const size_t index) const;
virtual size_t groupOfDetectorID(const detid_t detID) const;
protected:
size_t numberOfDetectorGroups() const;
/// Called as the first operation of most public methods.
......@@ -195,10 +176,6 @@ protected:
Kernel::cow_ptr<std::vector<SpectrumDefinition>> spectrumDefinitions);
virtual void updateCachedDetectorGrouping(const size_t index) const;
/// Description of the source object
boost::shared_ptr<ModeratorModel> m_moderatorModel;
/// Description of the choppers for this experiment.
std::list<boost::shared_ptr<ChopperModel>> m_choppers;
/// Parameters modifying the base instrument
boost::shared_ptr<Geometry::ParameterMap> m_parmap;
/// The base (unparametrized) instrument
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_API_FERMICHOPPERMODEL_H_
#define MANTID_API_FERMICHOPPERMODEL_H_
#include "MantidAPI/ChopperModel.h"
namespace Mantid {
namespace API {
/**
* Defines a FermiChopper component modelled by a triangular distibution
*/
class MANTID_API_DLL FermiChopperModel : public ChopperModel {
public:
/// Default constructor required by the factory
FermiChopperModel();
/// Returns a clone of the current object
boost::shared_ptr<ChopperModel> clone() const override;
/// Set the radius of the chopper in metres
void setChopperRadius(const double value);
/// Returns the chopper radius in metres
inline double getChopperRadius() const { return m_chopperRadius; }
/// Set the slit thickness in metres
void setSlitThickness(const double value);
/// Returns the chopper radius in metres
inline double getSlitThickness() const { return m_slitThickness; }
/// Set the radius of curvature of the slit
void setSlitRadius(const double value);
/// Returns the chopper radius in metres
inline double getSlitRadius() const { return m_slitRadius; }
/// Set the incident energy in meV
void setIncidentEnergy(const double value);
/// Set the log used to access the Ei
void setIncidentEnergyLog(const std::string &logName);
/// Returns the current incident energy in meV
double getIncidentEnergy() const;
/// Returns a time sample from the distribution given a flat random number
double sampleTimeDistribution(const double randomNo) const override;
/// Returns a time sampled from the jitter distribution
double sampleJitterDistribution(const double randomNo) const override;
private:
/// Set a parameter value from a string
void setParameterValue(const std::string &name,
const std::string &value) override;
/// Returns the variance of a the time pulse through this chopper in seconds^2
double calculatePulseTimeVariance() const override;
/// Computes the value of the regime-dependent portion of the pulse variance
double regimeFactor(const double gamma) const;
/// Map a flat random number to a triangular distibution of unit area
double sampleFromTriangularDistribution(const double randomNo) const;
/// The radius of the chopper in metres
double m_chopperRadius;
/// The slit thickness
double m_slitThickness;
/// Slit's radius of curvature in metres
double m_slitRadius;
/// Current incident energy
double m_incidentEnergy;
/// Incident energy log
std::string m_incidentEnergyLog;
};
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_FERMICHOPPERMODEL_H_ */
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_API_IKEDACARPENTERMODERATOR_H_
#define MANTID_API_IKEDACARPENTERMODERATOR_H_
#include "MantidAPI/ModeratorModel.h"
#include <vector>
namespace Mantid {
namespace API {
/**
*
* Defines an object that models a moderator using an
* Ikeda-Carpenter function.
*
* The model is parameterized by 3 variables:
* - \f$\alpha\f$: Coefficient for fast decay;
* - \f$\beta\f$: Coefficient for slow decay;
* - \f$R\f$: Mixing coefficient
*
* where \f$\tau_mean=3/\alpha + R/\beta\f$
* and \f$\tau_sig=\sqrt{\frac{3}{\alpha^2} + R(2-R)*\frac{1}{\beta^2}}\f$
*/
class MANTID_API_DLL IkedaCarpenterModerator : public ModeratorModel {
public:
/// Default constructor required by the factory
IkedaCarpenterModerator();
/// Returns a clone of the current object
boost::shared_ptr<ModeratorModel> clone() const override;
/// Sets the value of the \f$\alpha\f$ parameter
void setFastDecayCoefficent(const double value);
/// Returns the value of the \f$\alpha\f$ parameter
double getFastDecayCoefficent() const;
/// Sets the value of the \f$\beta\f$ parameter
void setSlowDecayCoefficent(const double value);
/// Returns the value of the \f$\beta\f$ parameter
double getSlowDecayCoefficent() const;
/// Sets the value of the \f$R\f$ parameter.
void setMixingCoefficient(const double value);
/// Gets the value of the \f$R\f$ parameter.
double getMixingCoefficient() const;
/// Returns the mean time for emission in microseconds
double emissionTimeMean() const override;
/// Returns the variance of emission time in microseconds
double emissionTimeVariance() const override;
/// Returns a time, in seconds, sampled from the distibution given a flat
/// random number
double sampleTimeDistribution(const double flatRandomNo) const override;
private:
/// Custom initialize function, called after parameters have been set
void init() override;
/// Set a parameter value from a string
void setParameterValue(const std::string &name,
const std::string &value) override;
/// Initialize the area-to-time lookup table
void initLookupTable();
/// For area between [0,1] returns the interpolated value of x
double interpolateAreaTable(const double area) const;
/// Returns the value of T such that the integral of a normalised
/// Ikeda-Carpenter function, M(T), from 0 to T = area
double areaToTime(const double area) const;
/// Find the minimum of the areaToTimeFunction between the given interval with
/// the given tolerance
double findMinumum(const double rangeMin, const double rangeMax,
const double tolerance) const;
/// Find the minimum of the areaToTimeFunction
double zeroBrent(const double a, const double b, const double t) const;
/// Function to pass to root-finder to find the value of the area for the
/// given fraction of the range
double areaToTimeFunction(const double fraction) const;
/// Returns the area of the IKeda-Carpenter function for the given time value
double area(const double x) const;
/// The value of the 1/fast decay coefficient
double m_tau_f;
/// The value of the 1/slow decay coefficient
double m_tau_s;
/// The value of the mixing coefficient
double m_r;
/// Size of lookup table
const unsigned int m_lookupSize;
/// Lookup table
std::vector<double> m_areaToTimeLookup;
/// Value of offset for area calculation
mutable double m_offset;
};
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_IKEDACARPENTERMODERATOR_H_ */
......@@ -546,9 +546,6 @@ public:
void invalidateCachedSpectrumNumbers();
void cacheDetectorGroupings(const det2group_map &mapping) override;
size_t groupOfDetectorID(const detid_t detID) const override;
protected:
/// Protected copy constructor. May be used by childs for cloning.
MatrixWorkspace(const MatrixWorkspace &other);
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTID_API_MODERATORMODEL_H_
#define MANTID_API_MODERATORMODEL_H_
#include "MantidAPI/DllConfig.h"
#ifndef Q_MOC_RUN
#include <boost/shared_ptr.hpp>
#endif
#include <string>
namespace Mantid {
namespace API {
/**
*
* Defines a base class for a moderator model
*/
class MANTID_API_DLL ModeratorModel {
public:
/// Default constructor required by the factory
ModeratorModel();
/// Allow inheritance
virtual ~ModeratorModel() = default;
/// Returns a clone of the current object
virtual boost::shared_ptr<ModeratorModel> clone() const = 0;
/// Initialize the object from a string of parameters
void initialize(const std::string &params);
/// Custom init function called after parameters have been processed. Default
/// action is to do nothing
virtual void init() {}
/// Sets the tilt angle in degrees (converted to radians internally)
void setTiltAngleInDegrees(const double theta);
/// Returns the value of the tilt angle in radians
double getTiltAngleInRadians() const;
/// Returns the mean time for emission in microseconds
virtual double emissionTimeMean() const = 0;
/// Returns the variance of emission time in microseconds
virtual double emissionTimeVariance() const = 0;
/// Returns a time, in seconds, sampled from the distibution given a flat
/// random number
virtual double sampleTimeDistribution(const double flatRandomNo) const = 0;
protected:
/// Set a named parameter from a string value
virtual void setParameterValue(const std::string &name,
const std::string &value) = 0;
private:
/// Moderator tilt angle in radians
double m_tiltAngle;
};
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_MODERATORMODEL_H_ */
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
//
// Includes
//
#include "MantidAPI/ChopperModel.h"
#include "MantidKernel/Exception.h"
#include "MantidKernel/Strings.h"
#include <boost/lexical_cast.hpp>
namespace Mantid {
namespace API {
namespace {
// Parameter names
const char *ANGULAR_VEL = "AngularVelocity";
const char *JITTER = "JitterSigma";
} // namespace
/// Default constructor required by the factory
ChopperModel::ChopperModel()
: m_exptRun(nullptr), m_angularSpeed(0.0), m_angularSpeedLog(),
m_jitterSigma(0.0), m_pulseVariance(0.0) {}
/**
* Set the reference to the run object so that log
* values can be used as values for the parameters
* @param exptRun :: A reference to the run object to access logs
*/
void ChopperModel::setRun(const Run &exptRun) { m_exptRun = &exptRun; }
/**
* Initialize the object with a string of parameters
* @param params :: A key=value list of parameters
*/
void ChopperModel::initialize(const std::string &params) {
if (params.empty())
throw std::invalid_argument(
"ChopperModel::initialize - Empty parameter string.");
static const char *keyValSep = "=";
static const char *listSep = ",";
auto keyValues =
Kernel::Strings::splitToKeyValues(params, keyValSep, listSep);
if (keyValues.empty()) {
throw std::invalid_argument(
"ChopperModel::initialize - Parameter string was not empty but no "
"values"
" could be parsed. Check it is a comma-separated key=value string");
}
setBaseParameters(keyValues);
for (auto &keyValue : keyValues) {
setParameterValue(keyValue.first, keyValue.second);
}
}
/**
* Returns the variance of the pulse through the chopper in seconds^2
* for the current parameters
* @return The variance of the pulse through the chopper in seconds^
*/
double ChopperModel::pulseTimeVariance() const {
/// TODO: Check for caches & return cached value
return calculatePulseTimeVariance();
}
/**
* Set the rotation speed in Hz. It will be converted to rads/sec
* @param value :: The rotation velocity in Hz
*/
void ChopperModel::setAngularVelocityInHz(const double value) {
m_angularSpeedLog = "";
m_angularSpeed = value * 2.0 * M_PI;
}
/**
* Set the name of the log to use to retrieve the velocity
* @param logName :: The name of a log
*/
void ChopperModel::setAngularVelocityLog(const std::string &logName) {
m_angularSpeed = 0.0;
m_angularSpeedLog = logName;
}
/**
* Returns the current angular velocity in rads/sec.
* If the log has been set it is used, else the double value is
* taken
* @returns The value of the angular velocity
*/
double ChopperModel::getAngularVelocity() const {
if (m_angularSpeedLog.empty())
return m_angularSpeed;
else {
return 2. * M_PI * exptRun().getLogAsSingleValue(m_angularSpeedLog);
}
}
/**
* Sets the chopper jitter sigma value in microseconds. This is the FWHH value.
* @param value :: The FWHH value in microseconds for the chopper jitter
*/
void ChopperModel::setJitterFWHH(const double value) {
m_jitterSigma = value / 1e6 / std::sqrt(std::log(256.0));
}
//-------------------------------------------------------------------------
// Private methods
//-------------------------------------------------------------------------
/**
* Handle any base parameters before passing to derived
* @param keyValues :: A reference to the set of key-value pairs. Any dealt with
* here
* are also removed
*/
void ChopperModel::setBaseParameters(
std::map<std::string, std::string> &keyValues) {
auto iter = keyValues.find(ANGULAR_VEL);
if (iter != keyValues.end()) {
try {
setAngularVelocityInHz(boost::lexical_cast<double>(iter->second));