Beispiel #1
0
 def test1(self):
     "multiphonon.ms"
     mpsqe = hh.load(os.path.join(datadir, "V-S2..5.h5"))
     mssqe = ms.sqe(mpsqe, Ei=110.)
     if interactive:
         H.plot(mssqe, min=0)
     return
Beispiel #2
0
 def test1(self):
     "multiphonon.ms"
     mpsqe = hh.load(os.path.join(datadir, "V-S2..5.h5"))
     mssqe = ms.sqe(mpsqe, Ei=110.)
     if interactive:
         H.plot(mssqe, min=0)
     return
Beispiel #3
0
def test():
    from histogram import histogram, axis, arange, plot
    xaxis = axis('x', arange(5), unit='meter')
    yaxis = axis('y', arange(7), unit='cm')
    axes = [xaxis, yaxis]
    h = histogram("intensity", axes, fromfunction=lambda x, y: x**2 + y**2)
    print(h)
    plot(h)
    help(h)
    slice = h[3, ()]
    def test1b(self):
        iqehist = hh.load(os.path.join(datadir, "V-iqe.h5"))
        from multiphonon.sqe import interp

        newiqe = interp(iqehist, newE=np.arange(-50, 50, 1.0))
        DOS = sqe2dos.singlephonon_sqe2dos(newiqe, T=300, Ecutoff=65.0, elastic_E_cutoff=(-20.0, 6.7), M=50.94)
        # plot
        if interactive:
            H.plot(DOS)
        return
Beispiel #5
0
def test():
    from histogram import histogram, axis, arange, plot
    xaxis = axis('x', arange(5), unit='meter')
    yaxis = axis('y', arange(7), unit='cm')
    axes = [xaxis, yaxis]
    h = histogram( "intensity", axes, fromfunction=lambda x,y: x**2+y**2)
    print h
    plot(h)
    help(h)
    slice = h[3, ()]
Beispiel #6
0
def plotHistogram(roller):
    cases = list(itertools.islice(newStats(roller), 1000))

    def toBuckets(x):
        "groups into 3 buckets (x <= 8) (8 < x < 13) (x >= 13)"
        if x <= 8:
            return 1
        if x >= 13:
            return 3
        return 2

    histogram.plot(cases)
    histogram.plot([toBuckets(x) for x in cases])
 def test2(self):
     "multiphonon.forward.phonon.sqe: UN N dos"
     E, g= readdos()
     dE = E[1] - E[0]
     #
     from multiphonon.forward.phonon import sqe
     q,e,i = sqe(E, g, T=5, M=14, N=7, Qmax=45.)
     from histogram import plot, histogram
     axes = [('Q', q, 'angstrom**-1'), ('E', e, 'meV')]
     iqe = histogram('iqe', axes, i)
     if interactive:
         plot(iqe)
     return
 def test2(self):
     "multiphonon.sqe: UN N dos"
     dos = readdos()
     E = dos.energy
     dE = E[1] - E[0]
     g = dos.I
     #
     from mccomponents.sample.phonon.multiphonon import sqe
     q, e, i = sqe(E, g, T=5, M=14, N=7, Qmax=45.)
     from histogram import plot, histogram
     axes = [('Q', q, 'angstrom**-1'), ('E', e, 'meV')]
     iqe = histogram('iqe', axes, i)
     plot(iqe)
     return
 def test2(self):
     "multiphonon.sqe: UN N dos"
     dos = readdos()
     E = dos.energy
     dE = E[1] - E[0]
     g = dos.I
     #
     from mccomponents.sample.phonon.multiphonon import sqe
     q,e,i = sqe(E, g, T=5, M=14, N=7, Qmax=45.)
     from histogram import plot, histogram
     axes = [('Q', q, 'angstrom**-1'), ('E', e, 'meV')]
     iqe = histogram('iqe', axes, i)
     plot(iqe)
     return
 def test1b(self):
     "singlephonon_sqe2dos: exp vanadium SQE -> DOS"
     iqehist = hh.load(os.path.join(datadir, "V-iqe.h5"))
     from multiphonon.sqe import interp
     newiqe = interp(iqehist, newE=np.arange(-50, 50, 1.))
     DOS = sqe2dos.singlephonon_sqe2dos(newiqe,
                                        T=300,
                                        Ecutoff=65.,
                                        elastic_E_cutoff=(-20., 6.7),
                                        M=50.94)
     path = os.path.join(here, 'expected_results', 'test1b-dos.h5')
     expected = hh.load(path)
     self.assert_(np.allclose(DOS.I, expected.I))
     self.assert_(np.allclose(DOS.E2, expected.E2))
     # plot
     if interactive:
         H.plot(DOS)
     return