Mantid
Loading...
Searching...
No Matches
SaveAscii2.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#include "MantidAPI/Axis.h"
12#include "MantidAPI/Run.h"
23
24#include <boost/regex.hpp>
25#include <boost/tokenizer.hpp>
26#include <fstream>
27#include <set>
28
29namespace Mantid::DataHandling {
30// Register the algorithm into the algorithm factory
31DECLARE_ALGORITHM(SaveAscii2)
32
33using namespace Kernel;
34using namespace API;
35
38 : m_separatorIndex(), m_nBins(0), m_sep(), m_writeDX(false), m_writeID(false), m_isCommonBins(false),
39 m_writeSpectrumAxisValue(false), m_ws() {}
40
43 declareProperty(std::make_unique<WorkspaceProperty<Workspace>>("InputWorkspace", "", Direction::Input),
44 "The name of the workspace containing the data you want to save to a "
45 "Ascii file.");
46
47 declareProperty(std::make_unique<FileProperty>("Filename", "", FileProperty::Save, m_asciiExts),
48 "The filename of the output Ascii file.");
49
50 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
51 mustBePositive->setLower(1);
52 auto mustBeZeroGreater = std::make_shared<BoundedValidator<int>>();
53 mustBeZeroGreater->setLower(0);
54 declareProperty("WorkspaceIndexMin", EMPTY_INT(), mustBeZeroGreater,
55 "The starting workspace index. Ignored for Table Workspaces.");
56 declareProperty("WorkspaceIndexMax", EMPTY_INT(), mustBeZeroGreater,
57 "The ending workspace index. Ignored for Table Workspaces.");
58 declareProperty(std::make_unique<ArrayProperty<int>>("SpectrumList"),
59 "List of workspace indices to save. Ignored for Table Workspaces.");
60 declareProperty("Precision", EMPTY_INT(), mustBePositive, "Precision of output double values.");
61 declareProperty("ScientificFormat", false,
62 "If true, the values will be "
63 "written to the file in "
64 "scientific notation.");
65 declareProperty("WriteXError", false,
66 "If true, the error on X will be written as the fourth "
67 "column. Ignored for Table Workspaces.");
68 declareProperty("WriteSpectrumID", true,
69 "If false, the spectrum No will not be written for "
70 "single-spectrum workspaces. "
71 "It is always written for workspaces with multiple spectra, "
72 "unless spectrum axis value is written. Ignored for Table Workspaces.");
73
74 declareProperty("CommentIndicator", "#", "Character(s) to put in front of comment lines.");
75
76 // For the ListValidator
77 std::string spacers[6][2] = {{"CSV", ","}, {"Tab", "\t"}, {"Space", " "},
78 {"Colon", ":"}, {"SemiColon", ";"}, {"UserDefined", "UserDefined"}};
79 std::vector<std::string> sepOptions;
80 for (auto &spacer : spacers) {
81 std::string option = spacer[0];
82 m_separatorIndex.insert(std::pair<std::string, std::string>(option, spacer[1]));
83 sepOptions.emplace_back(option);
84 }
85
86 declareProperty("Separator", "CSV", std::make_shared<StringListValidator>(sepOptions),
87 "The separator between data columns in the data file. The "
88 "possible values are \"CSV\", \"Tab\", "
89 "\"Space\", \"SemiColon\", \"Colon\" or \"UserDefined\".");
90
91 declareProperty(std::make_unique<PropertyWithValue<std::string>>("CustomSeparator", "", Direction::Input),
92 "If present, will override any specified choice given to Separator.");
93
94 setPropertySettings("CustomSeparator",
95 std::make_unique<VisibleWhenProperty>("Separator", IS_EQUAL_TO, "UserDefined"));
96 getPointerToProperty("CustomSeparator")->setAutoTrim(false);
97 declareProperty("ColumnHeader", true,
98 "If true, put column headers into file. Even if false, a header"
99 "is automatically added if the workspace is Distribution = true.");
100
101 declareProperty("SpectrumMetaData", "",
102 "A comma separated list that defines data that describes "
103 "each spectrum in a workspace. The valid options for this "
104 "are: SpectrumNumber,Q,Angle. Ignored for Table Workspaces.");
105
106 declareProperty("AppendToFile", false, "If true, don't overwrite the file. Append to the end of it. ");
107
108 declareProperty("RaggedWorkspace", true,
109 "If true, ensure that more than one xspectra is used. "
110 "Ignored for Table Workspaces."); // in testing
111
112 declareProperty("WriteSpectrumAxisValue", false,
113 "Write the spectrum axis value if requested. Ignored for "
114 "Table Workspaces.");
115
116 declareProperty(std::make_unique<ArrayProperty<std::string>>("LogList"),
117 "List of logs to write to the file header. Ignored for Table "
118 "Workspaces.");
119
120 declareProperty("OneSpectrumPerFile", false, "If true, each spectrum will be saved to an individual file");
121}
122
127 // Get the workspace
128 Workspace_const_sptr ws = getProperty("InputWorkspace");
129 m_ws = std::dynamic_pointer_cast<const MatrixWorkspace>(ws);
130 ITableWorkspace_const_sptr tws = std::dynamic_pointer_cast<const ITableWorkspace>(ws);
131
132 // Get the properties valid for all workspaces
133 const bool writeHeader = getProperty("ColumnHeader");
134 const bool appendToFile = getProperty("AppendToFile");
135 std::string filename = getProperty("Filename");
136 int prec = getProperty("Precision");
137 bool scientific = getProperty("ScientificFormat");
138 std::string comment = getPropertyValue("CommentIndicator");
139
140 const std::string choice = getPropertyValue("Separator");
141 const std::string custom = getPropertyValue("CustomSeparator");
142 // If the custom separator property is not empty, then we use that under
143 // any circumstance.
144 if (!custom.empty()) {
145 m_sep = custom;
146 }
147 // Else if the separator drop down choice is not UserDefined then we use
148 // that.
149 else if (choice != "UserDefined") {
150 auto it = m_separatorIndex.find(choice);
151 m_sep = it->second;
152 }
153 // If we still have nothing, then we are forced to use a default.
154 if (m_sep.empty()) {
155 g_log.notice() << "\"UserDefined\" has been selected, but no custom "
156 "separator has been entered."
157 " Using default instead.";
158 m_sep = ",";
159 }
160
161 if (tws) {
162 writeTableWorkspace(tws, filename, appendToFile, writeHeader, prec, scientific, comment);
163 // return here as the rest of the class is all about matrix workspace saving
164 return;
165 }
166
167 if (!m_ws) {
168 throw std::runtime_error("SaveAscii does not now how to save this workspace type, " + ws->getName());
169 }
170
171 // Get the properties valid for matrix workspaces
172 std::vector<int> spec_list = getProperty("SpectrumList");
173 const int spec_min = getProperty("WorkspaceIndexMin");
174 const int spec_max = getProperty("WorkspaceIndexMax");
175 m_writeSpectrumAxisValue = getProperty("WriteSpectrumAxisValue");
176 m_writeDX = getProperty("WriteXError");
177
178 m_writeID = getProperty("WriteSpectrumID");
179 std::string metaDataString = getPropertyValue("SpectrumMetaData");
180 if (!metaDataString.empty()) {
181 m_metaData = stringListToVector(metaDataString);
182 auto containsSpectrumNumber = findElementInUnorderedStringVector(m_metaData, "spectrumnumber");
183 if (containsSpectrumNumber) {
184 try {
185 m_ws->getSpectrumToWorkspaceIndexMap();
186 } catch (const std::runtime_error &) {
187 throw std::runtime_error("SpectrumNumber is present in "
188 "SpectrumMetaData but the workspace does not "
189 "have a SpectrumAxis.");
190 }
191 }
192 }
193 if (m_writeID) {
194 auto containsSpectrumNumber = findElementInUnorderedStringVector(m_metaData, "spectrumnumber");
195 if (!containsSpectrumNumber) {
196 auto firstIter = m_metaData.begin();
197 m_metaData.insert(firstIter, "spectrumnumber");
198 }
199 }
200
202 auto spectrumAxis = m_ws->getAxis(1);
203 if (dynamic_cast<BinEdgeAxis *>(spectrumAxis)) {
204 m_axisProxy = std::make_unique<AxisHelper::BinEdgeAxisProxy>(spectrumAxis);
205 } else {
206 m_axisProxy = std::make_unique<AxisHelper::AxisProxy>(spectrumAxis);
207 }
208 }
209
210 // e + and - are included as they're part of the scientific notation
211 if (!boost::regex_match(m_sep.begin(), m_sep.end(), boost::regex("[^0-9e+-]+", boost::regex::perl))) {
212 throw std::invalid_argument("Separators cannot contain numeric characters, "
213 "plus signs, hyphens or 'e'");
214 }
215
216 if (comment.at(0) == m_sep.at(0) ||
217 !boost::regex_match(comment.begin(), comment.end(),
218 boost::regex("[^0-9e" + m_sep + "+-]+", boost::regex::perl))) {
219 throw std::invalid_argument("Comment markers cannot contain numeric "
220 "characters, plus signs, hyphens,"
221 " 'e' or the selected separator character");
222 }
223
224 // Create an spectra index list for output
225 std::set<int> idx;
226
227 auto nSpectra = static_cast<int>(m_ws->getNumberHistograms());
228 m_nBins = static_cast<int>(m_ws->blocksize());
229 m_isCommonBins = m_ws->isCommonBins(); // checking for ragged workspace
230
231 // Add spectra interval into the index list
232 if (spec_max != EMPTY_INT() && spec_min != EMPTY_INT()) {
233 if (spec_min >= nSpectra || spec_max >= nSpectra || spec_min < 0 || spec_max < 0 || spec_min > spec_max) {
234 throw std::invalid_argument("Inconsistent spectra interval");
235 }
236 for (int i = spec_min; i <= spec_max; i++) {
237 idx.insert(i);
238 }
239 }
240 // figure out how to read in readX and have them be seperate lists
241
242 // Add spectra list into the index list
243 if (!spec_list.empty()) {
244 for (auto &spec : spec_list) {
245 if (spec >= nSpectra) {
246 throw std::invalid_argument("Inconsistent spectra list");
247 } else {
248 idx.insert(spec);
249 }
250 }
251 }
252
253 // if no interval or spectra list, take all of them
254 if (idx.empty()) {
255 for (int i = 0; i < nSpectra; i++) {
256 idx.insert(i);
257 }
258 }
259
260 if (m_nBins == 0 || nSpectra == 0) {
261 throw std::runtime_error("Trying to save an empty workspace");
262 }
263
264 const bool oneSpectrumPerFile = getProperty("OneSpectrumPerFile");
265
266 Progress progress(this, 0.0, 1.0, idx.size());
267
268 // populate the meta data map
269 if (!m_metaData.empty()) {
271 }
272
273 const bool isDistribution = m_ws->isDistribution();
274 auto idxIt = idx.begin();
275 while (idxIt != idx.end()) {
276 std::string currentFilename;
277 if (oneSpectrumPerFile)
278 currentFilename = createSpectrumFilename(*idxIt);
279 else
280 currentFilename = filename;
281
282 std::ofstream file(currentFilename, (appendToFile ? std::ios::app : std::ios::out));
283
284 if (file.bad()) {
285 throw Exception::FileError("Unable to create file: ", currentFilename);
286 }
287 // Set the number precision
288 if (prec != EMPTY_INT()) {
289 file.precision(prec);
290 }
291 if (scientific) {
292 file << std::scientific;
293 }
294 const std::vector<std::string> logList = getProperty("LogList");
295 if (!logList.empty()) {
296 writeFileHeader(logList, file);
297 }
298 if (writeHeader || isDistribution) {
299 file << comment << " X " << m_sep << " Y " << m_sep << " E";
300 if (m_writeDX) {
301 file << " " << m_sep << " DX";
302 }
303 file << " Distribution=" << (isDistribution ? "true" : "false");
304 file << '\n';
305 }
306
307 // data writing
308 if (oneSpectrumPerFile) {
309 writeSpectrum(*idxIt, file);
310 progress.report();
311 idxIt++;
312 } else {
313 while (idxIt != idx.end()) {
314 writeSpectrum(*idxIt, file);
315 progress.report();
316 idxIt++;
317 }
318 }
319
320 file.unsetf(std::ios_base::floatfield);
321 file.close();
322 }
323}
324
331std::string SaveAscii2::createSpectrumFilename(size_t workspaceIndex) {
332 std::string filename = getProperty("Filename");
333 size_t extPosition;
334 for (const std::string &ext : m_asciiExts) {
335 extPosition = filename.find(ext);
336 if (extPosition != std::string::npos)
337 break;
338 }
339 if (extPosition == std::string::npos)
340 extPosition = filename.size();
341
342 std::ostringstream ss;
343 ss << std::string(filename, 0, extPosition) << "_" << workspaceIndex;
344 auto axis = m_ws->getAxis(1);
345 if (axis->isNumeric()) {
346 auto binEdgeAxis = dynamic_cast<BinEdgeAxis *>(axis);
347 if (binEdgeAxis)
348 ss << "_" << binEdgeAxis->label(workspaceIndex) << axis->unit()->label().ascii();
349 else
350 ss << "_" << axis->getValue(workspaceIndex) << axis->unit()->label().ascii();
351 } else if (axis->isText())
352 ss << "_" << axis->label(workspaceIndex);
353 ss << std::string(filename, extPosition);
354
355 return ss.str();
356}
357
363void SaveAscii2::writeSpectrum(const int &wsIndex, std::ofstream &file) {
364
366 file << m_axisProxy->getCentre(wsIndex) << '\n';
367 } else {
368 for (auto iter = m_metaData.begin(); iter != m_metaData.end(); ++iter) {
369 auto value = m_metaDataMap[*iter][wsIndex];
370 file << value;
371 if (iter != m_metaData.end() - 1) {
372 file << " " << m_sep << " ";
373 }
374 }
375 file << '\n';
376 }
377 auto pointDeltas = m_ws->pointStandardDeviations(0);
378 auto points0 = m_ws->points(0);
379 auto pointsSpec = m_ws->points(wsIndex);
380 bool hasDx = m_ws->hasDx(0);
381 for (int bin = 0; bin < m_nBins; bin++) {
382 if (m_isCommonBins) {
383 file << points0[bin];
384 } else // checking for ragged workspace
385 {
386 file << pointsSpec[bin];
387 }
388 file << m_sep;
389 file << m_ws->y(wsIndex)[bin];
390
391 file << m_sep;
392 file << m_ws->e(wsIndex)[bin];
393 if (m_writeDX) {
394 if (hasDx) {
395 file << m_sep;
396 file << pointDeltas[bin];
397 } else {
398 g_log.information("SaveAscii2: WriteXError is requested but there are no Dx data in the workspace");
399 }
400 }
401 file << '\n';
402 }
403}
404
411std::vector<std::string> SaveAscii2::stringListToVector(std::string &inputString) {
412 const std::vector<std::string> validMetaData{"spectrumnumber", "q", "angle"};
413 boost::to_lower(inputString);
414 auto stringVector = Kernel::VectorHelper::splitStringIntoVector<std::string>(inputString);
415 for (const auto &input : stringVector) {
416 if (std::find(validMetaData.begin(), validMetaData.end(), input) == validMetaData.end()) {
417 throw std::runtime_error(input + " is not recognised as a possible input "
418 "for SpectrumMetaData.\n Valid inputs "
419 "are: SpectrumNumber, Q, Angle.");
420 }
421 }
422
423 return stringVector;
424}
425
431 std::vector<std::string> qValues;
432 const auto nHist = m_ws->getNumberHistograms();
433 const auto &spectrumInfo = m_ws->spectrumInfo();
434 for (size_t i = 0; i < nHist; i++) {
435 double theta(0.0), efixed(0.0);
436 if (!spectrumInfo.isMonitor(i)) {
437 theta = 0.5 * spectrumInfo.twoTheta(i);
438 try {
439 std::shared_ptr<const Geometry::IDetector> detector(&spectrumInfo.detector(i), NoDeleting());
440 efixed = m_ws->getEFixed(detector);
441 } catch (std::runtime_error &) {
442 throw;
443 }
444 } else {
445 theta = 0.0;
446 efixed = DBL_MIN;
447 }
448 // Convert to MomentumTransfer
450 auto qValueStr = boost::lexical_cast<std::string>(qValue);
451 qValues.emplace_back(qValueStr);
452 }
453 m_metaDataMap["q"] = qValues;
454}
455
460 std::vector<std::string> spectrumNumbers;
461 const size_t nHist = m_ws->getNumberHistograms();
462 for (size_t i = 0; i < nHist; i++) {
463 const auto specNum = m_ws->getSpectrum(i).getSpectrumNo();
464 const auto specNumStr = std::to_string(specNum);
465 spectrumNumbers.emplace_back(specNumStr);
466 }
467 m_metaDataMap["spectrumnumber"] = spectrumNumbers;
468}
469
474 std::vector<std::string> angles;
475 const size_t nHist = m_ws->getNumberHistograms();
476 const auto &spectrumInfo = m_ws->spectrumInfo();
477 for (size_t i = 0; i < nHist; i++) {
478 const auto two_theta = spectrumInfo.twoTheta(i);
479 constexpr double rad2deg = 180. / M_PI;
480 const auto angleInDeg = two_theta * rad2deg;
481 const auto angleInDegStr = boost::lexical_cast<std::string>(angleInDeg);
482 angles.emplace_back(angleInDegStr);
483 }
484 m_metaDataMap["angle"] = angles;
485}
486
491 for (const auto &metaDataType : m_metaData) {
492 if (metaDataType == "spectrumnumber")
494 if (metaDataType == "q")
496 if (metaDataType == "angle")
498 }
499}
500
501bool SaveAscii2::findElementInUnorderedStringVector(const std::vector<std::string> &vector, const std::string &toFind) {
502 return std::find(vector.cbegin(), vector.cend(), toFind) != vector.cend();
503}
504
505void SaveAscii2::writeTableWorkspace(const ITableWorkspace_const_sptr &tws, const std::string &filename,
506 bool appendToFile, bool writeHeader, int prec, bool scientific,
507 const std::string &comment) {
508
509 std::ofstream file(filename.c_str(), (appendToFile ? std::ios::app : std::ios::out));
510
511 if (file.bad()) {
512 throw Exception::FileError("Unable to create file: ", filename);
513 }
514 // Set the number precision
515 if (prec != EMPTY_INT()) {
516 file.precision(prec);
517 }
518 if (scientific) {
519 file << std::scientific;
520 }
521
522 const auto columnCount = tws->columnCount();
523 if (writeHeader) {
524 // write the column names
525 file << comment << " ";
526 for (size_t colIndex = 0; colIndex < columnCount; colIndex++) {
527 file << tws->getColumn(colIndex)->name() << " ";
528 if (colIndex < columnCount - 1) {
529 file << m_sep << " ";
530 }
531 }
532 file << '\n';
533 // write the column types
534 file << comment << " ";
535 for (size_t colIndex = 0; colIndex < columnCount; colIndex++) {
536 file << tws->getColumn(colIndex)->type() << " ";
537 if (colIndex < columnCount - 1) {
538 file << m_sep << " ";
539 }
540 }
541 file << '\n';
542 } else {
543 g_log.warning("Please note that files written without headers cannot be "
544 "reloaded back into Mantid with LoadAscii.");
545 }
546
547 // write the data
548 const auto rowCount = tws->rowCount();
549 Progress progress(this, 0.0, 1.0, rowCount);
550 for (size_t rowIndex = 0; rowIndex < rowCount; rowIndex++) {
551 for (size_t colIndex = 0; colIndex < columnCount; colIndex++) {
552 tws->getColumn(colIndex)->print(rowIndex, file);
553 if (colIndex < columnCount - 1) {
554 file << m_sep;
555 }
556 }
557 file << "\n";
558 progress.report();
559 }
560
561 file.unsetf(std::ios_base::floatfield);
562 file.close();
563}
564
571std::pair<std::string, std::string> SaveAscii2::sampleLogValueUnit(const std::string &logName) {
572 auto run = m_ws->run();
573 // Gets the sample log value
574 std::string sampleLogValue = "";
575 try {
576 sampleLogValue = boost::lexical_cast<std::string>(run.getLogData(logName)->value());
577 } catch (Exception::NotFoundError &) {
578 g_log.warning("Log " + logName + " not found.");
579 sampleLogValue = "Not defined";
580 }
581 // Gets the sample log unit
582 std::string sampleLogUnit = "";
583 try {
584 sampleLogUnit = boost::lexical_cast<std::string>(run.getLogData(logName)->units());
585 } catch (Exception::NotFoundError &) {
586 sampleLogUnit = "";
587 }
588 return std::pair(sampleLogValue, sampleLogUnit);
589}
590
597void SaveAscii2::writeFileHeader(const std::vector<std::string> &logList, std::ofstream &outputFile) {
598 for (const auto &logName : logList) {
599 const std::pair<std::string, std::string> readLog = sampleLogValueUnit(logName);
600 auto logValue = boost::replace_all_copy(readLog.second, ",", ";");
601 outputFile << logName << m_sep << readLog.first << m_sep << logValue << '\n';
602 }
603 outputFile << '\n';
604}
605
606} // namespace Mantid::DataHandling
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
double value
The value of the point.
Definition: FitMW.cpp:51
int nSpectra
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Definition: Algorithm.cpp:1913
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
Definition: Algorithm.cpp:2033
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
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
Definition: Algorithm.cpp:231
Stores numeric values that are assumed to be bin edge values.
Definition: BinEdgeAxis.h:20
std::string label(const std::size_t &index) const override
Returns a text label which shows the value at the given bin index.
Definition: BinEdgeAxis.cpp:93
@ Save
to specify a file to write to, the file may or may not exist
Definition: FileProperty.h:49
Helper class for reporting progress from algorithms.
Definition: Progress.h:25
A property class for workspaces.
bool findElementInUnorderedStringVector(const std::vector< std::string > &vector, const std::string &toFind)
Definition: SaveAscii2.cpp:501
API::MatrixWorkspace_const_sptr m_ws
Definition: SaveAscii2.h:91
void populateAngleMetaData()
Populate the map with the Angle for each spectrum in the workspace.
Definition: SaveAscii2.cpp:473
void populateSpectrumNumberMetaData()
Populate the map with the SpectrumNumber for each Spectrum in the workspace.
Definition: SaveAscii2.cpp:459
void writeSpectrum(const int &wsIndex, std::ofstream &file)
Writes a spectrum to the file using a workspace index.
Definition: SaveAscii2.cpp:363
std::map< std::string, std::vector< std::string > > m_metaDataMap
Definition: SaveAscii2.h:93
void writeTableWorkspace(const API::ITableWorkspace_const_sptr &tws, const std::string &filename, bool appendToFile, bool writeHeader, int prec, bool scientific, const std::string &comment)
Definition: SaveAscii2.cpp:505
void writeFileHeader(const std::vector< std::string > &logList, std::ofstream &file)
Write file header.
Definition: SaveAscii2.cpp:597
std::pair< std::string, std::string > sampleLogValueUnit(const std::string &logName)
Retrieve sample log value and its unit.
Definition: SaveAscii2.cpp:571
std::vector< std::string > stringListToVector(std::string &inputString)
Converts a comma separated list to a vector of strings Also ensures all strings are valid input.
Definition: SaveAscii2.cpp:411
SaveAscii2()
Default constructor.
Definition: SaveAscii2.cpp:37
void populateAllMetaData()
Populate all required meta data in the meta data map.
Definition: SaveAscii2.cpp:490
const std::vector< std::string > m_asciiExts
Definition: SaveAscii2.h:95
void exec() override
Overwrites Algorithm method.
Definition: SaveAscii2.cpp:126
std::vector< std::string > m_metaData
Definition: SaveAscii2.h:92
std::string createSpectrumFilename(size_t workspaceIndex)
Create the filename used for the export of a specific spectrum.
Definition: SaveAscii2.cpp:331
void init() override
Overwrites Algorithm method.
Definition: SaveAscii2.cpp:42
std::map< std::string, std::string > m_separatorIndex
Map the separator options to their string equivalents.
Definition: SaveAscii2.h:83
void populateQMetaData()
Populate the map with the Q values associated with each spectrum in the workspace.
Definition: SaveAscii2.cpp:430
std::unique_ptr< AxisHelper::AxisProxy > m_axisProxy
Definition: SaveAscii2.h:94
Void deleter for shared pointers.
Support for a property that holds an array of values.
Definition: ArrayProperty.h:28
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
void setPropertySettings(const std::string &name, std::unique_ptr< IPropertySettings > settings)
void notice(const std::string &msg)
Logs at notice level.
Definition: Logger.cpp:95
void warning(const std::string &msg)
Logs at warning level.
Definition: Logger.cpp:86
void information(const std::string &msg)
Logs at information level.
Definition: Logger.cpp:105
The concrete, templated class for properties.
void setAutoTrim(const bool &setting)
Sets if the property is set to automatically trim string unput values of whitespace.
Definition: Property.cpp:371
static double convertToElasticQ(const double theta, const double efixed)
Convert to ElasticQ from Energy.
std::shared_ptr< const ITableWorkspace > ITableWorkspace_const_sptr
shared pointer to Mantid::API::ITableWorkspace (const version)
std::shared_ptr< const Workspace > Workspace_const_sptr
shared pointer to Mantid::API::Workspace (const version)
Definition: Workspace_fwd.h:22
constexpr double rad2deg
template DLLExport std::vector< std::string > splitStringIntoVector< std::string >(std::string listString)
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
Definition: EmptyValues.h:25
std::string to_string(const wide_integer< Bits, Signed > &n)
@ Input
An input workspace.
Definition: Property.h:53