Skip to content
Snippets Groups Projects
Commit b806c1cf authored by Roman Tolchenov's avatar Roman Tolchenov
Browse files

Re #9579. Added Usage section to SaveCSV.

Added a correction to the mantid docs sphinx extension to deal with nonprintable characters in algorithm properties.
parent 7f2986b3
No related branches found
No related tags found
No related merge requests found
......@@ -11,20 +11,20 @@ Description
The format of the saved ascii CSV file for a 1D worksspace consists of
three columns where the numbers of each row are seperated by the
Seperator and each line by the LineSeperator.
Separator and each line by the LineSeparator.
The format of the saved CSV file for a 2D workspace is as follows:
The format of the saved CSV file for a 2D workspace is as follows::
| `` A 0, 200, 400, 600, ..., 50000 ``
| `` 0 10, 4, 234, 35, ..., 32 ``
| `` 1 4, 234, 4, 9, ..., 12 ``
| `` A 0, 100, 200, 300, ..., 25000 ``
| `` 2 34, 0, 0, 0, ..., 23``
A 0, 200, 400, 600, ..., 50000
0 10, 4, 234, 35, ..., 32
1 4, 234, 4, 9, ..., 12
A 0, 100, 200, 300, ..., 25000
2 34, 0, 0, 0, ..., 23
| `` ERRORS``
| `` 0 0.1, 3.4, 2.4, 3.5, ..., 2 ``
| `` 1 3.1, 3.3, 2.5, 3.5, ..., 2 ``
| `` 2 1.1, 3.3, 2.4, 5, ..., 2.4``
ERRORS
0 0.1, 3.4, 2.4, 3.5, ..., 2
1 3.1, 3.3, 2.5, 3.5, ..., 2
2 1.1, 3.3, 2.4, 5, ..., 2.4
where for the matrix above the ERRORS line the first column shows the
content of the numbers on the of the same line; i.e. 'A' is followed by
......@@ -37,4 +37,22 @@ the same x-axis but the third histogram has a different x-axis.
The matrix following the ERRORS line lists the errors as recorded for
each histogram.
Usage
-----
.. testcode::
import os
# Create a file path in the user home directory
filePath = os.path.expanduser('~/SavedCSVFile.csv')
# Create a workspace
ws=CreateSampleWorkspace()
# Save it in Nexus format
SaveCSV(ws,filePath)
.. testcleanup::
os.remove(filePath)
.. categories::
......@@ -140,6 +140,11 @@ class PropertiesDirective(BaseDirective):
# Fall-back default for anything
defaultstr = str(default)
# replace nonprintable characters with their printable
# representations, such as \n, \t, ...
defaultstr = repr(defaultstr)[1:-1]
defaultstr = defaultstr.replace('\\','\\\\')
# Replace the ugly default values with "Optional"
if (defaultstr == "8.9884656743115785e+307") or \
(defaultstr == "1.7976931348623157e+308") or \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment