Newer
Older
.. algorithm::
.. summary::
.. alias::
.. properties::
Description
-----------
Conjoin two workspaces, which are file based. Uses
:ref:`algm-ConjoinWorkspaces` to do the heavy-lifting.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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::
.. sourcelink::