-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38582 from mantidproject/refactor_Save_NXcanSAS
Refactor SaveNXcanSAS algorithm to support different variants
- Loading branch information
Showing
8 changed files
with
1,013 additions
and
894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Framework/DataHandling/inc/MantidDataHandling/NXcanSASHelper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Mantid Repository : https://github.com/mantidproject/mantid | ||
// | ||
// Copyright © 2025 ISIS Rutherford Appleton Laboratory UKRI, | ||
// NScD Oak Ridge National Laboratory, European Spallation Source, | ||
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
// SPDX - License - Identifier: GPL - 3.0 + | ||
#pragma once | ||
|
||
#include "MantidAPI/Algorithm.h" | ||
#include "MantidAPI/MatrixWorkspace_fwd.h" | ||
#include "MantidDataHandling/DllConfig.h" | ||
#include <H5Cpp.h> | ||
|
||
namespace Mantid { | ||
namespace DataHandling { | ||
namespace NXcanSAS { | ||
// Helper functions for algorithms saving in NXcanSAS format. | ||
enum class WorkspaceDimensionality; | ||
|
||
std::string MANTID_DATAHANDLING_DLL makeCanSASRelaxedName(const std::string &input); | ||
|
||
void MANTID_DATAHANDLING_DLL addDetectors(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, | ||
const std::vector<std::string> &detectorNames); | ||
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); | ||
void MANTID_DATAHANDLING_DLL addSample(H5::Group &group, const double &sampleThickness); | ||
void MANTID_DATAHANDLING_DLL addProcess(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace); | ||
void MANTID_DATAHANDLING_DLL addProcess(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace, | ||
const Mantid::API::MatrixWorkspace_sptr &canWorkspace); | ||
void MANTID_DATAHANDLING_DLL addProcessEntry(H5::Group &group, const std::string &entryName, | ||
const std::string &entryValue); | ||
void MANTID_DATAHANDLING_DLL addTransmission(H5::Group &group, const Mantid::API::MatrixWorkspace_const_sptr &workspace, | ||
const std::string &transmissionName); | ||
|
||
void MANTID_DATAHANDLING_DLL addData1D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace); | ||
void MANTID_DATAHANDLING_DLL addData2D(H5::Group &data, const Mantid::API::MatrixWorkspace_sptr &workspace); | ||
|
||
WorkspaceDimensionality MANTID_DATAHANDLING_DLL | ||
getWorkspaceDimensionality(const Mantid::API::MatrixWorkspace_sptr &workspace); | ||
std::vector<std::string> MANTID_DATAHANDLING_DLL splitDetectorNames(std::string detectorNames); | ||
|
||
} // namespace NXcanSAS | ||
} // namespace DataHandling | ||
} // namespace Mantid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Framework/DataHandling/inc/MantidDataHandling/SaveNXcanSASBase.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Mantid Repository : https://github.com/mantidproject/mantid | ||
// | ||
// Copyright © 2025 ISIS Rutherford Appleton Laboratory UKRI, | ||
// NScD Oak Ridge National Laboratory, European Spallation Source, | ||
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS | ||
// SPDX - License - Identifier: GPL - 3.0 + | ||
#pragma once | ||
|
||
#include "MantidAPI/Algorithm.h" | ||
#include "MantidAPI/MatrixWorkspace_fwd.h" | ||
#include "MantidDataHandling/DllConfig.h" | ||
#include <H5Cpp.h> | ||
|
||
namespace Mantid { | ||
namespace DataHandling { | ||
|
||
/** SaveNXcanSASBase : Base class to save a reduced workspace in the NXcanSAS format. Currently | ||
* only MatrixWorkspaces resulting from | ||
* 1D and 2D reductions are supported. | ||
*/ | ||
class MANTID_DATAHANDLING_DLL SaveNXcanSASBase : public API::Algorithm { | ||
protected: | ||
void addStandardMetadata(const Mantid::API::MatrixWorkspace_sptr &workspace, H5::Group &sasEntry); | ||
void addData(H5::Group &group, const Mantid::API::MatrixWorkspace_sptr &workspace); | ||
H5::Group addSasEntry(H5::H5File &file, const Mantid::API::MatrixWorkspace_sptr &workspace, | ||
const std::string &suffix); | ||
void initStandardProperties(); | ||
std::map<std::string, std::string> validateStandardInputs(); | ||
}; | ||
|
||
} // namespace DataHandling | ||
} // namespace Mantid |
Oops, something went wrong.