In [1]:
# import some useful utils
%matplotlib notebook
from matplotlib import pyplot as plt
import numpy as np
import histogram.hdf as hh, histogram as H


/home/lj7/anaconda2/envs/dev-mph/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

In [1]:


In [12]:
from __future__ import print_function
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
from IPython.display import display

In [33]:
# Change this line
eventnxs = "/SNS/ARCS/2012_2_18_CAL/0/30585/NeXus/ARCS_30585_event.nxs"

In [34]:
w_Emin = widgets.BoundedFloatText(description="Emin", min=-1000., max=0., value=-70)
w_Emax = widgets.BoundedFloatText(description="Emax", min=0., max=1000., value=70)
w_dE = widgets.BoundedFloatText(description="dE", min=0.01, max=50., value=1.)
w_Qmin = widgets.BoundedFloatText(description="Qmin", min=0, max=5., value=0)
w_Qmax = widgets.BoundedFloatText(description="Qmax", min=5., max=50., value=14.)
w_dQ = widgets.BoundedFloatText(description="dQ", min=0.01, max=5., value=0.1)
w_T = widgets.BoundedFloatText(description="Temperature", min=0.001, max=5000., value=300.)
w_Ecutoff = widgets.BoundedFloatText(description="Max energy of phonons", min=5, max=1000., value=50)
w_ElasticPeakMin = widgets.BoundedFloatText(description="Emin of elastic peak", min=-300., max=-1., value=-20.)
w_ElasticPeakMax = widgets.BoundedFloatText(description="Emax of elastic peak", min=0.2, max=300., value=7.)
w_mass = widgets.BoundedFloatText(description="Average atom mass", min=1., max=300., value=50.94)
w_C_ms = widgets.BoundedFloatText(description="C_ms", min=0., max=10., value=0.3)
w_Ei = widgets.BoundedFloatText(description="Ei", min=1, max=2000., value=116.446)

w_inputs = (
    w_Emin, w_Emax, w_dE,
    w_Qmin, w_Qmax, w_dQ,
    w_T, w_Ecutoff,
    w_ElasticPeakMin, w_ElasticPeakMax,
    w_mass, w_C_ms, w_Ei
)

w_Run = widgets.Button(description="Run")
def submit(b):
    # the getdos function
    from multiphonon import getdos
    getdos.getDOS(
        eventnxs, 
        Emin=w_Emin.value, Emax=w_Emax.value, dE=w_dE.value,
        Qmin=w_Qmin.value, Qmax=w_Qmax.value, dQ=w_dQ.value,
        T=w_T.value, Ecutoff=w_Ecutoff.value, 
        elastic_E_cutoff=(w_ElasticPeakMin.value, w_ElasticPeakMax.value),
        M=w_mass.value,
        C_ms=w_C_ms.value, Ei=w_Ei.value,
        workdir='work')
    return
w_Run.on_click( submit )
w_all = w_inputs + (w_Run,)
display(*w_all)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-34-6520c2c815d5> in submit(b)
     33         M=w_mass.value,
     34         C_ms=w_C_ms.value, Ei=w_Ei.value,
---> 35         workdir='work')
     36     return
     37 w_Run.on_click( submit )

/home/lj7/dv/sns-chops/multiphonon/multiphonon/getdos.py in getDOS(eventnxs, Emin, Emax, dE, Qmin, Qmax, dQ, T, Ecutoff, elastic_E_cutoff, M, C_ms, Ei, workdir)
     15     if os.system(cmd):
     16         raise RuntimeError("%s failed" % cmd)
---> 17     # to DOS
     18     iqehist = hh.load("iqe.h5")
     19     # interpolate data

NameError: global name 'hh' is not defined

In [ ]: