Mantid
Loading...
Searching...
No Matches
SaveNXcanSASBase.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2025 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
12#include "MantidDataHandling/DllConfig.h"
13
14#include <H5Cpp.h>
15#include <filesystem>
16
17namespace Mantid {
18namespace DataHandling {
19
24class MANTID_DATAHANDLING_DLL SaveNXcanSASBase : public API::Algorithm {
25protected:
26 void addStandardMetadata(const Mantid::API::MatrixWorkspace_sptr &workspace, H5::Group &sasEntry) const;
27 void addPolarizedMetadata(const Mantid::API::MatrixWorkspace_sptr &workspace, H5::Group &sasEntry) const;
28 void addData(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace) const;
29 void addPolarizedData(H5::Group &group, const Mantid::API::WorkspaceGroup_sptr &wsGroup) const;
30 H5::Group addSasEntry(H5::H5File &file, const Mantid::API::MatrixWorkspace_sptr &workspace,
31 const std::string &suffix) const;
32
33 void initStandardProperties();
34 void initPolarizedProperties();
35 std::map<std::string, std::string> validateStandardInputs() const;
36 // Polarized data and metadata
37 std::map<std::string, std::string> validatePolarizedInputWorkspace(const std::vector<std::string> &spinVec) const;
38 std::map<std::string, std::string> validateSpinStateStrings(const std::vector<std::string> &spinVec) const;
39 std::map<std::string, std::string> validatePolarizedMetadata() const;
40
41 void saveSingleWorkspaceFile(const API::MatrixWorkspace_sptr &workspace, const std::filesystem::path &path) const;
42 void savePolarizedGroup(const API::WorkspaceGroup_sptr &wsGroup, const std::filesystem::path &path) const;
43
44 std::unique_ptr<API::Progress> m_progress = nullptr;
45
46private:
47 std::map<std::string, std::vector<std::string>> createPolarizedComponentMap() const;
48};
49
50} // namespace DataHandling
51} // namespace Mantid
IPeaksWorkspace_sptr workspace
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
SaveNXcanSASBase : Base class to save a reduced workspace in the NXcanSAS format.
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.