1 | #Fury - version for individual spectra |
---|
2 | import os.path as op |
---|
3 | |
---|
4 | prefix = 'irs' |
---|
5 | ana_dict = {'xtal' : 'PG', 'refl' : '002', 'code' : 1, 'efix' : 0.1} |
---|
6 | prog = 'FURY' |
---|
7 | |
---|
8 | inWS = 'In' |
---|
9 | s_load = LoadNexusProcessedDialog(OutputWorkspace=inWS,Message="Sample file") |
---|
10 | s_path = s_load.getPropertyValue("Filename") |
---|
11 | s_file = op.basename(s_path) |
---|
12 | print 'Sample file : ' + s_file |
---|
13 | tmp = mantid.getMatrixWorkspace(inWS) |
---|
14 | s_hist = tmp.getNumberHistograms() |
---|
15 | e_range = "-0.5,0.005,0.5" |
---|
16 | samWS = 'Sam' |
---|
17 | sqtWS = 'Sqt' |
---|
18 | sam_list = [] |
---|
19 | # loop over all histograms/groups |
---|
20 | for n in range(0, s_hist): |
---|
21 | n1=str(n) |
---|
22 | stmpWS = sqtWS + str(n) |
---|
23 | # get individual group into temp WS |
---|
24 | ExtractSingleSpectrum(inWS,samWS,n1) |
---|
25 | # rebin to constant delta-e |
---|
26 | Rebin(samWS,samWS,e_range) |
---|
27 | # perform FFT |
---|
28 | FFT(samWS, stmpWS) |
---|
29 | # get modulus - index 2 |
---|
30 | ExtractSingleSpectrum(stmpWS,stmpWS,2) |
---|
31 | sam_list.append(stmpWS) |
---|
32 | # if n == 0: |
---|
33 | # for first time, rename tempWS as output WS |
---|
34 | # RenameWorkspace(stmpWS,sqtWS) |
---|
35 | # else: |
---|
36 | # subsequent times, add tempWS to output WS |
---|
37 | # ConjoinWorkspaces(sqtWS,stmpWS) |
---|
38 | s_graph=plotSpectrum(sam_list,0) |
---|
39 | # delete temp WS |
---|
40 | mantid.deleteWorkspace(inWS) |
---|
41 | mantid.deleteWorkspace(samWS) |
---|
42 | |
---|
43 | r_load = LoadNexusProcessedDialog(OutputWorkspace=inWS,Message="Resolution file") |
---|
44 | r_path = r_load.getPropertyValue("Filename") |
---|
45 | r_file = op.basename(r_path) |
---|
46 | print 'Resolution file : ' + r_file |
---|
47 | tmp = mantid.getMatrixWorkspace(inWS) |
---|
48 | r_hist = tmp.getNumberHistograms() |
---|
49 | |
---|
50 | # check that no. groups are the same |
---|
51 | if s_hist == r_hist: |
---|
52 | resWS = 'Res' |
---|
53 | rqtWS = 'Rqt' |
---|
54 | iqtWS = 'Iqt' |
---|
55 | res_list = [] |
---|
56 | iqt_list = [] |
---|
57 | for n in range(0, s_hist): |
---|
58 | n1=str(n) |
---|
59 | rtmpWS = rqtWS + str(n) |
---|
60 | itmpWS = iqtWS + str(n) |
---|
61 | # get individual group into temp WS |
---|
62 | ExtractSingleSpectrum(inWS,resWS,n1) |
---|
63 | # rebin to constant delta-e |
---|
64 | Rebin(resWS,resWS,e_range) |
---|
65 | # perform FFT |
---|
66 | FFT(resWS, rtmpWS) |
---|
67 | # get modulus - index 2 |
---|
68 | ExtractSingleSpectrum(rtmpWS,rtmpWS,2) |
---|
69 | res_list.append(rtmpWS) |
---|
70 | Divide(stmpWS,rtmpWS,itmpWS) |
---|
71 | # if n == 0: |
---|
72 | # for first time, rename tempWS as output WS |
---|
73 | # RenameWorkspace(tmpWS,sqtWS) |
---|
74 | # else: |
---|
75 | # subsequent times, add tempWS to output WS |
---|
76 | # ConjoinWorkspaces(sqtWS,tmpWS) |
---|
77 | r_graph=plotSpectrum(res_list,0) |
---|
78 | |
---|
79 | else: |
---|
80 | # error message |
---|
81 | print 'Vanadium histograms (' +v_hist + ') not = Sample (' + s_hist +')' |
---|
82 | |
---|