Skip to content

Commit

Permalink
Re #9777. Allowing attributes directive to have content.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Jul 1, 2014
1 parent 0f9ab19 commit 0300aac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
12 changes: 4 additions & 8 deletions Code/Mantid/docs/source/fitfunctions/PeakHKLErrors.rst
Expand Up @@ -23,14 +23,10 @@ The PeaksWorkspace is NOT changed.
The argument out in function1D has ,for each peak, the h,k, and l
offsets from an integer using the current parameter values.

.. TODO should be an "attributes" tag here
================= ==== ======= ===================================================================================================
Name Type Default Description
================= ==== ======= ===================================================================================================
OptRuns A list of run numbers whose sample orientations are to be optimized. The list is separated by ``/``
PeakWorkspaceName The name of the PeaksWorkspace in the AnalysisDataService
================= ==== ======= ===================================================================================================
.. attributes::

OptRuns;;;A list of run numbers whose sample orientations are to be optimized. The list is separated by ``/``
PeakWorkspaceName;;;The name of the PeaksWorkspace in the AnalysisDataService

.. properties::

Expand Down
37 changes: 15 additions & 22 deletions Code/Mantid/docs/source/fitfunctions/SCDPanelErrors.rst
Expand Up @@ -39,28 +39,21 @@ follows:
- The theoretical qx,qy,and qz can be obtained by multiplying the hkl
for the peak by this matrix(/2π)

Attributes (non-fitting parameters)
-----------------------------------

.. TODO should be an "attributes" tag here
================= ======= ======= =================================================================================
Name Type Default Description
================= ======= ======= =================================================================================
a The lattice parameter a in Angstroms
b The lattice parameter b in Angstroms
c The lattice parameter c in Angstroms
alpha The lattice parameter alpha in degrees
beta The lattice parameter beta in degrees
gamma The lattice parameter gamma in degrees
PeakWorkspaceName The name of the PeaksWorkspace
NGroups The number of grouping of banks to be considered
BankNames List of banknames to group.
startX -1 or starting position in the workspace to start calculating the outputs
endX -1 or 1+ ending position in the workspace to start calculating the outputs
RotateCenters Boolean If false Rotations are only about the center of the banks.
SampleOffsets Boolean A sample being off from the center of the goniometer can result in larger errors.
================= ======= ======= =================================================================================
.. attributes::

a;;;The lattice parameter a in Angstroms
b;;;The lattice parameter b in Angstroms
c;;;The lattice parameter c in Angstroms
alpha;;;The lattice parameter alpha in degrees
beta;;;The lattice parameter beta in degrees
gamma;;;The lattice parameter gamma in degrees
PeakWorkspaceName;;;The name of the PeaksWorkspace
NGroups;;;The number of grouping of banks to be considered
BankNames;;;List of banknames to group.
startX;;;-1 or starting position in the workspace to start calculating the outputs
endX;;;-1 or 1+ ending position in the workspace to start calculating the outputs
RotateCenters;Boolean;;If false Rotations are only about the center of the banks.
SampleOffsets;Boolean;;A sample being off from the center of the goniometer can result in larger errors.

- PeakWorkspaceName - This peak must be indexed by a UB matrix
whose lattice parametersare CLOSE to the above lattice paramters
Expand Down
18 changes: 16 additions & 2 deletions Code/Mantid/docs/sphinxext/mantiddoc/directives/attributes.py
Expand Up @@ -9,6 +9,7 @@ class AttributesDirective(PropertiesDirective):
"""
# Accept one required argument and no optional arguments.
required_arguments, optional_arguments = 0, 0
has_content = True

def execute(self):
"""
Expand All @@ -20,6 +21,10 @@ def execute(self):
def _create_attributes_table(self):
"""
Populates the ReST table with algorithm properties.
If it is done as a part of a multiline description, each line
will describe a single attribute as a semicolon separated list
Name;Type;Default;Description
"""
if self.algorithm_version() is None: # This is an IFunction
ifunc = self.create_mantid_ifunction(self.algorithm_name())
Expand All @@ -32,8 +37,17 @@ def _create_attributes_table(self):
# names for the table headers.
header = ('Name', 'Type', 'Default', 'Description')

for name in ifunc.attributeNames():
attributes.append((name, "", "", ""))
if len(self.content) > 0:
for line in self.content:
args = tuple(line.split(";"))
args = [item.strip() for item in args]
if len(args) != len(header):
raise RuntimeError("Expected %d items in line '%s'" % (len(header), str(args)))
else:
attributes.append(args)
else:
for name in ifunc.attributeNames():
attributes.append((name, "", "", ""))

self.add_rst(self.make_header("Attributes (non-fitting parameters)"))
else:
Expand Down

0 comments on commit 0300aac

Please sign in to comment.