42 "An input workspace with units of Atomic Distance.");
44 "The filename to use for the saved data");
49 std::map<std::string, std::string> result;
57 const auto nHist =
static_cast<int>(inputWS->getNumberHistograms());
59 result[
"InputWorkspace"] =
"Workspace must contain only one spectrum";
60 }
else if (std::string(inputWS->getAxis(0)->unit()->label()) !=
"Angstrom") {
61 result[
"InputWorkspace"] =
"Expected x-units of Angstrom";
71 const std::string filename =
getProperty(
"Filename");
75 out.open(filename.c_str(), std::ios_base::out);
90 out <<
"#Comment: neutron";
91 auto run = inputWS->run();
92 if (run.hasProperty(
"Qmin")) {
93 out <<
", Qmin=" << run.getPropertyAsSingleValue(
"Qmin");
95 if (run.hasProperty(
"Qmax")) {
96 out <<
", Qmax=" << run.getPropertyAsSingleValue(
"Qmax");
98 if (run.hasProperty(
"Qdamp")) {
99 out <<
", Qdamp=" << run.getPropertyAsSingleValue(
"Qdamp");
101 if (run.hasProperty(
"Qbroad")) {
102 out <<
", Qbroad=" << run.getPropertyAsSingleValue(
"Qbroad");
108 out <<
"##### start data\n";
113 out <<
"#L r G(r) dr dG(r)\n";
117 const auto &
x = inputWS->points(0);
118 const auto &
y = inputWS->y(0);
119 const auto &dy = inputWS->e(0);
120 HistogramData::HistogramDx dx(
y.size(), 0.0);
121 if (inputWS->sharedDx(0))
123 for (
size_t i = 0; i <
x.size(); ++i) {
124 out <<
" " <<
x[i] <<
" " <<
y[i] <<
" " << dx[i] <<
" " << dy[i] <<
"\n";
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
@ Save
to specify a file to write to, the file may or may not exist
A property class for workspaces.
SavePDFGui : Saves a workspace containing a pair distrebution function in a format readable by the PD...
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
void writeWSData(std::ofstream &out, const API::MatrixWorkspace_const_sptr &inputWS)
std::map< std::string, std::string > validateInputs() override
Perform validation of ALL the input properties of the algorithm.
void writeMetaData(std::ofstream &out, const API::MatrixWorkspace_const_sptr &inputWS)
const std::string category() const override
Algorithm's category for identification.
int version() const override
Algorithm's version for identification.
void exec() override
Execute the algorithm.
void init() override
Initialize the algorithm's properties.
static const char * version()
The full version number.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.