Skip to content

Commit

Permalink
Refs #9584 Add examples for SaveGSS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed Jun 9, 2014
1 parent 984c7fe commit 9d72d53
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions Code/Mantid/docs/source/algorithms/SaveGSS-v1.rst
Expand Up @@ -37,4 +37,75 @@ From the GSAS manual a description of the format options:
The format is limited to saving 99 spectra in total. Trying to save more
will generate an error.

Usage
-----
**Example - a basic example using SaveGSS.**

.. testcode:: ExSaveGSSimple

import os

ws = CreateSampleWorkspace()
ws = ExtractSingleSpectrum(ws, WorkspaceIndex=0)
file_name = "myworkspace.ascii"
SaveGSS(ws, file_name)

path = os.path.join(config['defaultsave.directory'], file_name)
print os.path.isfile(path)


Output:

.. testoutput:: ExSaveGSSimple

True

.. testcleanup:: ExSaveGSSimple

import os
def removeFiles(files):
for ws in files:
try:
path = os.path.join(config['defaultsave.directory'], ws)
os.remove(path)
except:
pass

removeFiles(file_name)

**Example - an example using SaveGSS with additonal options.**

.. testcode:: ExSaveGSSOptions

import os

ws = CreateSampleWorkspace()
#GSAS file cannot have more than 99 entries
ws = CropWorkspace(ws, StartWorkspaceIndex=0, EndworkspaceIndex=98)
file_name = "myworkspace.ascii"
SaveGSS(ws, file_name, SplitFiles=False, ExtendedHeader=True, UseSpectrumNumberAsBankID=True)

path = os.path.join(config['defaultsave.directory'], file_name)
print os.path.isfile(path)

Output:

.. testoutput:: ExSaveGSSOptions

True

.. testcleanup:: ExSaveGSSOptions

import os
def removeFiles(files):
for ws in files:
try:
path = os.path.join(config['defaultsave.directory'], ws)
os.remove(path)
except:
pass

removeFiles(file_name)


.. categories::

0 comments on commit 9d72d53

Please sign in to comment.