/
LoadPDFgetNFile.h
72 lines (55 loc) · 2.53 KB
/
LoadPDFgetNFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2012 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/IFileLoader.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/FileDescriptor.h"
namespace Mantid {
namespace DataHandling {
/** LoadPDFgetNFile : TODO: DESCRIPTION
*/
class MANTID_DATAHANDLING_DLL LoadPDFgetNFile : public API::IFileLoader<Kernel::FileDescriptor> {
public:
/// Algorithm's name for identification overriding a virtual method
const std::string name() const override { return "LoadPDFgetNFile"; }
/// Summary of algorithms purpose
const std::string summary() const override { return "Types of PDFgetN data files include .sqa, .sq, .gr, and etc."; }
/// Algorithm's version for identification overriding a virtual method
int version() const override { return 1; }
const std::vector<std::string> seeAlso() const override { return {"LoadAscii"}; }
/// Algorithm's category for identification overriding a virtual method
const std::string category() const override { return "Diffraction\\DataHandling;DataHandling\\Text"; }
private:
/// Implement abstract Algorithm methods
void init() override;
/// Implement abstract Algorithm methods
void exec() override;
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::FileDescriptor &descriptor) const override;
/// Parse PDFgetN data file
void parseDataFile(const std::string &filename);
/// Check whether a string starts from a specified sub-string
bool startsWith(const std::string &s, const std::string &header) const;
/// Parse column name line staring with \#L
void parseColumnNameLine(std::string line);
/// Parse data line
void parseDataLine(std::string line);
/// Output data workspace
DataObjects::Workspace2D_sptr outWS;
/// Data structure to hold input: Size = Number of columns in input file
std::vector<std::vector<double>> mData;
/// Names of the columns of the data
std::vector<std::string> mColumnNames;
/// Generate output workspace
void generateDataWorkspace();
/// Set X and Y axis unit and lebel
void setUnit(const DataObjects::Workspace2D_sptr &ws);
void checkSameSize(const std::vector<size_t> &numptsvec, size_t numsets);
};
} // namespace DataHandling
} // namespace Mantid