Skip to content
Snippets Groups Projects
Commit 1b3261b3 authored by Nick Draper's avatar Nick Draper
Browse files

re #9908 Load IsawPeaks and ConjoinFiles

parent 856b2b51
No related merge requests found
...@@ -12,4 +12,47 @@ Description ...@@ -12,4 +12,47 @@ Description
Conjoin two workspaces, which are file based. Uses Conjoin two workspaces, which are file based. Uses
:ref:`algm-ConjoinWorkspaces` to do the heavy-lifting. :ref:`algm-ConjoinWorkspaces` to do the heavy-lifting.
The files are expected to be in a GSAS format, loadable by LoadGSS, with a .gsa or .txt extension.
.. hint:: The filename is expected to be of the format:
[instrument]_[run_no].[extension]
Usage
-----
**ConjoinFiles Example**
.. testcode:: ConjoinFilesEx
import os
#Create an absolute path by joining the proposed filename to a directory
#os.path.expanduser("~") used in this case returns the home directory of the current user
savePath = os.path.expanduser("~")
ws1Path = os.path.join(savePath, ConfigService.getInstrument().shortName() + "_1234.gsa")
ws2Path = os.path.join(savePath, ConfigService.getInstrument().shortName() + "_4567.gsa")
ws1 = CreateSampleWorkspace(WorkspaceType="Histogram", NumBanks=2, BankPixelWidth=1, BinWidth=10, Xmax=50)
print "Number of spectra in first workspace", ws1.getNumberHistograms()
SaveGSS(ws1, ws1Path, SplitFiles=False, Append=False)
ws2 = CreateSampleWorkspace(WorkspaceType="Histogram", NumBanks=3, BankPixelWidth=1, BinWidth=10, Xmax=50)
print "Number of spectra in second workspace", ws2.getNumberHistograms()
SaveGSS(ws2,ws2Path, SplitFiles=False, Append=False)
wsOutput = ConjoinFiles(RunNumbers=[1234,4567], Directory= savePath)
print "Number of spectra after ConjoinWorkspaces", wsOutput.getNumberHistograms()
os.remove(ws1Path)
os.remove(ws2Path)
Output:
.. testoutput:: ConjoinFilesEx
Number of spectra in first workspace 2
Number of spectra in second workspace 3
Number of spectra after ConjoinWorkspaces 5
.. categories:: .. categories::
...@@ -17,4 +17,22 @@ NOTE: The instrument used is determined by reading the 'Instrument:' and ...@@ -17,4 +17,22 @@ NOTE: The instrument used is determined by reading the 'Instrument:' and
latest `Instrument Definition File <Instrument Definition File>`__ is latest `Instrument Definition File <Instrument Definition File>`__ is
used. used.
Usage
-----
.. include:: ../usagedata-note.txt
**Example**
.. testcode:: LoadIsawPeaksEx
peaks = LoadIsawPeaks('TOPAZ_1204.peaks')
print "Number of peaks entries", peaks.getNumberPeaks()
Output:
.. testoutput:: LoadIsawPeaksEx
Number of peaks entries 36
.. categories:: .. categories::
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