def runTest(self):
        ws = DirectILLCollectData('ILL/IN6/164192.nxs',
                                  ElasticChannel='Default Elastic Channel',
                                  FlatBkg='Flat Bkg OFF',
                                  Normalisation='Normalisation OFF')
        for i in range(ws.getNumberHistograms()):
            ws.dataY(i).fill(1)
        dE = ConvertUnits(ws, 'DeltaE', 'Direct')
        corr = DetectorEfficiencyCorUser(dE)
        Ei = corr.run().get('Ei').value

        def det_corr(x):
            high = x > 5.113
            low = x <= 5.113
            c = numpy.empty_like(x)
            c[high] = 0.94 * (1. - numpy.exp(-3.284 / numpy.sqrt(x[high])))
            c[low] = numpy.exp(-0.0565 / numpy.sqrt(x[low])) * (
                1. - numpy.exp(-3.284 / numpy.sqrt(x[low])))
            return c

        corr_at_Ei = det_corr(numpy.array([Ei]))[0]
        for i in range(corr.getNumberHistograms()):
            x = (corr.readX(i)[:-1] + corr.readX(i)[1:]) / 2.
            e = Ei - x
            numpy.testing.assert_almost_equal(corr.readY(i),
                                              corr_at_Ei / det_corr(e))
Пример #2
0
    def runTest(self):
        ws = DirectILLCollectData('ILL/IN5/104007.nxs', ElasticChannel='Default Elastic Channel',
                                  FlatBkg='Flat Bkg OFF', Normalisation='Normalisation OFF')
        for i in range(ws.getNumberHistograms()):
            ws.dataY(i).fill(1)
        dE = ConvertUnits(ws, 'DeltaE', 'Direct')
        corr = DetectorEfficiencyCorUser(dE)
        Ei = corr.run().get('Ei').value

        def tube_corr(x):
            return 1. - numpy.exp(-5.6 / numpy.sqrt(x))

        corr_at_Ei = tube_corr(Ei)
        for i in range(corr.getNumberHistograms()):
            x = (corr.readX(i)[:-1] + corr.readX(i)[1:]) / 2.
            e = Ei - x
            assert_almost_equal(corr.readY(i), corr_at_Ei / tube_corr(e))
    def runTest(self):
        ws = DirectILLCollectData('ILL/IN5/104007.nxs', ElasticChannel='Default Elastic Channel',
                                  FlatBkg='Flat Bkg OFF', Normalisation='Normalisation OFF')
        for i in range(ws.getNumberHistograms()):
            ws.dataY(i).fill(1)
        dE = ConvertUnits(ws, 'DeltaE', 'Direct')
        corr = DetectorEfficiencyCorUser(dE)
        Ei = corr.run().get('Ei').value

        def tube_corr(x):
            return 1. - numpy.exp(-5.6 / numpy.sqrt(x))

        corr_at_Ei = tube_corr(Ei)
        for i in range(corr.getNumberHistograms()):
            x = (corr.readX(i)[:-1] + corr.readX(i)[1:]) / 2.
            e = Ei - x
            numpy.testing.assert_almost_equal(corr.readY(i), corr_at_Ei / tube_corr(e))
    def runTest(self):
        ws = DirectILLCollectData('ILL/IN6/164192.nxs', ElasticChannel='Default Elastic Channel',
                                  FlatBkg='Flat Bkg OFF', Normalisation='Normalisation OFF')
        for i in range(ws.getNumberHistograms()):
            ws.dataY(i).fill(1)
        dE = ConvertUnits(ws, 'DeltaE', 'Direct')
        corr = DetectorEfficiencyCorUser(dE)
        Ei = corr.run().get('Ei').value

        def det_corr(x):
            high = x > 5.113
            low = x <= 5.113
            c = numpy.empty_like(x)
            c[high] = 0.94 * (1. - numpy.exp(-3.284/numpy.sqrt(x[high])))
            c[low] = numpy.exp(-0.0565 / numpy.sqrt(x[low])) * (1.- numpy.exp(-3.284 / numpy.sqrt(x[low])))
            return c

        corr_at_Ei = det_corr(numpy.array([Ei]))[0]
        for i in range(corr.getNumberHistograms()):
            x = (corr.readX(i)[:-1] + corr.readX(i)[1:]) / 2.
            e = Ei - x
            numpy.testing.assert_almost_equal(corr.readY(i), corr_at_Ei / det_corr(e))