-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArchitecture.html
317 lines (274 loc) · 17.6 KB
/
Architecture.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Architecture</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css?v=fadd4351" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=77160d70" />
<script src="_static/documentation_options.js?v=a8da1a53"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Building on OS X" href="BuildingOnOSX.html" />
<link rel="prev" title="Packaging" href="Packaging.html" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59110517-1', 'auto');
ga('send', 'pageview');
</script>
</head><body>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.mantidproject.org">
</a>
<span class="navbar-text navbar-version pull-left"><b>main</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="index.html">Home</a></li>
<li><a href="https://download.mantidproject.org">Download</a></li>
<li><a href="https://docs.mantidproject.org">User Documentation</a></li>
<li><a href="http://www.mantidproject.org/contact">Contact Us</a></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<p>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html">Documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">Architecture</a></li>
</ul>
</div> </p>
</div>
<div class="container">
<div class="row">
<div class="body col-md-12 content" role="main">
<section id="architecture">
<h1>Architecture<a class="headerlink" href="#architecture" title="Link to this heading">¶</a></h1>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#summary" id="id6">Summary</a></p></li>
<li><p><a class="reference internal" href="#context" id="id7">Context</a></p></li>
<li><p><a class="reference internal" href="#container" id="id8">Container</a></p></li>
<li><p><a class="reference internal" href="#components" id="id9">Components</a></p>
<ul>
<li><p><a class="reference internal" href="#framework" id="id10">Framework</a></p></li>
<li><p><a class="reference internal" href="#mantidqt" id="id11">mantidqt</a></p></li>
<li><p><a class="reference internal" href="#workbench" id="id12">workbench</a></p></li>
</ul>
</li>
</ul>
</nav>
<section id="summary">
<h2><a class="toc-backref" href="#id6" role="doc-backlink">Summary</a><a class="headerlink" href="#summary" title="Link to this heading">¶</a></h2>
<p>Mantid is used for reduction, analysis & visualization of neutron and muon data.
This document describes the architecture of the mantid software in terms
of the <a class="reference external" href="https://www.infoq.com/articles/C4-architecture-model/">C4 model</a>.</p>
</section>
<section id="context">
<h2><a class="toc-backref" href="#id7" role="doc-backlink">Context</a><a class="headerlink" href="#context" title="Link to this heading">¶</a></h2>
<p>People and other systems interact with the Mantid software package
as decribed by the following context diagram.</p>
<figure class="align-center" id="id1">
<img alt="Context diagram of mantid software system" src="_images/architecture-context.png" />
<figcaption>
<p><span class="caption-text">Context diagram for mantid software</span><a class="headerlink" href="#id1" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p>Experimental users at neutron/muon facilities use the software
to reduce/analyze their captured data. Mantid uses existing
experimental data access systems to retrieve users’ data
for processing either</p>
<ul class="simple">
<li><p>interactively via Python scripts or a GUI</p></li>
<li><p>automatically via programmatic access from other systems such as
automated reduction systems.</p></li>
</ul>
</section>
<section id="container">
<h2><a class="toc-backref" href="#id8" role="doc-backlink">Container</a><a class="headerlink" href="#container" title="Link to this heading">¶</a></h2>
<p><em>Please note that container here does not mean container in the
deployment (Docker, Singularity) sense of the word, rather the generic
definition of enclosing something.</em></p>
<p>The mantid software system is defined as four containers:
two libraries (<code class="docutils literal notranslate"><span class="pre">framework</span></code> & <code class="docutils literal notranslate"><span class="pre">mantidqt</span></code>),
one general-purpose, cross-platform, graphical desktop application and
many customized graphical interfaces for specific scientific techniques.
This is illustrated, along with connections between the containers,
in the following diagram.</p>
<figure class="align-center" id="id2">
<a class="reference internal image-reference" href="_images/architecture-container.png"><img alt="Container diagram of mantid software system" src="_images/architecture-container.png" style="width: 918.9px; height: 720.9px;" />
</a>
<figcaption>
<p><span class="caption-text">Container diagram for mantid software</span><a class="headerlink" href="#id2" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p>The <code class="docutils literal notranslate"><span class="pre">workbench</span></code> application is written in Python/Qt that provides access
to the business logic for reducing/analyzing data within the <code class="docutils literal notranslate"><span class="pre">framework</span></code>.
Along with this it provides access to a range of visualization features
defined within the <code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> library - A Python/Qt library of custom
widgets that are composed to form the <code class="docutils literal notranslate"><span class="pre">workbench</span></code> application.
This library is accessible outside of the workbench application to allow
custom applications to be built from the widgets.</p>
<p>Please note the directional aspect of the connection/dependency arrows.
The connections are strictly one way and those earlier in the dependency chain
cannot contain dependencies on those later, e.g.</p>
<ul class="simple">
<li><p>framework <em>does not</em> depend on <code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> or <code class="docutils literal notranslate"><span class="pre">workbench</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> <em>does not</em> depend on <code class="docutils literal notranslate"><span class="pre">workbench</span></code> but does depend on <code class="docutils literal notranslate"><span class="pre">framework</span></code></p></li>
</ul>
</section>
<section id="components">
<h2><a class="toc-backref" href="#id9" role="doc-backlink">Components</a><a class="headerlink" href="#components" title="Link to this heading">¶</a></h2>
<p>The following subsections describe each of the containers within the system
in more detail.</p>
<section id="framework">
<h3><a class="toc-backref" href="#id10" role="doc-backlink">Framework</a><a class="headerlink" href="#framework" title="Link to this heading">¶</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">Framework</span></code> refers to the data structures, algorithms
and supporting modules that live within the <code class="docutils literal notranslate"><span class="pre">Framework</span></code> directory
of the source tree - commonly referred to as “framework code”.
This part of the system is written in C++ and provides the business logic
for reducing and analysing data independent of a graphical environment.
The modules that compose the framework are shown within the following
component diagram.</p>
<figure class="align-center" id="id3">
<a class="reference internal image-reference" href="_images/architecture-framework.png"><img alt="Component diagram of framework container" src="_images/architecture-framework.png" style="width: 1114.35px; height: 672.35px;" />
</a>
<figcaption>
<p><span class="caption-text">Container diagram for mantid framework</span><a class="headerlink" href="#id3" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p>The framework is separated into a base set of libraries that provide that
core functionality e.g.
workspace objects, instrument objects, algorithm interfaces,
along with a set of plugin libraries that are loaded at runtime to register
new capabilities such as algorithms for data treatment.</p>
<p>A Python package to the C++ libraries, called <code class="docutils literal notranslate"><span class="pre">mantid</span></code>, is defined in
<code class="docutils literal notranslate"><span class="pre">Framework/PythonInterface</span></code> and
gives access to the C++-framework code from Python.
The Python package is the primary mode of access to the C++ libraries
for external entities.
Assuming Python paths have been setup correctly, the <code class="docutils literal notranslate"><span class="pre">mantid</span></code> package
is to be treated like any other package and can be used in vanilla
Python or any interactive Python environment,
including <a class="reference external" href="https://jupyter.org/">Jupyter notebooks</a>.</p>
<p>While the C++ API could be used directly by external parties this is
not a supported method of interaction and API stability of the C++
layer is not guaranteed.</p>
</section>
<section id="mantidqt">
<h3><a class="toc-backref" href="#id11" role="doc-backlink">mantidqt</a><a class="headerlink" href="#mantidqt" title="Link to this heading">¶</a></h3>
<figure class="align-center" id="id4">
<a class="reference internal image-reference" href="_images/architecture-mantidqt.png"><img alt="Component diagram of mantidqt container" src="_images/architecture-mantidqt.png" style="width: 893.35px; height: 553.35px;" />
</a>
<figcaption>
<p><span class="caption-text">Container diagram for mantidqt Python package</span><a class="headerlink" href="#id4" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p><code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> is a Python package defined to house a collection of Qt widgets
that sit on top of <code class="docutils literal notranslate"><span class="pre">mantid</span></code> functionality.
They provide a reusable set of widgets that can be used across multiple
interfaces to give a consistent user experience when presenting given
<code class="docutils literal notranslate"><span class="pre">mantid</span></code> functionality to users. One example of such a widget is the
<code class="docutils literal notranslate"><span class="pre">mantidqt.widgets.filefinder</span></code>, which sits on top of the framework
<code class="docutils literal notranslate"><span class="pre">FileFinder</span></code>, and presents GUI elements to pass through and run the
the framework logic.
Providing a reusable widget gives a consistent user experience across
multiple interfaces/applications when displaying <code class="docutils literal notranslate"><span class="pre">mantid</span></code> features to users.</p>
<p>The package contains basic widgets, such as the aforementioned <code class="docutils literal notranslate"><span class="pre">filefinder</span></code>,
but also more advanced widgets such as
<a class="reference external" href="https://docs.mantidproject.org/nightly/workbench/sliceviewer.html#sliceviewer" title="(in MantidProject v6.11)"><span class="xref std std-ref">slice viewer</span></a> and
the OpenGL-based <a class="reference internal" href="InstrumentViewer.html#instrumentviewer"><span class="std std-ref">instrument viewer</span></a>,
which combine many features of the framework together to provide advanced
visualization to users.</p>
<p>The package contains a mixture of C++ and Python code.
It is defined in the <code class="docutils literal notranslate"><span class="pre">qt/python/mantidqt</span></code> directory of the source tree.
Widgets written in C++ use the <a class="reference external" href="https://www.riverbankcomputing.com/static/Docs/sip/">sip</a> system to export the
C++ classes to a Python module.
The raw exported modules are all prefixed with an underscore,
e.g. <code class="docutils literal notranslate"><span class="pre">_common</span></code>,
and classes are pulled into a pure-python module to decouple
the C++ implementations from users.
This allows for flexibility with the layout of the C++ classes/libraries
without impacting users in the future.
Clients of <code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> should never import an underscored module directly.</p>
</section>
<section id="workbench">
<h3><a class="toc-backref" href="#id12" role="doc-backlink">workbench</a><a class="headerlink" href="#workbench" title="Link to this heading">¶</a></h3>
<figure class="align-center" id="id5">
<a class="reference internal image-reference" href="_images/architecture-workbench.png"><img alt="Component diagram of workbench container" src="_images/architecture-workbench.png" style="width: 638.35px; height: 459.84999999999997px;" />
</a>
<figcaption>
<p><span class="caption-text">Container diagram for workbench application</span><a class="headerlink" href="#id5" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p><code class="docutils literal notranslate"><span class="pre">workbench</span></code> is an application written in pure Python in the <code class="docutils literal notranslate"><span class="pre">qt/applications/workbench</span></code>
directory of the source.
It is not intended to be a library imported by others and as such offers
no guarantees of API stability.
It makes heavy use of the <code class="docutils literal notranslate"><span class="pre">mantidqt</span></code> widgets collection and puts them
together to build the application shipped to users as <code class="docutils literal notranslate"><span class="pre">MantidWorkbench</span></code>.
It is intended to be the main graphical interface provided by the project and
allows access to the customized interfaces as described in
<a class="reference internal" href="#container">Container</a>.</p>
<p>The application provides some widgets that are only applicable to itself,
such as the about screen, settings screen and project recovery mechanism that
is specific to workbench.</p>
<p>Plotting within <code class="docutils literal notranslate"><span class="pre">workbench</span></code> uses <a class="reference external" href="https://matplotlib.org/">matplotlib</a>.
The application bundle provides some custom features to step in on the backend,
in <code class="docutils literal notranslate"><span class="pre">workbench.plotting</span></code>, so that figures displayed within workbench offer
a richer experience than a standard matplotlib figure,
e.g. interactive fitting to data within a figure.
The aim of these customizations is to be transparent to a user in terms of the
matplotlib api.
A plotting script should function, without modification,
outside of workbench with the standard matplotlib backends,
including <a class="reference external" href="https://jupyter.org/">Jupyter notebooks</a>,
only differing in how the final figure window is presented.</p>
</section>
</section>
</section>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<ul class="nav navbar-nav" style=" float: right;">
<li>
<a href="Packaging.html" title="Previous Chapter: Packaging"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« Packaging</span>
</a>
</li>
<li>
<a href="BuildingOnOSX.html" title="Next Chapter: Building on OS X"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Building on OS X »</span>
</a>
</li>
<li><a href="#">Back to top</a></li>
</ul>
<p>
</p>
</div>
</footer>
</body>
</html>