Mantid
Loading...
Searching...
No Matches
SaveCanSAS1D.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
8
10#include "MantidAPI/Run.h"
12
15
20
21#include <boost/algorithm/string/split.hpp>
22#include <boost/algorithm/string/trim.hpp>
23#include <memory>
24
25#include <list>
26
27namespace {
28void encode(std::string &data) {
29 std::string buffer;
30 buffer.reserve(data.size());
31
32 for (auto &element : data) {
33 switch (element) {
34 case '&':
35 buffer.append("&amp;");
36 break;
37 case '\"':
38 buffer.append("&quot;");
39 break;
40 case '\'':
41 buffer.append("&apos;");
42 break;
43 case '<':
44 buffer.append("&lt;");
45 break;
46 case '>':
47 buffer.append("&gt;");
48 break;
49 default:
50 buffer.push_back(element);
51 }
52 }
53
54 data.swap(buffer);
55}
56} // namespace
57
58using namespace Mantid::Kernel;
59using namespace Mantid::Geometry;
60using namespace Mantid::API;
61
62namespace Mantid::DataHandling {
63
64// Register the algorithm into the AlgorithmFactory
66
67
68void SaveCanSAS1D::init() {
69 declareProperty(
70 std::make_unique<API::WorkspaceProperty<>>("InputWorkspace", "", Kernel::Direction::Input,
71 std::make_shared<API::WorkspaceUnitValidator>("MomentumTransfer")),
72 "The input workspace, which must be in units of Q");
73 declareProperty(std::make_unique<API::FileProperty>("Filename", "", API::FileProperty::Save, ".xml"),
74 "The name of the xml file to save");
75
76 std::vector<std::string> radiation_source{"Spallation Neutron Source",
77 "Pulsed Reactor Neutron Source",
78 "Reactor Neutron Source",
79 "Synchrotron X-ray Source",
80 "Pulsed Muon Source",
81 "Rotating Anode X-ray",
82 "Fixed Tube X-ray",
83 "neutron",
84 "x-ray",
85 "muon",
86 "electron"};
87 declareProperty("RadiationSource", "Spallation Neutron Source",
88 std::make_shared<Kernel::StringListValidator>(radiation_source), "The type of radiation used.");
89 declareProperty("Append", false,
90 "Selecting append allows the workspace to "
91 "be added to an existing canSAS 1-D file as "
92 "a new SASentry");
93 declareProperty("Process", "", "Text to append to Process section");
94 declareProperty("DetectorNames", "",
95 "Specify in a comma separated list, which detectors to store "
96 "information about; \nwhere each name must match a name "
97 "given for a detector in the [[IDF|instrument definition "
98 "file (IDF)]]. \nIDFs are located in the instrument "
99 "sub-directory of the MantidPlot install directory.");
100
101 // Collimation information
102 std::vector<std::string> collimationGeometry{
103 "Cylinder",
104 "Flat plate",
105 "Disc",
106 };
107 declareProperty("Geometry", "Disc", std::make_shared<Kernel::StringListValidator>(collimationGeometry),
108 "The geometry type of the collimation.");
109 auto mustBePositiveOrZero = std::make_shared<Kernel::BoundedValidator<double>>();
110 mustBePositiveOrZero->setLower(0);
111 declareProperty("SampleHeight", 0.0, mustBePositiveOrZero,
112 "The height of the collimation element in mm. If specified "
113 "as 0 it will not be recorded.");
114 declareProperty("SampleWidth", 0.0, mustBePositiveOrZero,
115 "The width of the collimation element in mm. If specified as "
116 "0 it will not be recorded.");
117
118 // Sample information
119 declareProperty("SampleThickness", 0.0, mustBePositiveOrZero,
120 "The thickness of the sample in mm. If specified as 0 it "
121 "will not be recorded.");
122}
130void SaveCanSAS1D::setOtherProperties(API::IAlgorithm *alg, const std::string &propertyName,
131 const std::string &propertyValue, int perioidNum) {
132 // call the base class method
133 Algorithm::setOtherProperties(alg, propertyName, propertyValue, perioidNum);
134
135 if ((propertyName == "Append") && (perioidNum > 1)) {
136 alg->setPropertyValue(propertyName, "1");
137 }
138}
141 m_workspace = getProperty("InputWorkspace");
142 if (!m_workspace) {
143 throw std::invalid_argument("Invalid inputworkspace ,Error in SaveCanSAS1D");
144 }
145
146 if (m_workspace->getNumberHistograms() > 1) {
147 throw std::invalid_argument("Error in SaveCanSAS1D - more than one histogram.");
148 }
149
150 // write xml manually as the user requires a specific format were the
151 // placement of new line characters is controled
152 // and this can't be done in using the stylesheet part in Poco or libXML
154
155 m_outFile << "\n\t<SASentry name=\"" << m_workspace->getName() << "\">";
156
157 std::string sasTitle;
158 createSASTitleElement(sasTitle);
159 m_outFile << sasTitle;
160
161 std::string sasRun;
162 createSASRunElement(sasRun);
163 m_outFile << sasRun;
164
165 std::string dataUnit = m_workspace->YUnitLabel();
166 // look for xml special characters and replace with entity refrence
168
169 std::string sasData;
170 createSASDataElement(sasData, 0);
171 m_outFile << sasData;
172
173 std::string sasSample;
174 createSASSampleElement(sasSample);
175 m_outFile << sasSample;
176
177 // Recording the SAS instrument can throw, if there
178 // are no detecors present
179 std::string sasInstrument;
180 try {
181 createSASInstrument(sasInstrument);
183 throw;
184 } catch (std::runtime_error &) {
185 throw;
186 }
187 m_outFile << sasInstrument;
188
189 std::string sasProcess;
190 createSASProcessElement(sasProcess);
191 m_outFile << sasProcess;
192
193 std::string sasNote = "\n\t\t<SASnote>";
194 sasNote += "\n\t\t</SASnote>";
195 m_outFile << sasNote;
196
197 m_outFile << "\n\t</SASentry>";
198 m_outFile << "\n</SASroot>";
199 m_outFile.close();
200}
208void SaveCanSAS1D::prepareFileToWriteEntry(const std::string &fileName) {
209 // reduce error handling code by making file access errors throw
210 m_outFile.exceptions(std::ios::eofbit | std::ios::failbit | std::ios::badbit);
211
212 bool append(getProperty("Append"));
213
214 // write xml manually as the user requires a specific format were the
215 // placement of new line characters is controled
216 // and this can't be done in using the stylesheet part in Poco or libXML
217 if (append) {
218 append = openForAppending(fileName);
219 }
220
221 if (append) {
223 } else {
224 writeHeader(fileName);
225 }
226}
231bool SaveCanSAS1D::openForAppending(const std::string &filename) {
232 try {
233 m_outFile.open(filename.c_str(), std::ios::out | std::ios::in);
234 // check if the file already has data
235 m_outFile.seekg(0, std::ios::end);
236 if (m_outFile.tellg() > 0) {
237 // a file exists with data leave the file open and state that appending
238 // should be possible
239 return true;
240 }
241 } catch (std::fstream::failure &) {
242 g_log.information() << "File " << filename << " couldn't be opened for a appending, will try to create the file\n";
243 }
244 m_outFile.clear();
245 if (m_outFile.is_open()) {
246 m_outFile.close();
247 }
248 return false;
249}
256 const int rootTagLen = static_cast<int>(std::string("</SASroot>").length());
257
258 try {
259 static const int LAST_TAG_LEN = 11;
260
261 // move to the place _near_ the end of the file where the data will be
262 // appended to
263 m_outFile.seekg(-LAST_TAG_LEN - rootTagLen, std::ios::end);
264 char test_tag[LAST_TAG_LEN + 1];
265 m_outFile.read(test_tag, LAST_TAG_LEN);
266 // check we're in the correct place in the file
267 static const char LAST_TAG[LAST_TAG_LEN + 1] = "</SASentry>";
268 if (std::string(test_tag, LAST_TAG_LEN) != std::string(LAST_TAG, LAST_TAG_LEN)) {
269 // we'll allow some extra charaters so there is some variablity in where
270 // the tag might be found
271 bool tagFound(false);
272 // UNCERT should be less than the length of a SASentry
273 static const int UNCERT = 20;
274 for (int i = 1; i < UNCERT; ++i) {
275 // together this seek and read move the file pointer back on byte at a
276 // time and read
277 m_outFile.seekg(-i - LAST_TAG_LEN - rootTagLen, std::ios::end);
278 m_outFile.read(test_tag, LAST_TAG_LEN);
279 std::string read = std::string(test_tag, LAST_TAG_LEN);
280 if (read == std::string(LAST_TAG, LAST_TAG_LEN)) {
281 tagFound = true;
282 break;
283 }
284 }
285 if (!tagFound) {
286 throw std::logic_error("Couldn't find the end of the existing data, "
287 "missing </SASentry> tag");
288 }
289 }
290 // prepare to write to the place found by reading
291 m_outFile.seekp(m_outFile.tellg(), std::ios::beg);
292 } catch (std::fstream::failure &) {
293 // give users more explaination about no being able to read their files
294 throw std::logic_error("Trouble reading existing data in the output file, "
295 "are you appending to an invalid CanSAS1D file?");
296 }
297}
303void SaveCanSAS1D::writeHeader(const std::string &fileName) {
304 try {
305 m_outFile.open(fileName.c_str(), std::ios::out | std::ios::trunc);
306 // write the file header
307 m_outFile << "<?xml version=\"1.0\"?>\n"
308 << "<?xml-stylesheet type=\"text/xsl\" "
309 "href=\"cansasxml-html.xsl\" ?>\n";
310 std::string sasroot;
311 createSASRootElement(sasroot);
312 m_outFile << sasroot;
313 } catch (std::fstream::failure &) {
314 throw Exception::FileError("Error opening the output file for writing", fileName);
315 }
316}
322 std::string specialchars = "&<>'\"";
323 std::string::size_type searchIndex = 0;
324 std::string::size_type findIndex;
325 for (char specialchar : specialchars) {
326 while (searchIndex < input.length()) {
327 findIndex = input.find(specialchar, searchIndex);
328 if (findIndex != std::string::npos) {
329 searchIndex = findIndex + 1;
330 // replace with xml entity refrence
331 replacewithEntityReference(input, findIndex);
332
333 } else {
334 searchIndex = 0;
335 break;
336 }
337 }
338 }
339}
340
346void SaveCanSAS1D::replacewithEntityReference(std::string &input, const std::string::size_type &index) {
347 std::basic_string<char>::reference str = input.at(index);
348 switch (str) {
349 case '&':
350 input.replace(index, 1, "&amp;");
351 break;
352 case '<':
353 input.replace(index, 1, "&lt;");
354 break;
355 case '>':
356 input.replace(index, 1, "&gt;");
357 break;
358 case '\'':
359 input.replace(index, 1, "&apos;");
360 break;
361 case '\"':
362 input.replace(index, 1, "&quot;");
363 break;
364 }
365}
366
370void SaveCanSAS1D::createSASRootElement(std::string &rootElem) {
371 rootElem = "<SASroot version=\"1.0\"";
372 rootElem += "\n\t\t xmlns=\"cansas1d/1.0\"";
373 rootElem += "\n\t\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
374 rootElem += "\n\t\t xsi:schemaLocation=\"cansas1d/1.0 "
375 "http://svn.smallangles.net/svn/canSAS/1dwg/trunk/"
376 "cansas1d.xsd\">";
377}
378
382void SaveCanSAS1D::createSASTitleElement(std::string &sasTitle) {
383 std::string title = m_workspace->getTitle();
384 // look for xml special characters and replace with entity refrence
386 sasTitle = "\n\t\t<Title>";
387 sasTitle += title;
388 sasTitle += "</Title>";
389}
390
394void SaveCanSAS1D::createSASRunElement(std::string &sasRun) {
395 // initialise the run number to an empty string, this may or may not be
396 // changed later
397 std::string run;
398 if (m_workspace->run().hasProperty("run_number")) {
399 Kernel::Property *logP = m_workspace->run().getLogData("run_number");
400 run = logP->value();
401 } else {
402 g_log.debug() << "Didn't find RunNumber log in workspace. Writing "
403 "<Run></Run> to the CANSAS file\n";
404 }
405
407
408 sasRun = "\n\t\t<Run>";
409 sasRun += run;
410 sasRun += "</Run>";
411}
412
417void SaveCanSAS1D::createSASDataElement(std::string &sasData, size_t workspaceIndex) {
418 std::string dataUnit = m_workspace->YUnitLabel();
419 // look for xml special characters and replace with entity refrence
421
422 // Workspaces that come out of the ISIS SANS reduction have had their
423 // YUnitLabel
424 // changed to "I(q) (cm-1)", but the CanSAS schema requires that the intensity
425 // unit
426 // be "1/cm"... In lieu of a better way to handle YUnitLabels, (and trying to
427 // avoid
428 // *always* writing out "1/cm") we have the following (brittle) if-statement.
429 if (dataUnit == "I(q) (cm-1)")
430 dataUnit = "1/cm";
431
432 const auto intensities = m_workspace->points(workspaceIndex);
433 auto intensityDeltas = m_workspace->pointStandardDeviations(workspaceIndex);
434 if (!intensityDeltas)
435 intensityDeltas = HistogramData::PointStandardDeviations(intensities.size(), 0.0);
436 const auto &ydata = m_workspace->y(workspaceIndex);
437 const auto &edata = m_workspace->e(workspaceIndex);
438 sasData += "\n\t\t<SASdata>";
439 for (size_t j = 0; j < ydata.size(); ++j) {
440 // x data is the QData in xml.If histogramdata take the mean
441 std::stringstream x;
442 x << intensities[j];
443 std::stringstream dx_str;
444 dx_str << intensityDeltas[j];
445 sasData += "\n\t\t\t<Idata><Q unit=\"1/A\">";
446 sasData += x.str();
447 sasData += "</Q>";
448 sasData += "<I unit=";
449 sasData += "\"";
450 sasData += dataUnit;
451 sasData += "\">";
453 std::stringstream y;
454 y << (ydata[j]);
455 sasData += y.str();
456 sasData += "</I>";
457
458 // workspace error data is the Idev data in the xml file
459 std::stringstream e;
460 e << edata[j];
461
462 sasData += "<Idev unit=";
463 sasData += "\"";
464 sasData += dataUnit;
465 sasData += "\">";
466
467 sasData += e.str();
468 sasData += "</Idev>";
469
470 sasData += "<Qdev unit=\"1/A\">";
471 sasData += dx_str.str();
472 sasData += "</Qdev>";
473
474 sasData += "</Idata>";
475 }
476 sasData += "\n\t\t</SASdata>";
477}
478
482void SaveCanSAS1D::createSASSampleElement(std::string &sasSample) {
483 sasSample = "\n\t\t<SASsample>";
484 // outFile<<sasSample;
485 std::string sasSampleId = "\n\t\t\t<ID>";
486 std::string sampleid = m_workspace->getTitle();
487 // look for xml special characters and replace with entity refrence
489 sasSampleId += sampleid;
490 sasSampleId += "</ID>";
491 sasSample += sasSampleId;
492 // Add sample thickness information here. We only add it if
493 // has been given a value larger than 0
494 double thickness = getProperty("SampleThickness");
495 if (thickness > 0) {
496 std::string thicknessTag = "\n\t\t\t<thickness unit=\"mm\">";
497 thicknessTag += std::to_string(thickness);
498 thicknessTag += "</thickness>";
499 sasSample += thicknessTag;
500 }
501 sasSample += "\n\t\t</SASsample>";
502}
503
507void SaveCanSAS1D::createSASSourceElement(std::string &sasSource) {
508 sasSource = "\n\t\t\t<SASsource>";
509 // outFile<<sasSource;
510
511 std::string radiation_source = getPropertyValue("RadiationSource");
512 std::string sasrad = "\n\t\t\t\t<radiation>";
513 sasrad += radiation_source;
514 sasrad += "</radiation>";
515 sasSource += sasrad;
516 // outFile<<sasrad;
517 sasSource += "\n\t\t\t</SASsource>";
518}
523void SaveCanSAS1D::createSASDetectorElement(std::string &sasDet) {
524 const std::string detectorNames = getProperty("DetectorNames");
525
526 if (detectorNames.empty()) {
527 sasDet += "\n\t\t\t<SASdetector>";
528 std::string sasDetname = "\n\t\t\t\t<name/>";
529 sasDet += sasDetname;
530 sasDet += "\n\t\t\t</SASdetector>";
531 return;
532 }
533
534 std::list<std::string> detList;
535 using std::placeholders::_1;
536 boost::algorithm::split(detList, detectorNames, std::bind(std::equal_to<char>(), _1, ','));
537 for (auto detectorName : detList) {
538 boost::algorithm::trim(detectorName);
539
540 // get first component with name detectorName in IDF
541 std::shared_ptr<const IComponent> comp = m_workspace->getInstrument()->getComponentByName(detectorName);
542 if (comp != std::shared_ptr<const IComponent>()) {
543 sasDet += "\n\t\t\t<SASdetector>";
544
545 std::string sasDetname = "\n\t\t\t\t<name>";
546 sasDetname += detectorName;
547 sasDetname += "</name>";
548 sasDet += sasDetname;
549
550 std::string sasDetUnit = "\n\t\t\t\t<SDD unit=\"m\">";
551
552 std::stringstream sdd;
553 double distance = comp->getDistance(*m_workspace->getInstrument()->getSample());
554 sdd << distance;
555
556 sasDetUnit += sdd.str();
557 sasDetUnit += "</SDD>";
558
559 sasDet += sasDetUnit;
560 sasDet += "\n\t\t\t</SASdetector>";
561 } else {
562 g_log.notice() << "Detector with name " << detectorName
563 << " does not exist in the instrument of the workspace: " << m_workspace->getName() << '\n';
564 }
565 }
566}
567
571void SaveCanSAS1D::createSASProcessElement(std::string &sasProcess) {
572 sasProcess = "\n\t\t<SASprocess>";
573 // outFile<<sasProcess;
574
575 std::string sasProcname = "\n\t\t\t<name>";
576 sasProcname += "Mantid generated CanSAS1D XML";
577 sasProcname += "</name>";
578 sasProcess += sasProcname;
579
580 time_t rawtime;
581 time(&rawtime);
582
583 char temp[25];
584 strftime(temp, 25, "%d-%b-%Y %H:%M:%S", localtime(&rawtime));
585 std::string sasDate(temp);
586
587 std::string sasProcdate = "\n\t\t\t<date>";
588 sasProcdate += sasDate;
589 sasProcdate += "</date>";
590 sasProcess += sasProcdate;
591
592 std::string sasProcsvn = "\n\t\t\t<term name=\"svn\">";
593 sasProcsvn += MantidVersion::version();
594 sasProcsvn += "</term>";
595 sasProcess += sasProcsvn;
596
597 const API::Run &run = m_workspace->run();
598 std::string user_file;
599 if (run.hasProperty("UserFile")) {
600 user_file = run.getLogData("UserFile")->value();
601 }
602
603 std::string sasProcuserfile = "\n\t\t\t<term name=\"user_file\">";
604 sasProcuserfile += user_file;
605 sasProcuserfile += "</term>";
606 // outFile<<sasProcuserfile;
607 sasProcess += sasProcuserfile;
608
609 // Reduction process note, if available
610 std::string process_xml = getProperty("Process");
611 if (!process_xml.empty()) {
612 std::string processNote = "\n\t\t\t<SASprocessnote>";
613 encode(process_xml);
614 processNote += process_xml;
615 processNote += "</SASprocessnote>";
616 sasProcess += processNote;
617 } else {
618 sasProcess += "\n\t\t\t<SASprocessnote/>";
619 }
620
621 sasProcess += "\n\t\t</SASprocess>";
622}
623
643void SaveCanSAS1D::createSASInstrument(std::string &sasInstrument) {
644 sasInstrument = "\n\t\t<SASinstrument>";
645
646 // Set name(r)
647 std::string sasInstrName = "\n\t\t\t<name>";
648 std::string instrname = m_workspace->getInstrument()->getName();
649 // look for xml special characters and replace with entity refrence
651 sasInstrName += instrname;
652 sasInstrName += "</name>";
653 sasInstrument += sasInstrName;
654
655 // Set SASsource(r)
656 std::string sasSource;
657 createSASSourceElement(sasSource);
658 sasInstrument += sasSource;
659
660 // Set SAScollimation(r)
661 // Add the collimation. We add the collimation information if
662 // either the width of the height is different from 0
663 double collimationHeight = getProperty("SampleHeight");
664 double collimationWidth = getProperty("SampleWidth");
665 std::string sasCollimation = "\n\t\t\t<SAScollimation/>";
666 if (collimationHeight > 0 || collimationWidth > 0) {
667 sasCollimation = "\n\t\t\t<SAScollimation>";
668
669 // aperture with name
670 std::string collimationGeometry = getProperty("Geometry");
671 sasCollimation += "\n\t\t\t\t<aperture name=\"" + collimationGeometry + "\">";
672
673 // size
674 sasCollimation += "\n\t\t\t\t\t<size>";
675
676 // Width
677 sasCollimation += "\n\t\t\t\t\t\t<x unit=\"mm\">" + std::to_string(collimationWidth) + "</x>";
678 // Height
679 sasCollimation += "\n\t\t\t\t\t\t<y unit=\"mm\">" + std::to_string(collimationHeight) + "</y>";
680
681 sasCollimation += "\n\t\t\t\t\t</size>";
682 sasCollimation += "\n\t\t\t\t</aperture>";
683 sasCollimation += "\n\t\t\t</SAScollimation>";
684 }
685 sasInstrument += sasCollimation;
686
687 // Set SASdetector
688 std::string sasDet;
690 sasInstrument += sasDet;
691 sasInstrument += "\n\t\t</SASinstrument>";
692}
693} // namespace Mantid::DataHandling
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
Definition: Algorithm.cpp:2026
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Definition: Algorithm.cpp:2076
Kernel::Logger & g_log
Definition: Algorithm.h:451
virtual void setOtherProperties(IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int periodNum)
Virtual method to set the non workspace properties for this algorithm.
Definition: Algorithm.cpp:1547
@ Save
to specify a file to write to, the file may or may not exist
Definition: FileProperty.h:49
IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:45
bool hasProperty(const std::string &name) const
Does the property exist on the object.
Definition: LogManager.cpp:265
Kernel::Property * getLogData(const std::string &name) const
Access a single log entry.
Definition: LogManager.h:129
This class stores information regarding an experimental run as a series of log entries.
Definition: Run.h:38
A property class for workspaces.
bool openForAppending(const std::string &filename)
opens the named file if possible or returns false
void createSASSourceElement(std::string &sasSource)
this method creates a sasSource element
std::fstream m_outFile
an fstream object is used to write the xml manually as the user requires a specific format with new l...
Definition: SaveCanSAS1D.h:146
void findEndofLastEntry()
Moves to the end of the last entry in the file.
void createSASTitleElement(std::string &sasTitle)
this method creates a sasTitle element
void createSASInstrument(std::string &sasInstrument)
this method creates a sasInstrument element
virtual void createSASRootElement(std::string &rootElem)
sasroot element
void setOtherProperties(API::IAlgorithm *alg, const std::string &propertyName, const std::string &propertyValue, int perioidNum) override
overriden method sets appending for workspace groups
void searchandreplaceSpecialChars(std::string &input)
this method searches for xml special characters and replace with entity references
void createSASProcessElement(std::string &sasProcess)
this method creates a sasProcess element
void createSASDataElement(std::string &sasData, size_t workspaceIndex)
this method creates a sasData element
void createSASDetectorElement(std::string &sasDet)
this method creates a sasDetector element
void createSASSampleElement(std::string &sasSample)
this method creates a sasSample element
virtual void writeHeader(const std::string &fileName)
Write xml header tags.
void prepareFileToWriteEntry(const std::string &fileName)
Opens the output file and, as necessary blanks it, writes the file header and moves the file pointer.
void createSASRunElement(std::string &sasRun)
this method creates a sasRun Element
API::MatrixWorkspace_const_sptr m_workspace
points to the workspace that will be written to file
Definition: SaveCanSAS1D.h:142
void replacewithEntityReference(std::string &input, const std::string::size_type &index)
replaces the charcter at index in the input string with xml entity reference(eg.replace '&' with "&")
void exec() override
Overwrites Algorithm method.
Records the filename and the description of failure.
Definition: Exception.h:98
Exception for when an item is not found in a collection.
Definition: Exception.h:145
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
void debug(const std::string &msg)
Logs at debug level.
Definition: Logger.cpp:114
void notice(const std::string &msg)
Logs at notice level.
Definition: Logger.cpp:95
void information(const std::string &msg)
Logs at information level.
Definition: Logger.cpp:105
static const char * version()
The full version number.
Base class for properties.
Definition: Property.h:94
virtual std::string value() const =0
Returns the value of the property as a string.
std::string to_string(const wide_integer< Bits, Signed > &n)
@ Input
An input workspace.
Definition: Property.h:53