Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "initial translation using pandoc links need fixing. re …
- Loading branch information
1 parent
2e49944
commit 25c26d1
Showing
44 changed files
with
4,561 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
.. _Algorithm: | ||
|
||
Algorithm | ||
========= | ||
|
||
What are they? | ||
-------------- | ||
|
||
Algorithms are the verbs of Mantid. They are the actors. If you want to | ||
manipulate your data in any way it will be done through an algorithm. | ||
Algorithms operate primarily on data in `workspaces <Workspace>`__. They | ||
will normally take one or more `workspaces <Workspace>`__ as an input, | ||
perform some processing on them and provide an output as another | ||
`workspace <Workspace>`__ (although it is possible to have multiple | ||
outputs). | ||
|
||
Categories, Name and Versions | ||
----------------------------- | ||
|
||
Each algorithm has a category, a name and a version. The name and | ||
version of an algorithm when taken together have to be unique. | ||
|
||
Category | ||
~~~~~~~~ | ||
|
||
A category is a group of algorithms that have some connection in their | ||
usage. This is primarily used to make the list of algorithms easier to | ||
work with in graphical user interfaces. Example categories include, | ||
DataHandling, Diffraction, Muon, Workflow and are currently | ||
subcategories of | ||
`Algorithms <http://docs.mantidproject.org/algorithms>`__ category. | ||
|
||
Name | ||
~~~~ | ||
|
||
The name of an algorithm is what is used to refer to it. This can be | ||
different from the class name in C++, as for example if you had two | ||
versions of the same algorithm they would have the same name, but would | ||
have to have different class names (or at least be in different | ||
namespaces). | ||
|
||
Version | ||
~~~~~~~ | ||
|
||
Mantid allows multiple versions of the same algorithm. These are | ||
differentiated by using a single integer as a version number, where a | ||
higher version number denotes a more recent version. This allows you to | ||
normally use the most recent version of an algorithm but also to access | ||
previous versions if you prefer. | ||
|
||
Parameters | ||
---------- | ||
|
||
Each algorithm will have one or more parameters, known within Mantid as | ||
`properties <properties>`__, that will control how it performs its | ||
processing. These parameters specify both what the inputs and outputs of | ||
the algorithm will be as well any other options that alter the | ||
processing. | ||
|
||
For examples of the parameters of an algorithm, look at the page for one | ||
of the example algorithms below. | ||
|
||
Usage | ||
----- | ||
|
||
From MantidScript(Python) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. raw:: html | ||
|
||
<div style="border:1pt dashed blue; background:#f9f9f9;padding: 1em 0;"> | ||
|
||
.. code:: python | ||
# where p1,p2 & p3 are values for algorithm "Alg"'s properties | ||
mtd.execute("Alg","p1;p2;p3") # using parameter ordinal position | ||
#or | ||
mtd.execute("Alg","Property1=p1;Property2=p2;Property3=p3") #using parameter names | ||
#or | ||
alg = mtd.createAlgorithm("Alg") # explicitly setting each parameter, then executing | ||
alg.setPropertyValue("Property1","p1") | ||
alg.setPropertyValue("Property2","p2") | ||
alg.setPropertyValue("Property3","p3") | ||
alg.execute() | ||
# Properties of Algorithms can be read (but not written to) through a Python dictionary. So you may do: | ||
print alg["Property1"] | ||
# prints 'p1' | ||
print alg["Property2"] | ||
# prints 'p2', etc | ||
.. raw:: html | ||
|
||
</div> | ||
|
||
Using the C++ API | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
(for algorithm "Alg" having properties InputWorkspace, OutputWorkspace & | ||
prop) | ||
|
||
.. raw:: html | ||
|
||
<div style="border:1pt dashed blue; background:#f9f9f9;padding: 1em 0;"> | ||
|
||
.. code:: cpp | ||
// Explicitly setting the parameters and then executing | ||
API::IAlgorithm* alg = API::FrameworkManager::Instance().createAlgorithm("Alg"); | ||
alg->setPropertyValue("InputWorkspace", "InWS"); | ||
alg->setPropertyValue("OutputWorkspace", "OutWS"); | ||
alg->setPropertyValue("prop", "aValue"); | ||
alg->execute(); | ||
API::Workspace* ws = API::FrameworkManager::Instance().getWorkspace("OutWS"); | ||
// Or in one shot | ||
API::FrameworkManager::Instance().exec("Alg","InWS,OutWS,aValue"); | ||
API::Workspace* ws = API::FrameworkManager::Instance().getWorkspace("OutWS"); | ||
.. raw:: html | ||
|
||
</div> | ||
|
||
Example Algorithms | ||
------------------ | ||
|
||
- `Plus <http://docs.mantidproject.org/nightly/algorithms/Plus.html>`__ | ||
- An algorithm for adding data in two `workspaces <Workspace>`__ | ||
together | ||
- `Rebin <http://docs.mantidproject.org/nightly/algorithms/Rebin.html>`__ | ||
- An algorithm for altering the binning of the data in a | ||
`workspace <Workspace>`__. | ||
- `LoadRaw <http://docs.mantidproject.org/nightly/algorithms/LoadRaw.html>`__ | ||
- An algorithm for loading the data from a RAW file into a | ||
`workspace <Workspace>`__. | ||
- `GroupDetectors <http://docs.mantidproject.org/nightly/algorithms/GroupDetectors.html>`__ | ||
- An algorithm for grouping two or more detectors into a larger | ||
'logical' detector. | ||
|
||
A full list of algorithms is avilable | ||
`here <http://docs.mantidproject.org/nightly/algorithms/index.html>`__ | ||
category | ||
|
||
Writing your own algorithm | ||
-------------------------- | ||
|
||
A primer for this is `here <Writing an Algorithm>`__. Also look at the | ||
examples in the `UserAlgorithms <UserAlgorithms>`__ directory of your | ||
Mantid installation. | ||
|
||
|
||
|
||
.. categories:: Concepts |
34 changes: 34 additions & 0 deletions
34
Code/Mantid/docs/source/concepts/Analysis_Data_Service.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. _Analysis Data Service: | ||
|
||
Analysis_Data_Service | ||
===================== | ||
|
||
What is it? | ||
----------- | ||
|
||
The Analysis Data Service is a `Data Service <Data Service>`__ that is | ||
specialized to hold all of the `workspaces <Workspace>`__ that are | ||
created by user run `algorithms <Algorithm>`__. Whenever an algorithm is | ||
executed it automatically extracts its input workspaces from the | ||
Analysis Data Service, and inserts its output workspaces upon | ||
completion. | ||
|
||
Extracting a workspace from the Analysis Data Service | ||
----------------------------------------------------- | ||
|
||
The most usual way in user code would be to use the `Framework | ||
Manager <Framework Manager>`__. | ||
|
||
``Workspace* result = FrameworkManager::Instance().getWorkspace("workspaceName")`` | ||
|
||
Or you could get it directly from the AnalysisDataService (as a `Shared | ||
Pointer <Shared Pointer>`__) | ||
|
||
``Workspace_sptr result = AnalysisDataService::Instance().retrieve("test_out1");`` | ||
|
||
If you were writing an algorithm however you would most likely use a | ||
Workspace `Property <Properties>`__ to access or store your workspaces. | ||
|
||
|
||
|
||
.. categories:: Concepts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. _Data Service: | ||
|
||
Data_Service | ||
============ | ||
|
||
What are they? | ||
-------------- | ||
|
||
Data Services are the internal storage locations within Mantid. Each | ||
data service holds a list of objects that share a common base class (for | ||
example the Instrument Data Service can hold anything which inherits | ||
from instrument). Each item that is held is associated with a name that | ||
uniquely describes the object. This name is them used when the object | ||
needs to be retrieved, or for other operations such as overwriting it or | ||
deleting it. | ||
|
||
Data Services in Mantid | ||
----------------------- | ||
|
||
- `Analysis Data Service <Analysis Data Service>`__ - A data service | ||
holding all of the `workspaces <Workspace>`__ used in this session. | ||
- `Instrument Data Service <Instrument Data Service>`__ - A data | ||
service holding all of the `instruments <Instrument>`__ used in this | ||
session. | ||
|
||
|
||
|
||
.. categories:: Concepts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.. _Dynamic Factory: | ||
|
||
Dynamic_Factory | ||
=============== | ||
|
||
What is it? | ||
----------- | ||
|
||
A dynamic factory is a software concept that in instrumental in | ||
implementing the `Plugin <Plugin>`__ technology in Mantid. | ||
|
||
A factory in software terms is an class that is responsible for creating | ||
other objects on demand. In mantid terms the AlgorithmFactory is | ||
responsible for creating instances of `Algorithms <Algorithm>`__ when | ||
you need them. | ||
|
||
As the factory is dynamic it does not have a set list of objects that it | ||
can create instead it knows how to create instances of a particular base | ||
class. During execution of the code any object of the appropriate base | ||
class can be registered with the factory, and then the factory can be | ||
used to create fresh instances of that object. | ||
|
||
|
||
|
||
.. categories:: Concepts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
.. _Error Propagation: | ||
|
||
Error_Propagation | ||
================= | ||
|
||
The purpose of this document is to explain how Mantid deals with Error | ||
Propogation and how it is used in its algorithms. | ||
|
||
Theory | ||
------ | ||
|
||
In order to deal with error propagation, Mantid treats errors as a | ||
guassian curve (also known as a bell curve or normal curve). Meaning | ||
that if X = 100 +- 1 then it is still possible for a value of 102 to | ||
occur, but far less likely than 101 or 99, then a value of 105 is far | ||
less likely still than 102, and then 110 is simply unheard of. | ||
|
||
This allows Mantid to work with the errors quite simply. | ||
|
||
Plus and Minus Algorithm | ||
------------------------ | ||
|
||
The plus algorithm adds a selection of datasets together, including | ||
their margin of errors. Mantid has to therefore adapt the margin of | ||
error so it continues to work with just one margin of error. The way it | ||
does this is by simply adding together the certain values, for this | ||
example we will use X\ :sub:`1` and X\ :sub:`2`. X\ :sub:`1` = 101 ± 2 | ||
and X\ :sub:`2` = 99 ± 2, Just to make it easier. Mantid takes the | ||
average of the two definite values, 101 and 99. | ||
|
||
X = 200 = (101 + 99). | ||
|
||
The average of the error is calculated by taking the root of the sum of | ||
the squares of the two error margins: | ||
|
||
(√2:sup:`2` + 2\ :sup:`2`) = √8 | ||
|
||
X = 200 ± √8 | ||
|
||
Mantid deals with the minus algorithm similarly, doing the inverse | ||
function of Plus. | ||
|
||
Multiply and Divide Algorithm | ||
----------------------------- | ||
|
||
The Multiply and Divide Algorithm work slightly different from the Plus | ||
and Minus Algorithms, in the sense that they have to be more complex. | ||
|
||
To calculate error propagation, of say X\ :sub:`1` and X\ :sub:`2`. | ||
X\ :sub:`1` = 101 ± 2 and X\ :sub:`2` = 99 ± 2 again, Mantid would | ||
undertake the following calculation for divide: | ||
|
||
Q = X\ :sub:`1`/X:sub:`2` = 101/99 | ||
|
||
Error Propogation = (√ ± 2/99 + ±2/101) All multiplied by Q = 0.22425 | ||
|
||
For the multiply algorithm, the only difference is in how Q is created, | ||
which in turn affects the Error Propogation, | ||
|
||
Q = X\ :sub:`1`\ \*X\ :sub:`2` = 101\*99 | ||
|
||
Error Propogation = (√ ± 2/99 + ±2/101) All multiplied by Q = 0.22425 | ||
|
||
|
||
|
||
.. categories:: Concepts |
Oops, something went wrong.