Commit 86f78cbb authored by Whitfield, Ross's avatar Whitfield, Ross
Browse files

Update autoreduce/reduce_HB2C.py notebooks/Single Crystal Reduction - NaCl.ipynb

parent f9b875c9
......@@ -53,8 +53,8 @@ else: # Single Crystal
+ bc[::4,2::4] + bc[1::4,2::4] + bc[2::4,2::4] + bc[3::4,2::4]
+ bc[::4,3::4] + bc[1::4,3::4] + bc[2::4,3::4] + bc[3::4,3::4])
vanadium = np.load('/HFIR/HB2C/shared/autoreduce/vanadium.npy')
vanadium_mon = 103054259
vanadium = np.load('/HFIR/HB2C/shared/autoreduce/vanadium_101567.npy')
vanadium_mon = 163519902
bc = bc / vanadium * vanadium_mon / mon
f, (ax1, ax2) = plt.subplots(2, figsize=(8,4))
ax1.set_title(u'{}, {}, s2={:.2f}, duration={:.1f}s'.format(title,output_file,offset,duration))
......
%% Cell type:markdown id: tags:
 
# NaCl example
 
%% Cell type:markdown id: tags:
 
#### Import required packages
 
%% Cell type:code id: tags:
 
``` python
%matplotlib inline
from mantid.simpleapi import *
import matplotlib.pyplot as plt
from mantid import plots
```
 
%% Cell type:markdown id: tags:
 
Set a larger default figure size
 
%% Cell type:code id: tags:
 
``` python
plt.rcParams['figure.figsize'] = [15, 12]
```
 
%% Cell type:markdown id: tags:
 
#### Set IPTS number
 
%% Cell type:code id: tags:
 
``` python
ipts = 7776
```
 
%% Cell type:markdown id: tags:
 
#### Load data and vanadium
###### Data is loaded into a MDHistoWorkspace that have dimensions corresponding to x pixels, y pixels and sample rotation
 
%% Cell type:code id: tags:
 
``` python
LoadWANDSCD(IPTS=ipts, RunNumbers=26509, OutputWorkspace='norm',Grouping='4x4') # Vanadium
LoadWANDSCD(IPTS=ipts, RunNumbers='26640-27944', OutputWorkspace='data',Grouping='4x4')
```
 
%% Output
MDHistoWorkspace
Title:
Dim 0: (y) 0.5 to 128.5 in 128 bins
Dim 1: (x) 0.5 to 960.5 in 960 bins
Dim 2: (scanIndex) 0.5 to 1305.5 in 1305 bins
Inelastic: ki-kf
Instrument: WAND (2018-Apr-01 to 2100-Jan-31)Instrument from: /home/rwp/mantid/instrument/WAND_Definition_2018_04_01.xml
Parameters from: /home/rwp/mantid/instrument/WAND_Parameters.xml
Run start: 2018-May-02 13:34:10
Run end: not available
Sample: a 5.6, b 5.6, c 5.6; alpha 90, beta 90, gamma 90
%% Cell type:markdown id: tags:
 
##### Integrate out a slice of data in the y (verticle) pixels. Only 2D can be plotted using `mantid` projections.
 
%% Cell type:code id: tags:
 
``` python
data_slice = IntegrateMDHistoWorkspace('data',P1Bin=[60,69])
```
 
%% Cell type:markdown id: tags:
 
#### plot the data slice
 
%% Cell type:code id: tags:
 
``` python
fig, ax = plt.subplots(subplot_kw={'projection':'mantid'})
c = ax.pcolormesh(data_slice, vmax=10, cmap='viridis')
cbar=fig.colorbar(c)
cbar.set_label('Intensity (arb. units)')
```
 
%% Output