|
Mantid
|
Provides a helper class to add fake data to an MD workspace. More...
#include <FakeMD.h>
Public Member Functions | |
| FakeMD (const std::vector< double > &uniformParams, const std::vector< double > &peakParams, const std::vector< double > &ellipsoidParams, const int randomSeed, const bool randomizeSignal) | |
| Constructor. More... | |
| void | fill (const API::IMDEventWorkspace_sptr &workspace) |
| Add the fake data to the given workspace. More... | |
Private Member Functions | |
| template<typename MDE , size_t nd> | |
| void | addFakeEllipsoid (typename MDEventWorkspace< MDE, nd >::sptr ws) |
| Function that adds a fake single-crystal peak with a multivariate normal distribution (an ellipsoid) around a central point (x1,...x_N). More... | |
| template<typename MDE , size_t nd> | |
| void | addFakePeak (typename MDEventWorkspace< MDE, nd >::sptr ws) |
| Function generates random uniformly distributed events within an nD-sphere to simulate a single-crystal peak and adds it to the workspace. More... | |
| template<typename MDE , size_t nd> | |
| void | addFakeRandomData (const std::vector< double > ¶ms, typename MDEventWorkspace< MDE, nd >::sptr ws) |
| Add fake randomized data to the workspace. More... | |
| template<typename MDE , size_t nd> | |
| void | addFakeRegularData (const std::vector< double > ¶ms, typename MDEventWorkspace< MDE, nd >::sptr ws) |
| template<typename MDE , size_t nd> | |
| void | addFakeUniformData (typename MDEventWorkspace< MDE, nd >::sptr ws) |
| Function makes up a fake uniform event data and adds it to the workspace. More... | |
| detid_t | pickDetectorID () |
| Pick a detector ID for a particular event. More... | |
| void | setupDetectorCache (const API::IMDEventWorkspace &workspace) |
| Setup a detector cache for randomly picking IDs from the first instrument in the ExperimentInfo list. More... | |
Private Attributes | |
| std::vector< detid_t > | m_detIDs |
| std::vector< double > | m_ellipsoidParams |
| std::vector< double > | m_peakParams |
| std::mt19937 | m_randGen |
| const bool | m_randomizeSignal |
| const int | m_randomSeed |
| Kernel::uniform_int_distribution< size_t > | m_uniformDist |
| std::vector< double > | m_uniformParams |
Provides a helper class to add fake data to an MD workspace.
| Mantid::DataObjects::FakeMD::FakeMD | ( | const std::vector< double > & | uniformParams, |
| const std::vector< double > & | peakParams, | ||
| const std::vector< double > & | ellipsoidParams, | ||
| const int | randomSeed, | ||
| const bool | randomizeSignal | ||
| ) |
Constructor.
| uniformParams | Add a uniform, randomized distribution of events |
| peakParams | Add a peak with a normal distribution around a central point |
| ellipsoidParams | Add a multivariate gaussian peak (ellipsoid) |
| randomSeed | Seed int for the random number generator |
| randomizeSignal | If true, the events' signal and error values will be " randomized around 1.0+-0.5 |
Definition at line 38 of file FakeMD.cpp.
|
private |
Function that adds a fake single-crystal peak with a multivariate normal distribution (an ellipsoid) around a central point (x1,...x_N).
The ellipsoid is defined by N eigenvectors with N elements and N eigenvalues which correpsond to the variance along the principal axes. The peak is generated from an affine transformation of a uniform normal distirbution of variance = 1.
| ws | A pointer to the workspace that receives the events |
Definition at line 161 of file FakeMD.cpp.
References Mantid::Geometry::d, Mantid::Kernel::Matrix< T >::getVector(), Mantid::Kernel::Matrix< T >::Invert(), m_ellipsoidParams, m_randomSeed, n, Mantid::DataHandling::numEvents(), pickDetectorID(), Mantid::DataObjects::MDEventWorkspace::refreshCache(), Mantid::DataObjects::MDEventWorkspace::splitAllIfNeeded(), Mantid::DataObjects::MDEventWorkspace::splitBox(), tmp, and tp.
Referenced by fill().
|
private |
Function generates random uniformly distributed events within an nD-sphere to simulate a single-crystal peak and adds it to the workspace.
| ws | A pointer to the workspace that receives the events |
Definition at line 85 of file FakeMD.cpp.
References Mantid::Geometry::d, m_peakParams, m_randomizeSignal, m_randomSeed, pickDetectorID(), radius, Mantid::DataObjects::MDEventWorkspace::refreshCache(), Mantid::DataObjects::MDEventWorkspace::splitAllIfNeeded(), Mantid::DataObjects::MDEventWorkspace::splitBox(), and tp.
Referenced by fill().
|
private |
Add fake randomized data to the workspace.
| params | A reference to the parameter vector |
| ws | The workspace to hold the data |
Definition at line 325 of file FakeMD.cpp.
References Mantid::Geometry::d, m_randomizeSignal, m_randomSeed, and pickDetectorID().
|
private |
Definition at line 368 of file FakeMD.cpp.
References Mantid::Geometry::d, Mantid::Kernel::delta, Mantid::API::MDGeometry::getDimension(), Mantid::Kernel::Utils::getIndicesFromLinearIndex(), and pickDetectorID().
|
private |
Function makes up a fake uniform event data and adds it to the workspace.
| ws |
Definition at line 264 of file FakeMD.cpp.
References Mantid::Geometry::d, Mantid::API::MDGeometry::getDimension(), Mantid::API::Workspace::getName(), m_uniformParams, Mantid::DataObjects::MDEventWorkspace::refreshCache(), Mantid::DataObjects::MDEventWorkspace::splitAllIfNeeded(), Mantid::DataObjects::MDEventWorkspace::splitBox(), and tp.
Referenced by fill().
| void Mantid::DataObjects::FakeMD::fill | ( | const API::IMDEventWorkspace_sptr & | workspace | ) |
Add the fake data to the given workspace.
| workspace | A pointer to MD event workspace to fill using the object parameters |
Definition at line 53 of file FakeMD.cpp.
References addFakeEllipsoid(), addFakePeak(), addFakeUniformData(), CALL_MDEVENT_FUNCTION, setupDetectorCache(), and workspace.
Referenced by Mantid::MDAlgorithms::FakeMDEventData::exec(), and Mantid::DataObjects::MDEventsTestHelper::makeFakeMDEventWorkspace().
|
private |
Pick a detector ID for a particular event.
Definition at line 439 of file FakeMD.cpp.
References m_detIDs, m_randGen, and m_uniformDist.
Referenced by addFakeEllipsoid(), addFakePeak(), addFakeRandomData(), and addFakeRegularData().
|
private |
Setup a detector cache for randomly picking IDs from the first instrument in the ExperimentInfo list.
| workspace | The input workspace |
Definition at line 69 of file FakeMD.cpp.
References m_detIDs, m_uniformDist, and workspace.
Referenced by fill().
|
mutableprivate |
Definition at line 49 of file FakeMD.h.
Referenced by pickDetectorID(), and setupDetectorCache().
|
private |
Definition at line 46 of file FakeMD.h.
Referenced by addFakeEllipsoid().
|
private |
Definition at line 45 of file FakeMD.h.
Referenced by addFakePeak().
|
private |
Definition at line 50 of file FakeMD.h.
Referenced by pickDetectorID().
|
private |
Definition at line 48 of file FakeMD.h.
Referenced by addFakePeak(), and addFakeRandomData().
|
private |
Definition at line 47 of file FakeMD.h.
Referenced by addFakeEllipsoid(), addFakePeak(), and addFakeRandomData().
|
private |
Definition at line 51 of file FakeMD.h.
Referenced by pickDetectorID(), and setupDetectorCache().
|
private |
Definition at line 44 of file FakeMD.h.
Referenced by addFakeUniformData().