Mantid
Loading...
Searching...
No Matches
SaveSESANS.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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 "MantidDataHandling/DllConfig.h"
11#include "MantidHistogramData/Histogram.h"
14
15#include <map>
16
17namespace Mantid {
18namespace DataHandling {
19
37class MANTID_DATAHANDLING_DLL SaveSESANS final : public API::Algorithm {
38public:
39 const std::string name() const override;
40 const std::string summary() const override;
41 int version() const override;
42 const std::vector<std::string> seeAlso() const override { return {"LoadSESANS"}; }
43 const std::string category() const override;
44 std::map<std::string, std::string> validateInputs() override;
45
46private:
47 // Length of the longest attribute name in headers (+4 for readability in the
48 // file)
49 const int MAX_HDR_LENGTH = 23;
50 // Tolerance to use when comparing two doubles for equality
51 const double TOLERANCE = 1e-09;
52 const std::vector<std::string> fileExtensions{".ses", ".SES", ".sesans", ".SESANS"};
53 const std::vector<std::string> mandatoryDoubleProperties{"ThetaZMax", "ThetaYMax", "EchoConstant"};
54 double m_sampleThickness = EMPTY_DBL();
55
56 void init() override;
57 void exec() override;
58
59 void writeHeaders(std::ofstream &outfile, API::MatrixWorkspace_const_sptr &ws);
60 void writeHeader(std::ofstream &outfile, const std::string &name, const std::string &value);
61
62 std::vector<double> calculateSpinEchoLength(const HistogramData::Points &wavelength) const;
63 std::vector<double> calculateDepolarisation(const HistogramData::HistogramY &yValues,
64 const HistogramData::Points &wavelength) const;
65 Mantid::MantidVec calculateError(const HistogramData::HistogramE &eValues, const HistogramData::HistogramY &yValues,
66 const HistogramData::Points &wavelength) const;
67};
68
69} // namespace DataHandling
70} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
SaveSESANS : Save a workspace in the SESANS file format.
Definition SaveSESANS.h:37
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition SaveSESANS.h:42
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Helper class which provides the Collimation Length for SANS instruments.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition cow_ptr.h:172
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42