Mantid
Loading...
Searching...
No Matches
JSONGeometryParserTestHelper.h
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 +
7#pragma once
8
9#ifdef _MSC_VER
10// JSON: non-DLL-interface classkey 'identifier' used as base for
11// DLL-interface classkey 'identifier'
12#pragma warning(disable : 4275)
13#endif
14
15#include <string>
16#include <vector>
17
18namespace Json {
19class Value;
20}
21
22namespace Mantid {
23
24namespace Kernel {
25class V3D;
26}
27
28namespace FrameworkTestHelpers {
29
30namespace JSONTestInstrumentBuilder {
31void initialiseRoot(const Json::Value &root, const std::string &name);
32Json::Value &addNXEntry(Json::Value &root, const std::string &name);
33Json::Value &addNXSample(Json::Value &entry, const std::string &name);
34Json::Value &addNXInstrument(Json::Value &entry, const std::string &name);
35void addNXInstrumentName(Json::Value &instrument, const std::string &name);
36Json::Value &addNXSource(Json::Value &instrument, const std::string &name);
37Json::Value &addNXMonitor(Json::Value &entry, const std::string &name);
38void addNXMonitorName(Json::Value &monitor, const std::string &name);
39void addNXMonitorDetectorID(Json::Value &monitor, const int32_t detectorID);
40void addNXMonitorEventStreamInfo(Json::Value &monitor, const std::string &topic, const std::string &source,
41 const std::string &writerModule);
42void addNXMonitorWaveformStreamInfo(Json::Value &monitor, const std::string &topic, const std::string &source,
43 const std::string &writerModule);
44
45Json::Value &addNXChopper(Json::Value &instrument, const std::string &name);
46void addNXChopperName(Json::Value &chopper, const std::string &chopperName);
47void addNXChopperRadius(Json::Value &chopper, const double radius = 350);
48void addNXChopperSlitEdges(Json::Value &chopper, const std::vector<double> &edges = {0.0, 23.0});
49void addNXChopperSlitHeight(Json::Value &chopper, const double slitHeight = 150);
50void addNXChopperSlits(Json::Value &chopper, const int32_t value);
51void addNXChopperTopDeadCenter(Json::Value &chopper, const std::string &topic, const std::string &source,
52 const std::string &writerModule);
53
54Json::Value &addNXDetector(Json::Value &instrument, const std::string &name);
55void addNXTransformationDependency(Json::Value &nxDetector, const std::string &dependencyPath);
56Json::Value &addNXTransformation(Json::Value &nxDetector, const std::string &name);
57void addNXTransformationBeamDirectionOffset(Json::Value &nxTransformation, const std::vector<int> &arrayShape = {1},
58 const std::vector<double> &values = {0.049},
59 const std::vector<double> &vec = {0, 0, -1});
60
61void addNXTransformationLocation(Json::Value &nxTransformation, const std::vector<int> &arrayShape = {1},
62 const std::vector<double> &values = {0.971},
63 const std::vector<double> &vec = {1, 0, 0});
64
65void addNXTransformationOrientation(Json::Value &nxTransformation, const std::vector<int> &arrayShape = {1},
66 const std::vector<double> &values = {90},
67 const std::vector<double> &vec = {0, 1, 0});
68
69void addDetectorNumbers(Json::Value &nxDetector, const std::vector<int> &arrayShape,
70 const std::vector<int32_t> &values);
71
72void addXPixelOffset(Json::Value &nxDetector, const std::vector<int> &arrayShape, const std::vector<double> &values);
73
74void addYPixelOffset(Json::Value &nxDetector, const std::vector<int> &arrayShape, const std::vector<double> &values);
75
76void addZPixelOffset(Json::Value &nxDetector, const std::vector<int> &arrayShape, const std::vector<double> &values);
77
78Json::Value &addOffShape(Json::Value &nxDetector, const std::string &name = "pixel_shape");
79void addOffShapeFaces(Json::Value &shape, const std::vector<int> &arrayShape = {1},
80 const std::vector<int> &faces = {0});
81void addOffShapeVertices(Json::Value &shape, const std::vector<int> &arrayShape = {4, 3},
82 const std::vector<double> &vertices = {-0.001, -0.001, 0, 0.001, -0.001, 0, 0.001, 0.001, 0,
83 -0.001, 0.001, 0});
84void addOffShapeWindingOrder(Json::Value &shape, const std::vector<int> &arrayShape = {4},
85 const std::vector<int> &windingOrder = {0, 1, 2, 3});
86
87Json::Value &addCylindricalShape(Json::Value &nxDetector, const std::string &name = "pixel_shape");
88void addCylindricalShapeCylinders(Json::Value &shape, const std::vector<int> &arrayShape = {3},
89 const std::vector<int> &indices = {0, 1, 2});
90void addCylindricalShapeVertices(Json::Value &shape, const std::vector<int> &arrayShape = {3, 3},
91 const std::vector<double> &vertices = {-0.001, 0, 0, 0.001, 0.00405, 0, 0.001, 0, 0});
92
93const std::string convertToString(const Json::Value &value);
94} // namespace JSONTestInstrumentBuilder
95
96std::string getJSONGeometryNoSample();
97std::string getJSONGeometryNoInstrument();
98std::string getJSONGeometryNoDetectors();
102std::string getJSONGeometryNoPixelShape();
119
120} // namespace FrameworkTestHelpers
121} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
double radius
Definition: Rasterize.cpp:31
Definition: Algorithm.h:38
void addYPixelOffset(Json::Value &nxDetector, const std::vector< int > &arrayShape, const std::vector< double > &values)
void addNXMonitorName(Json::Value &monitor, const std::string &name)
void addNXInstrumentName(Json::Value &instrument, const std::string &name)
Json::Value & addNXSource(Json::Value &instrument, const std::string &name)
void addNXTransformationDependency(Json::Value &nxDetector, const std::string &dependencyPath)
void addNXMonitorWaveformStreamInfo(Json::Value &monitor, const std::string &topic, const std::string &source, const std::string &writerModule)
Json::Value & addNXTransformation(Json::Value &nxDetector, const std::string &name)
void addOffShapeWindingOrder(Json::Value &shape, const std::vector< int > &arrayShape={4}, const std::vector< int > &windingOrder={0, 1, 2, 3})
void addOffShapeFaces(Json::Value &shape, const std::vector< int > &arrayShape={1}, const std::vector< int > &faces={0})
void addNXChopperSlitEdges(Json::Value &chopper, const std::vector< double > &edges={0.0, 23.0})
void addNXTransformationBeamDirectionOffset(Json::Value &nxTransformation, const std::vector< int > &arrayShape={1}, const std::vector< double > &values={0.049}, const std::vector< double > &vec={0, 0, -1})
Json::Value & addNXDetector(Json::Value &instrument, const std::string &name)
Json::Value & addOffShape(Json::Value &nxDetector, const std::string &name="pixel_shape")
Json::Value & addCylindricalShape(Json::Value &nxDetector, const std::string &name="pixel_shape")
void addOffShapeVertices(Json::Value &shape, const std::vector< int > &arrayShape={4, 3}, const std::vector< double > &vertices={-0.001, -0.001, 0, 0.001, -0.001, 0, 0.001, 0.001, 0, -0.001, 0.001, 0})
void addNXMonitorEventStreamInfo(Json::Value &monitor, const std::string &topic, const std::string &source, const std::string &writerModule)
void addXPixelOffset(Json::Value &nxDetector, const std::vector< int > &arrayShape, const std::vector< double > &values)
Json::Value & addNXInstrument(Json::Value &entry, const std::string &name)
void addNXChopperSlitHeight(Json::Value &chopper, const double slitHeight=150)
void addNXChopperSlits(Json::Value &chopper, const int32_t value)
Json::Value & addNXSample(Json::Value &entry, const std::string &name)
void addDetectorNumbers(Json::Value &nxDetector, const std::vector< int > &arrayShape, const std::vector< int32_t > &values)
void addCylindricalShapeCylinders(Json::Value &shape, const std::vector< int > &arrayShape={3}, const std::vector< int > &indices={0, 1, 2})
Json::Value & addNXMonitor(Json::Value &entry, const std::string &name)
void initialiseRoot(const Json::Value &root, const std::string &name)
void addNXMonitorDetectorID(Json::Value &monitor, const int32_t detectorID)
void addNXTransformationLocation(Json::Value &nxTransformation, const std::vector< int > &arrayShape={1}, const std::vector< double > &values={0.971}, const std::vector< double > &vec={1, 0, 0})
void addNXChopperName(Json::Value &chopper, const std::string &chopperName)
Json::Value & addNXChopper(Json::Value &instrument, const std::string &name)
void addZPixelOffset(Json::Value &nxDetector, const std::vector< int > &arrayShape, const std::vector< double > &values)
void addNXChopperRadius(Json::Value &chopper, const double radius=350)
void addCylindricalShapeVertices(Json::Value &shape, const std::vector< int > &arrayShape={3, 3}, const std::vector< double > &vertices={-0.001, 0, 0, 0.001, 0.00405, 0, 0.001, 0, 0})
Json::Value & addNXEntry(Json::Value &root, const std::string &name)
void addNXChopperTopDeadCenter(Json::Value &chopper, const std::string &topic, const std::string &source, const std::string &writerModule)
void addNXTransformationOrientation(Json::Value &nxTransformation, const std::vector< int > &arrayShape={1}, const std::vector< double > &values={90}, const std::vector< double > &vec={0, 1, 0})
Helper class which provides the Collimation Length for SANS instruments.