Mantid
Loading...
Searching...
No Matches
SampleLogsBehaviour.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10#include "MantidAlgorithms/DllConfig.h"
11#include "MantidKernel/Logger.h"
13
14namespace Mantid {
15namespace Algorithms {
16
24class MANTID_ALGORITHMS_DLL SampleLogsBehaviour {
25public:
26 enum class MergeLogType { Sum, TimeSeries, List, Warn, Fail };
27
28 // names of parameters in IPF containing names of sample log entries as values
30 std::string SUM_MERGE;
31 std::string TIME_SERIES_MERGE;
32 std::string LIST_MERGE;
33 std::string WARN_MERGE;
35 std::string FAIL_MERGE;
37 } parameterNames;
38
39 // the names and docs of the override properties
40 static const std::string TIME_SERIES_PROP;
41 static const std::string TIME_SERIES_DOC;
42 static const std::string LIST_PROP;
43 static const std::string LIST_DOC;
44 static const std::string WARN_PROP;
45 static const std::string WARN_DOC;
46 static const std::string WARN_TOL_PROP;
47 static const std::string WARN_TOL_DOC;
48 static const std::string FAIL_PROP;
49 static const std::string FAIL_DOC;
50 static const std::string FAIL_TOL_PROP;
51 static const std::string FAIL_TOL_DOC;
52 static const std::string SUM_PROP;
53 static const std::string SUM_DOC;
54
56 std::shared_ptr<Kernel::Property> property;
57 double tolerance;
59 };
60
61 // override sample log entries for specific merge type
63 std::string sampleLogsSum;
65 std::string sampleLogsList;
66 std::string sampleLogsWarn;
68 std::string sampleLogsFail;
70 };
71
73 const SampleLogNames &logEntries = {}, ParameterName parName = {});
74
76 void mergeSampleLogs(const API::MatrixWorkspace_sptr &addeeWS, const API::MatrixWorkspace_sptr &outWS);
77 void setUpdatedSampleLogs(const API::MatrixWorkspace_sptr &outWS);
78 void removeSampleLogsFromWorkspace(const API::MatrixWorkspace_sptr &addeeWS);
79 void readdSampleLogToWorkspace(const API::MatrixWorkspace_sptr &addeeWS);
80 void resetSampleLogs(const API::MatrixWorkspace_sptr &ws);
81
82private:
84
85 using SampleLogsKey = std::pair<std::string, MergeLogType>;
86 using SampleLogsMap = std::map<SampleLogsKey, SampleLogBehaviour>;
88 std::vector<std::shared_ptr<Kernel::Property>> m_addeeLogMap;
89
90 void createSampleLogsMapsFromInstrumentParams(SampleLogsMap &instrumentMap, API::MatrixWorkspace &ws);
91
92 std::shared_ptr<Kernel::Property> addPropertyForTimeSeries(const std::string &item, const double value,
94 std::shared_ptr<Kernel::Property> addPropertyForList(const std::string &item, const std::string &value,
96 bool setNumericValue(const std::string &item, const API::MatrixWorkspace &ws, double &value);
97
98 void setSampleMap(SampleLogsMap &map, const MergeLogType &, const std::string &params, API::MatrixWorkspace &ws,
99 const std::string &paramsTolerances = "", bool skipIfInPrimaryMap = false);
100
101 std::vector<double> createTolerancesVector(const size_t numberNames, const std::vector<std::string> &tolerances);
102
103 void updateSumProperty(double addeeWSNumber, double outWSNumber, API::MatrixWorkspace &outWS,
104 const std::string &name);
105 void updateTimeSeriesProperty(const API::MatrixWorkspace &addeeWS, const API::MatrixWorkspace &outWS,
106 const std::string &name);
107 void updateListProperty(const API::MatrixWorkspace &addeeWS, API::MatrixWorkspace &outWS, const std::string &name);
108 void checkWarnProperty(const API::MatrixWorkspace &addeeWS, Kernel::Property *addeeWSProperty,
109 const SampleLogBehaviour &behaviour, const double addeeWSNumber, const double outWSNumber,
110 const std::string &name);
111 void checkErrorProperty(const API::MatrixWorkspace &addeeWS, Kernel::Property *addeeWSProperty,
112 const SampleLogBehaviour &behaviour, const double addeeWSNumber, const double outWSNumber,
113 const std::string &name);
114
115 bool isWithinTolerance(const SampleLogBehaviour &behaviour, const double addeeWSNumber, const double outWSNumber);
116 bool stringPropertiesMatch(const SampleLogBehaviour &behaviour, const Kernel::Property *addeeWSProperty);
117};
118
119} // namespace Algorithms
120} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
Base MatrixWorkspace Abstract Class.
SampleLogsBehaviour : This class holds information relating to the behaviour of the sample log mergin...
std::pair< std::string, MergeLogType > SampleLogsKey
std::vector< std::shared_ptr< Kernel::Property > > m_addeeLogMap
std::map< SampleLogsKey, SampleLogBehaviour > SampleLogsMap
The Logger class is in charge of the publishing messages from the framework through various channels.
Definition: Logger.h:52
Base class for properties.
Definition: Property.h:94
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.