Esempio n. 1
0
    def test2(self):
        "multiphonon.getdos"
        from multiphonon.getdos import getDOS

        getDOS(
            os.path.join(datadir, "ARCS_V_annulus.nxs"),
            mt_nxs=os.path.join(datadir, "ARCS_V_annulus.nxs"),
            mt_fraction=0.01,
        )
        return
Esempio n. 2
0
 def test1(self):
     "multiphonon.getdos"
     list(getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs")))
     self.assert_(
         close_hist(
             hh.load('work/final-dos.h5'),
             hh.load(
                 os.path.join(here, 'expected_results',
                              'getdos-test1-final-dos.h5'))))
     return
Esempio n. 3
0
 def test1b(self):
     "multiphonon.getdos: reuse reduction results"
     work = 'work.getdos-reuse-reduction-results'
     if os.path.exists(work):
         import shutil
         shutil.rmtree(work)
     import warnings
     with warnings.catch_warnings(record=True) as ws:
         warnings.simplefilter('always')
         list(
             getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                    workdir=work))
         for w in ws:
             self.assert_('Reusing old reduction' not in str(w))
             continue
     # get dos again, this time we should see a warning
     with warnings.catch_warnings(record=True) as ws:
         warnings.simplefilter('always')
         list(
             getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                    workdir=work))
         warned = False
         for w in ws:
             warned = warned or ('Reusing old reduction' in str(w))
             if warned: break
             continue
         self.assert_(warned)
     # get dos using different settings. should not see warning
     with warnings.catch_warnings(record=True) as ws:
         warnings.simplefilter('always')
         list(
             getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                    Emin=0,
                    workdir=work))
         for w in ws:
             self.assert_('Reusing old reduction' not in str(w))
             continue
         import histogram.hdf as hh
         iqe = hh.load(os.path.join(work, 'iqe.h5'))
         self.assert_(iqe.E[0] == 0.)
     return
Esempio n. 4
0
 def test1a(self):
     "multiphonon.getdos: check energy axis"
     import warnings
     with warnings.catch_warnings(record=True) as w:
         warnings.simplefilter('always')
         for _ in getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                         Emin=-50.5,
                         Emax=80,
                         dE=1.):
             assert len(w) == 1
             assert "Energy axis modified" in str(w[-1].message)
             break
     return
Esempio n. 5
0
 def test3(self):
     "multiphonon.getdos: low T"
     list(
         getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                T=1.5,
                workdir='work-lowT'))
     self.assert_(
         close_hist(
             hh.load('work-lowT/final-dos.h5'),
             hh.load(
                 os.path.join(here, 'expected_results',
                              'getdos-test3-final-dos.h5'))))
     return
Esempio n. 6
0
 def test2(self):
     "multiphonon.getdos: MT can"
     list(
         getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"),
                mt_nxs=os.path.join(datadir, "ARCS_V_annulus.nxs"),
                mt_fraction=0.01,
                workdir='work-MT'))
     self.assert_(
         close_hist(
             hh.load('work-MT/final-dos.h5'),
             hh.load(
                 os.path.join(here, 'expected_results',
                              'getdos-test2-final-dos.h5'))))
     return
Esempio n. 7
0
    def test1(self):
        "multiphonon.getdos"
        from multiphonon.getdos import getDOS

        getDOS(os.path.join(datadir, "ARCS_V_annulus.nxs"))
        return