Mantid
Loading...
Searching...
No Matches
SaveNXcanSASHelper.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
11#include "MantidDataHandling/DllConfig.h"
12#include <H5Cpp.h>
13#include <filesystem>
14#include <vector>
15
16namespace Mantid {
17namespace DataHandling {
18namespace NXcanSAS {
19
20// DATA
21void MANTID_DATAHANDLING_DLL addData1D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace);
22void MANTID_DATAHANDLING_DLL addData2D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace);
23
24// STANDARD METADATA
25void MANTID_DATAHANDLING_DLL addDetectors(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace,
26 const std::vector<std::string> &detectorNames);
27void MANTID_DATAHANDLING_DLL addInstrument(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace,
28 const std::string &radiationSource, const std::string &geometry,
29 double beamHeight, double beamWidth,
30 const std::vector<std::string> &detectorNames);
31void MANTID_DATAHANDLING_DLL addSample(H5::Group &group, const double &sampleThickness);
32void MANTID_DATAHANDLING_DLL addProcess(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace);
33void MANTID_DATAHANDLING_DLL addProcess(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace,
34 const Mantid::API::MatrixWorkspace_sptr &canWorkspace);
35void MANTID_DATAHANDLING_DLL addProcessEntry(H5::Group &group, const std::string &entryName,
36 const std::string &entryValue);
37void MANTID_DATAHANDLING_DLL addTransmission(H5::Group &group, const Mantid::API::MatrixWorkspace_const_sptr &workspace,
38 const std::string &transmissionName);
39
40// POLARIZED DATA
41void MANTID_DATAHANDLING_DLL addPolarizedData(H5::Group &data, const Mantid::API::WorkspaceGroup_sptr &wsGroup,
42 const std::string &inputSpinStates);
43void MANTID_DATAHANDLING_DLL addPolarizer(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace,
44 const std::string &componentName, const std::string &componentType,
45 const std::string &groupSuffix);
46
47// POLARIZED METADATA
48void MANTID_DATAHANDLING_DLL addSampleEMFields(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace,
49 const std::string &emFieldStrengthLog, const std::string &emFieldDir);
50void MANTID_DATAHANDLING_DLL addEMFieldDirection(H5::Group &group, const std::string &emFieldDir);
51
52// UTILITY
53std::string MANTID_DATAHANDLING_DLL makeCanSASRelaxedName(const std::string &input);
54H5::H5File MANTID_DATAHANDLING_DLL prepareFile(const std::filesystem::path &path);
55std::filesystem::path MANTID_DATAHANDLING_DLL prepareFilename(const std::string &baseFilename,
56 bool addDigitSuffix = false, size_t index = 0);
57std::string MANTID_DATAHANDLING_DLL addDigit(size_t index);
58
59} // namespace NXcanSAS
60} // namespace DataHandling
61} // namespace Mantid
IPeaksWorkspace_sptr workspace
std::map< DeltaEMode::Type, std::string > index
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::filesystem::path MANTID_DATAHANDLING_DLL prepareFilename(const std::string &baseFilename, bool addDigitSuffix=false, size_t index=0)
void MANTID_DATAHANDLING_DLL addInstrument(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, const std::string &radiationSource, const std::string &geometry, double beamHeight, double beamWidth, const std::vector< std::string > &detectorNames)
Add the instrument group to the NXcanSAS file.
void MANTID_DATAHANDLING_DLL addData2D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace)
Stores the 2D signal and Q data in the HDF5 file.
void MANTID_DATAHANDLING_DLL addSampleEMFields(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, const std::string &emFieldStrengthLog, const std::string &emFieldDir)
Adds the direction and strength of either magnetic or electric field on the sample.
void MANTID_DATAHANDLING_DLL addData1D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace)
Adds signal and Q data to the data group from 1D reduced SANS data.
void MANTID_DATAHANDLING_DLL addEMFieldDirection(H5::Group &group, const std::string &emFieldDir)
Adds the Field direction of either the magnetic or the electric field on the sample.
void MANTID_DATAHANDLING_DLL addProcess(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace)
void MANTID_DATAHANDLING_DLL addDetectors(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, const std::vector< std::string > &detectorNames)
Adds detector info to the sas group.
std::string MANTID_DATAHANDLING_DLL makeCanSASRelaxedName(const std::string &input)
This makes out of an input a relaxed name, something conforming to "[A-Za-z_][\w_]*" For now "-" is c...
std::string MANTID_DATAHANDLING_DLL addDigit(size_t index)
void MANTID_DATAHANDLING_DLL addPolarizer(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, const std::string &componentName, const std::string &componentType, const std::string &groupSuffix)
Add the polarizer component information to the instrument cansas group.
void MANTID_DATAHANDLING_DLL addPolarizedData(H5::Group &data, const Mantid::API::WorkspaceGroup_sptr &wsGroup, const std::string &inputSpinStates)
Adds signal, Q and spin data to the data group from 1D or 2D reduced polarized SANS data.
void MANTID_DATAHANDLING_DLL addProcessEntry(H5::Group &group, const std::string &entryName, const std::string &entryValue)
void MANTID_DATAHANDLING_DLL addSample(H5::Group &group, const double &sampleThickness)
Adds sample thickness information to the sas sample group.
H5::H5File MANTID_DATAHANDLING_DLL prepareFile(const std::filesystem::path &path)
Creates and opens a H5 File in the given path.
void MANTID_DATAHANDLING_DLL addTransmission(H5::Group &group, const Mantid::API::MatrixWorkspace_const_sptr &workspace, const std::string &transmissionName)
Add a transmission group to the cansas file, including metadata extracted from the transmission works...
Helper class which provides the Collimation Length for SANS instruments.