diff --git a/Code/Mantid/docs/source/algorithms/AddPeak-v1.rst b/Code/Mantid/docs/source/algorithms/AddPeak-v1.rst index 78e9c21231de7546f0e055937ca00886c2b53034..f1774a3d93ffa3306ff1a4e808b4a3076dc6ffba 100644 --- a/Code/Mantid/docs/source/algorithms/AddPeak-v1.rst +++ b/Code/Mantid/docs/source/algorithms/AddPeak-v1.rst @@ -9,7 +9,7 @@ Description ----------- -Adds a `IPeak <http://www.mantidproject./IPeak>`__ to a `PeaksWorkspace <http://www.mantidproject.org/PeaksWorkspace>`__. +Adds a peak to a :ref:`PeaksWorkspace <PeaksWorkspace>`. Usage ----- diff --git a/Code/Mantid/docs/source/algorithms/CombinePeaksWorkspaces-v1.rst b/Code/Mantid/docs/source/algorithms/CombinePeaksWorkspaces-v1.rst index c652dbd16b3bcab3d9e20c41f9e460cba5a576ef..413c5ed08d6f0636093c2f51abbb31efe4ff20ca 100644 --- a/Code/Mantid/docs/source/algorithms/CombinePeaksWorkspaces-v1.rst +++ b/Code/Mantid/docs/source/algorithms/CombinePeaksWorkspaces-v1.rst @@ -11,7 +11,7 @@ Description This algorithm can be used to combine lists of single crystal peaks, possibly obtained by different methods, in to a single list (contained -in a `PeaksWorkspace <http://www.mantidproject.org/PeaksWorkspace>`__). +in a :ref:`PeaksWorkspace <PeaksWorkspace>`). With the default options, this will simply append the lists of peaks. If CombineMatchingPeaks is selected then an attempt will be made to identify identical peaks by matching them in Q within diff --git a/Code/Mantid/docs/source/algorithms/FilterPeaks-v1.rst b/Code/Mantid/docs/source/algorithms/FilterPeaks-v1.rst index 994994e985fa9bd2eb014ca855f0d4b3eb46eca8..9dff1994d5dbc30be10b3c1bb4a466a2f5c544fd 100644 --- a/Code/Mantid/docs/source/algorithms/FilterPeaks-v1.rst +++ b/Code/Mantid/docs/source/algorithms/FilterPeaks-v1.rst @@ -9,7 +9,7 @@ Description ----------- -Filters a `PeaksWorkspace <http://www.mantidproject.org/PeaksWorkspace>`__ using a set number of -queries. Outputs a filtered `PeaksWorkspace <http://www.mantidproject.org/PeaksWorkspace>`__. +Filters a :ref:`PeaksWorkspace <PeaksWorkspace>` using a set number of +queries. Outputs a filtered :ref:`PeaksWorkspace <PeaksWorkspace>`. .. categories:: diff --git a/Code/Mantid/docs/source/algorithms/PeakIntensityVsRadius-v1.rst b/Code/Mantid/docs/source/algorithms/PeakIntensityVsRadius-v1.rst index b18a65e4e2702b6f06083ae45e62e337c287abce..c2498ba96a64db5855b5f8f42ad7ce6d69b2f679 100644 --- a/Code/Mantid/docs/source/algorithms/PeakIntensityVsRadius-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PeakIntensityVsRadius-v1.rst @@ -20,7 +20,7 @@ correct integration radius for each peak. The algorithm requires a :ref:`MDWorkspace <MDWorkspace>` of SCD data in reciprocal space; generated by e.g. :ref:`algm-ConvertToDiffractionMDWorkspace`. -Also, you will need a `PeaksWorkspace <http://www.mantidproject.org/PeaksWorkspace>`__ as the list of +Also, you will need a :ref:`PeaksWorkspace <PeaksWorkspace>` as the list of peaks to integrate. This can be generated using :ref:`algm-FindPeaksMD`, for example. diff --git a/Code/Mantid/docs/source/concepts/PeaksWorkspace.rst b/Code/Mantid/docs/source/concepts/PeaksWorkspace.rst new file mode 100644 index 0000000000000000000000000000000000000000..64567623ea48e6c5e64dab089ea4b6e0c148e302 --- /dev/null +++ b/Code/Mantid/docs/source/concepts/PeaksWorkspace.rst @@ -0,0 +1,91 @@ +.. _PeaksWorkspace: + +PeaksWorkspace +============== + +The PeaksWorkspace is a special Workspace that holds a list of single crystal Peak objects. + +Creating a PeaksWorkspace +------------------------- + +* :ref:`FindPeaksMD <algm-FindPeaksMD>` will find peaks in reciprocal space in a [[MDWorkspace]] +* :ref:`FindSXPeaks <algm-FindSXPeaks>` will find peaks in detector space. +* :ref:`PredictPeaks <algm-PredictPeaks>` will predict peak positions in a workspace given a UB matrix. +* The :ref:`LoadIsawPeaks <algm-LoadIsawPeaks>` algorithm will load a PeaksWorkspace from file. +* The :ref:`SaveIsawPeaks <algm-SaveIsawPeaks>` algorithm will save a PeaksWorkspace to a file. +* :ref:`CreatePeaksWorkspace <algm-CreatePeaksWorkspace>` will create an empty PeaksWorkspace that you can then edit. + +Viewing a PeaksWorkspace +------------------------ + +* Double-click a PeaksWorkspace to see the full list of data of each Peak object. +* In MantidPlot, you can drag/drop a PeaksWorkspace from the list of workspaces onto the `Instrument View <http://www.mantidproject.org/MantidPlot:_Instrument_View>`__ . This will overlay the peaks onto the detector face. +* Right-click a PeaksWorkspace and select the menu to show the peak positions in 3D in the `VatesSimpleInterface <http://www.mantidproject.org/VatesSimpleInterface>`__ . +* In paraview, you can load a .Peaks file loader plugin to view a PeaksWorkspace. + +The Peak Object +--------------- + +Each peak object contains several pieces of information. Not all of them are necessary: +* Detector position and wavelength +* Q position (calculated from the detector position/wavelength) +* H K L indices (optional) +* Goniometer rotation matrix (for finding Q in the sample frame) +* Integrated intensity and error (optional) +* Row/column of detector (only for :ref:`RectangularDetectors <RectangularDetector>` ) + +Using PeaksWorkspace's in Python +-------------------------------- + +The PeaksWorkspace and Peak objects are exposed to python. + +PeaksWorkspace Python Interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + pws = mtd['name_of_peaks_workspace'] + pws.getNumberOfPeaks() + p = pws.getPeak(12) + pws.removePeak(34) + +Peak Python Interface +~~~~~~~~~~~~~~~~~~~~~ + +You can get a handle to an existing peak with: + +.. code-block:: python + + p = pws.getPeak(12) + +Or you can create a new peak in this way: + +.. code-block:: python + + qlab = V3D(1.23, 3.45, 2.22) # Q in the lab frame of the peak + detector_distance = 2.5 # sample-detector distance in meters + p = pws.createPeak(qlab, detector_distance) + # The peak can later be added to the workspace + pws.addPeak(p) + +Once you have a handle on a peak ''p'' you have several methods to query/modify its values: + +.. code-block:: python + + hkl = p.getHKL() + p.setHKL(-5, 4, 3) + + q = p.getQSampleFrame() + q = p.getQLabFrame() + detid = p.getDetectorID() + + p.setIntensity(1000.0) + p.setSigmaIntensity(31.6) + counts = p.getIntensity() + + wl = p.getWavelength() + tof = p.getTOF() + d = p.getDSpacing() + + +.. categories:: Concepts \ No newline at end of file diff --git a/Code/Mantid/docs/source/concepts/RectangularDetector.rst b/Code/Mantid/docs/source/concepts/RectangularDetector.rst new file mode 100644 index 0000000000000000000000000000000000000000..99453e3a800eeb976686299007a4bee46ec8f0c3 --- /dev/null +++ b/Code/Mantid/docs/source/concepts/RectangularDetector.rst @@ -0,0 +1,19 @@ +.. _RectangularDetector: + +RectangularDetector +=================== + +The rectangular detector is a detector bank that is marked as being a regular rectangular bank. It is a particular class in Mantid (RectangularDetector). + +In order to be a RectangularDetector, a bank has to have these characteristics: + +- All pixels are the same size and shape (can be any size/shape) +- The pixels are regularly spaced (the X/Y spacing can be different) +- The pixels form a rectangular array (there can be gaps between pixels). + +Several instruments including TOPAZ, PG3 and SNAP instruments use RectangularDetectors. + +See the :ref:`InstrumentDefinitionFile <InstrumentDefinitionFile>` page for instructions on defining a rectangular detector. + + +.. categories:: Concepts \ No newline at end of file diff --git a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py index 2ea892a6147a24ce9a10424b05a112ec7f14afd4..2f9ae52a5f2b02fe7fc9970b0f3a95aae064f78c 100644 --- a/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py +++ b/Code/Mantid/docs/sphinxext/mantiddoc/directives/properties.py @@ -55,12 +55,24 @@ class PropertiesDirective(AlgorithmBaseDirective): # int. direction_string = ["Input", "Output", "InOut", "None"] + #dictionary to convert from property type to link to category page (where possible) + property_type_dict = { + "Workspace":":ref:`Workspace <Workspace>`", + "Workspace2D":":ref:`Workspace2D <Workspace2D>`", + "EventWorkspace":":ref:`EventWorkspace <EventWorkspace>`", + "MatrixWorkspace":":ref:`MatrixWorkspace <MatrixWorkspace>`", + "GroupWorkspace":":ref:`GroupWorkspace <WorkspaceGroup>`", + "MDEventWorkspace":":ref:`MDEventWorkspace <MDWorkspace>`", + "MDHistoWorkspace":":ref:`MDHistoWorkspace <MDHistoWorkspace>`", + "TableWorkspace":":ref:`TableWorkspace <Table Workspaces>`" + } + for prop in alg_properties: # Append a tuple of properties to the list. properties.append(( str(prop.name), str(direction_string[prop.direction]), - str(prop.type), + property_type_dict.get(str(prop.type),str(prop.type)), str(self._get_default_prop(prop)), str(prop.documentation.replace("\n", " ")) ))