Create a new working directory and change into it.
Please modify the following path to suit your need!
In [ ]:
workdir = '/SNS/users/lj7/reduction/ARCS/getdos-demo-test'
!mkdir -p {workdir}
%cd {workdir}
Get tools ready
In [ ]:
import os, numpy as np
import histogram.hdf as hh, histogram as H
from matplotlib import pyplot as plt
%matplotlib notebook
# %matplotlib inline
from multiphonon.sqe import plot as plot_sqe
from multiphonon.ui.getdos import Context, NxsWizardStart, QEGridWizardStart, GetDOSWizStart
Create a context for getdos
In [ ]:
context=Context()
If you want to reuse a previously-saved context, please uncomment the following cell and execute
In [ ]:
# context.from_yaml('./getdos2-context.yaml')
Phonon Density of States (DOS) can be obtained from inelastic neutron scattering (INS) spectrum. This notebook allows for extracting DOS from INS spectrum measured at the ARCS instrument at SNS. To start, we need data files measured for the sample and the empty can, as well as experimental conditions such as incident energy and sample temperature. The following wizard help you go through these steps.
Example datasets:
In [ ]:
NxsWizardStart(context).show()
Save configuration so you can reuse it
In [ ]:
context.to_yaml('./getdos2-context.yaml')
In [ ]:
QEGridWizardStart(context).show()
Parameters are saved in the work dir. Uncomment the script below to see.
In [ ]:
%%script bash
# ls work/
# cat work/raw2iqe-sample.params
Plot sample IQE
In [ ]:
iqe = hh.load('work/iqe.h5')
In [ ]:
plt.figure(figsize=(6,4))
plot_sqe(iqe)
# plt.xlim(0, 11)
plt.clim(0, 1e-2)
You can improve the Q,E grid parameters if you like, by re-executing the above cell of
QEGridWizardStart(context).show()
Plot I(E)
In [ ]:
iqe2 = iqe.copy()
I = iqe2.I; I[I!=I] = 0 # remove NaNs
IE = iqe2.sum('Q') # sum over Q
plt.figure(figsize=(6,4))
plt.plot(IE.energy, IE.I)
The plots above provide clues to selecting parameters for the getdos procedure
Save configuration so you can reuse it
In [ ]:
context.to_yaml('./getdos2-context.yaml')
In [ ]:
GetDOSWizStart(context).show()
Save context
In [ ]:
context.to_yaml('./getdos2-context.yaml')
Print context
In [ ]:
print context
Results are saved in "work" directory
In [ ]:
ls work/
Plot the final result for DOS
In [ ]:
dos = hh.load('work/final-dos.h5')
plt.figure(figsize=(5,3))
plt.plot(dos.E, dos.I)
plt.xlabel('Energy (meV)')
# plt.xlim(0, 30)
More plotting utils are available
In [ ]:
from multiphonon.backward import plotutils as pu
In [ ]:
plt.figure(figsize=(5,3))
pu.plot_dos_iteration('work/')
In [ ]:
plt.figure(figsize=(6,4))
pu.plot_residual('work/')
In [ ]:
plt.figure(figsize=(10, 4))
pu.plot_intermediate_result_se('work/round-3')
In [ ]: