LoadGSS.h 2.69 KB
Newer Older
1
2
3
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2010 ISIS Rutherford Appleton Laboratory UKRI,
4
5
//   NScD Oak Ridge National Laboratory, European Spallation Source,
//   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#pragma once
8
9
10
11

//---------------------------------------------------
// Includes
//---------------------------------------------------
12
#include "MantidAPI/IFileLoader.h"
13
#include "MantidKernel/FileDescriptor.h"
14

15
16
namespace Mantid {
namespace DataHandling {
17
18
19
20
21
22
/**
     Loads a file as saved by SaveGSS

     @author Michael Whitty, ISIS Facility, Rutherford Appleton Laboratory
     @date 01/09/2010
  */
23
class DLLExport LoadGSS : public API::IFileLoader<Kernel::FileDescriptor> {
24
25
public:
  /// Algorithm's name
26
  const std::string name() const override { return "LoadGSS"; }
Zhou, Wenduo's avatar
Zhou, Wenduo committed
27
28

  /// Summary of algorithms purpose
29
  const std::string summary() const override {
30
31
32
33
34
35
    return "Loads a GSS file such as that saved by SaveGSS. This is not a "
           "lossless process, as SaveGSS truncates some data. There is no "
           "instrument assosciated with the resulting workspace.  'Please "
           "Note': Due to limitations of the GSS file format, the process of "
           "going from Mantid to a GSS file and back is not perfect.";
  }
36

37
  /// Algorithm's version
38
  int version() const override { return (1); }
39
  const std::vector<std::string> seeAlso() const override { return {"LoadAscii", "SaveGSS", "LoadMultipleGSS"}; }
Zhou, Wenduo's avatar
Zhou, Wenduo committed
40

41
  /// Algorithm's category for identification
42
  const std::string category() const override { return "Diffraction\\DataHandling;DataHandling\\Text"; }
43

44
  /// Returns a confidence value that this algorithm can load a file
45
  int confidence(Kernel::FileDescriptor &descriptor) const override;
46
47
48

private:
  /// Initialisation code
49
  void init() override;
Zhou, Wenduo's avatar
Zhou, Wenduo committed
50
51

  /// Execution code
52
  void exec() override;
Zhou, Wenduo's avatar
Zhou, Wenduo committed
53
54

  /// Main method to load GSAS
55
  API::MatrixWorkspace_sptr loadGSASFile(const std::string &filename, bool useBankAsSpectrum);
Zhou, Wenduo's avatar
Zhou, Wenduo committed
56
57

  /// Convert a string (value+unit) to double (value)
58
  double convertToDouble(std::string inputstring);
Zhou, Wenduo's avatar
Zhou, Wenduo committed
59
60

  /// Create an instrument geometry.
Danny Hindson's avatar
Danny Hindson committed
61
62
63
64
65
66
67
  void createInstrumentGeometry(const API::MatrixWorkspace_sptr &workspace,
                                const std::string &instrumentname,
                                const double &primaryflightpath,
                                const std::vector<int> &detectorids,
                                const std::vector<double> &totalflightpaths,
                                const std::vector<double> &twothetas,
                                const std::vector<double> &difcs);
68
};
LamarMoore's avatar
LamarMoore committed
69
} // namespace DataHandling
70
} // namespace Mantid