Skip to content
Snippets Groups Projects
Commit ef0fccd2 authored by WHITFIELDRE email's avatar WHITFIELDRE email
Browse files

Update powder.md

parent 5c7935fd
No related branches found
No related tags found
No related merge requests found
......@@ -4,36 +4,36 @@ title: Powder reduction
category: pages
---
# Loading data
## Loading data
Data is loaded using [LoadEventNexus], the _time-of-flight_ events are integrated out using [Integration] and a mask is added using [MaskDetectors].
## Load in vanadium
### Load in vanadium
{% highlight python linenos %}
van = LoadEventNexus(Filename='/HFIR/HB2C/IPTS-7776/nexus/HB2C_2933.nxs.h5') # Load file
van = Integration(van) # Integrate TOF events
MaskDetectors(van,DetectorList=range(16384)) # Mask bad part of detector
vanadium = LoadEventNexus(Filename='/HFIR/HB2C/IPTS-7776/nexus/HB2C_2933.nxs.h5') # Load file
vanadium = Integration(vanadium) # Integrate TOF events
MaskDetectors(vanadium, DetectorList=range(16384)) # Mask bad part of detector
{% endhighlight %}
Show in instrument view
{% highlight python linenos %}
iv = getInstrumentView('van')
iv = getInstrumentView('vanadium')
iv.setColorMapMaxValue(7500)
iv.show()
render = iv.getTab(InstrumentWidget.RENDER)
render.saveImage("inst_van.png")
{% endhighlight %}
![Van](images/inst_van.png)
![Vanadium](images/inst_van.png)
## Load in powder data, in this case Silicon
### Load in powder data, in this case Silicon
{% highlight python linenos %}
si = LoadEventNexus(Filename='/HFIR/HB2C/IPTS-7776/nexus/HB2C_2929.nxs.h5')
si = Integration(si)
MaskDetectors(si,DetectorList=range(16384))
MaskDetectors(si, DetectorList=range(16384))
{% endhighlight %}
Show in instrument view
......@@ -48,10 +48,10 @@ render.saveImage("inst_si.png")
![Si](images/inst_si.png)
## Normalised data
### Normalised data
{% highlight python linenos %}
norm = si/van
norm = si/vanadium
norm = ReplaceSpecialValues(norm, NaNValue=0, InfinityValue=0)
{% endhighlight %}
......@@ -67,20 +67,20 @@ render.saveImage("inst_si_norm.png")
![Norm](images/inst_si_norm.png)
# Convert units and rebin
## Convert units and rebin
The data is converted into different units using [ConvertSpectrumAxis](http://docs.mantidproject.org/nightly/algorithms/ConvertSpectrumAxis.html), transposed using [Transpose](http://docs.mantidproject.org/nightly/algorithms/Transpose.html) and rebinned using [ResampleX](http://docs.mantidproject.org/nightly/algorithms/ResampleX.html)
## Q-space
### Q-space
{% highlight python linenos %}
van_q=ConvertSpectrumAxis(van, Target='ElasticQ', EFixed='36.9462') # Lambda = 1.488A
van_q=Transpose(van_q)
vanadium_q=ConvertSpectrumAxis(vanadium, Target='ElasticQ', EFixed='36.9462') # Lambda = 1.488A
vanadium_q=Transpose(vanadium_q)
si_q=ConvertSpectrumAxis(si, Target='ElasticQ', EFixed='36.9462') # Lambda = 1.488A
si_q=Transpose(si_q)
van_q2=ResampleX(van_q,XMin=1,XMax=10,NumberBins=1800)
vanadium_q2=ResampleX(vanadium_q,XMin=1,XMax=10,NumberBins=1800)
si_q2=ResampleX(si_q,XMin=1,XMax=10,NumberBins=1800)
q2=si_q2/van_q2
q2=si_q2/vanadium_q2
# Plot the results
p=plotSpectrum('q2',0)
......@@ -90,16 +90,16 @@ p.exportImage('silicon_q.png',50)
![Si_q](images/silicon_q.png)
## D-spacing
### D-spacing
{% highlight python linenos %}
van_d=ConvertSpectrumAxis(van, Target='ElasticDSpacing', EFixed='36.9462') # Lambda = 1.488A
van_d=Transpose(van_d)
vanadium_d=ConvertSpectrumAxis(vanadium, Target='ElasticDSpacing', EFixed='36.9462') # Lambda = 1.488A
vanadium_d=Transpose(vanadium_d)
si_d=ConvertSpectrumAxis(si, Target='ElasticDSpacing', EFixed='36.9462') # Lambda = 1.488A
si_d=Transpose(si_d)
van_d2=ResampleX(van_d,XMin=0.8,XMax=4,NumberBins=3200)
vanadium_d2=ResampleX(vanadium_d,XMin=0.8,XMax=4,NumberBins=3200)
si_d2=ResampleX(si_d,XMin=0.8,XMax=4,NumberBins=3200)
d2=si_d2/van_d2
d2=si_d2/vanadium_d2
# Plot the results
p=plotSpectrum('d2',0)
......@@ -109,16 +109,16 @@ p.exportImage('silicon_d.png',50)
![Si_d](images/silicon_d.png)
## 2θ
###
{% highlight python linenos %}
van_2theta=ConvertSpectrumAxis(van, Target='Theta')
van_2theta=Transpose(van_2theta)
vanadium_2theta=ConvertSpectrumAxis(vanadium, Target='Theta')
vanadium_2theta=Transpose(vanadium_2theta)
si_2theta=ConvertSpectrumAxis(si, Target='Theta')
si_2theta=Transpose(si_2theta)
van_2theta2=ResampleX(van_2theta,XMin=20,XMax=135,NumberBins=2300)
vanadium_2theta2=ResampleX(vanadium_2theta,XMin=20,XMax=135,NumberBins=2300)
si_2theta2=ResampleX(si_2theta,XMin=20,XMax=135,NumberBins=2300)
twotheta2=si_2theta2/van_2theta2
twotheta2=si_2theta2/vanadium_2theta2
# Plot the results
p=plotSpectrum('twotheta2',0)
......@@ -128,7 +128,7 @@ p.exportImage('silicon_2t.png',50)
![Si_2t](images/silicon_2t.png)
# Saving powder data
## Saving powder data
The data can be saved in using [SaveFocusedXYE] or [SaveNexus].
......@@ -158,15 +158,15 @@ $ head Silicon.xye
![Silicon_maud](images/Silicon_maud.png)
# NaCaFAl example
## NaCaFAl example
{% highlight python linenos %}
NCFA = LoadEventNexus(Filename='/HFIR/HB2C/IPTS-7776/nexus/HB2C_2931.nxs.h5')
NCFA = Integration(NCFA)
MaskDetectors(NCFA,DetectorList=range(16384))
NCFA_norm = NCFA/van
NCFA_norm=ReplaceSpecialValues(NCFA_norm, NaNValue=0, InfinityValue=0)
iv = getInstrumentView('NCFA_norm')
NaCaFAl = LoadEventNexus(Filename='/HFIR/HB2C/IPTS-7776/nexus/HB2C_2931.nxs.h5')
NaCaFAl = Integration(NaCaFAl)
MaskDetectors(NaCaFAl, DetectorList=range(16384))
NaCaFAl_norm = NaCaFAl/vanadium
NaCaFAl_norm = ReplaceSpecialValues(NaCaFAl_norm, NaNValue=0, InfinityValue=0)
iv = getInstrumentView('NaCaFAl_norm')
iv.show()
render = iv.getTab(InstrumentWidget.RENDER)
render.saveImage("inst_NaCaFAl.png")
......@@ -175,14 +175,14 @@ render.saveImage("inst_NaCaFAl.png")
![inst_NaCaFAl](images/inst_NaCaFAl.png)
{% highlight python linenos %}
NCFA_2theta=ConvertSpectrumAxis(NCFA, Target='Theta')
NCFA_2theta=Transpose(NCFA_2theta)
NCFA_2theta2=ResampleX(NCFA_2theta,XMin=18,XMax=135,NumberBins=2540)
van_2theta2=ResampleX(van_2theta,XMin=18,XMax=135,NumberBins=2540)
NCFA_twotheta2=NCFA_2theta2/van_2theta2
NaCaFAl_2theta = ConvertSpectrumAxis(NaCaFAl, Target='Theta')
NaCaFAl_2theta = Transpose(NaCaFAl_2theta)
NaCaFAl_2theta2 = ResampleX(NaCaFAl_2theta, XMin=18, XMax=135, NumberBins=2540)
vanadium_2theta2 = ResampleX(vanadium_2theta, XMin=18, XMax=135, NumberBins=2540)
NaCaFAl_twotheta2 = NaCaFAl_2theta2/vanadium_2theta2
# Plot the results
p=plotSpectrum('NCFA_twotheta2',0)
p=plotSpectrum('NaCaFAl_twotheta2', 0)
p.activeLayer().setTitle("NaCaFAl")
p.exportImage('NaCaFAl.png',50)
{% endhighlight %}
......@@ -193,7 +193,7 @@ p.exportImage('NaCaFAl.png',50)
{% highlight python linenos %}
# Save the powder pattern
SaveFocusedXYE('NCFA_twotheta2', 'NaCaAlF.txt', SplitFiles=False, Format='MAUD')
SaveFocusedXYE('NaCaFAl_twotheta2', 'NaCaFAl.txt', SplitFiles=False, Format='MAUD')
{% endhighlight %}
![NaCaFAl_maud](images/NaCaFAl_maud.png)
......
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