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"
13
14#include <map>
15
16namespace Mantid {
17namespace DataHandling {
18
36class MANTID_DATAHANDLING_DLL SaveSESANS final : public API::Algorithm {
37public:
38 const std::string name() const override;
39 const std::string summary() const override;
40 int version() const override;
41 const std::vector<std::string> seeAlso() const override { return {"LoadSESANS"}; }
42 const std::string category() const override;
43 std::map<std::string, std::string> validateInputs() override;
44
45private:
46 // Length of the longest attribute name in headers (+4 for readability in the
47 // file)
48 const int MAX_HDR_LENGTH = 23;
49 // Tolerance to use when comparing two doubles for equality
50 const double TOLERANCE = 1e-09;
51 const std::vector<std::string> fileExtensions{".ses", ".SES", ".sesans", ".SESANS"};
52 const std::vector<std::string> mandatoryDoubleProperties{"ThetaZMax", "ThetaYMax", "EchoConstant"};
53 double m_sampleThickness = EMPTY_DBL();
54
55 void init() override;
56 void exec() override;
57
58 void writeHeaders(std::ofstream &outfile, API::MatrixWorkspace_const_sptr &ws);
59 void writeHeader(std::ofstream &outfile, const std::string &name, const std::string &value);
60
61 std::vector<double> calculateSpinEchoLength(const HistogramData::Points &wavelength) const;
62 std::vector<double> calculateDepolarisation(const HistogramData::HistogramY &yValues,
63 const HistogramData::Points &wavelength) const;
64 Mantid::MantidVec calculateError(const HistogramData::HistogramE &eValues, const HistogramData::HistogramY &yValues,
65 const HistogramData::Points &wavelength) const;
66};
67
68} // namespace DataHandling
69} // namespace Mantid
const int64_t TOLERANCE(1000000)
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:85
SaveSESANS : Save a workspace in the SESANS file format.
Definition: SaveSESANS.h:36
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:41
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:43