Density of States Analysis Example

  • Given sample and empty-can data, compute phonon DOS
  • To use this notebook, first click jupyter menu File->Make a copy
  • Click the title of the copied jupyter notebook and change it to a new title
  • Start executing cells

Summary of processing steps

  • Gather experimental information and experimental raw data
  • Reduce raw data to S(Q,E)
  • Convert S(Q,E) to DOS

Preparation

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')

Experimental data and condition

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:

  • samplenxs = "/SNS/ARCS/2014_1_18_CAL/0/47435/NeXus/ARCS_47435_event.nxs"
  • mtnxs = Skip
  • Ei=80
  • T=300

In [ ]:
NxsWizardStart(context).show()

Save configuration so you can reuse it


In [ ]:
context.to_yaml('./getdos2-context.yaml')

Obtain S(Q,E)

S(Q,E) spectra for both the sample and the empty can is the starting point for getdos processing. Here is an example:

Run the following wizard to define the E and Q axes so that S(Q,E) spectra can be obtained the INS raw data.


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')

Run GetDOS

DOS will be obtained from SQE by an iterative procedure where multiphonon and multiple scattering corrections are applied to the measured SQE spectrum, assuming incoherent approximation, and the corrected spectrum is then converted to DOS.

An example DOS plot:


In [ ]:
GetDOSWizStart(context).show()

Save context


In [ ]:
context.to_yaml('./getdos2-context.yaml')

Print context


In [ ]:
print context

Check output

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 [ ]: