def testIntegrationWithoutDebyeWallerCorrection(self):
     ws = self._cloneTestWorkspace()
     for i in range(ws.getNumberHistograms()):
         ws.dataY(i).fill(float(i + 1))
         ws.dataE(i).fill(numpy.sqrt(float(i + 1)))
     numBins = ws.blocksize()
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'DebyeWallerCorrection': 'Correction OFF',
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(),
                       ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
     for i in range(outWS.getNumberHistograms()):
         self.assertEquals(outWS.readY(i)[0], float(i + 1) * numBins)
         self.assertAlmostEqual(
             outWS.readE(i)[0], numpy.sqrt(float(i + 1) * numBins))
 def testZeroMasking(self):
     ws = self._cloneTestWorkspace()
     zeroIndices = [5, 23]
     for i in zeroIndices:
         ws.dataY(i).fill(0.)
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(),
                       ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
     spectrumInfo = outWS.spectrumInfo()
     for i in range(outWS.getNumberHistograms()):
         if i in zeroIndices:
             self.assertEquals(outWS.readY(i)[0], 0.)
             self.assertTrue(spectrumInfo.isMasked(i))
         else:
             self.assertGreater(outWS.readY(i)[0], 0.)
             self.assertFalse(spectrumInfo.isMasked(i))
 def testZeroMasking(self):
     ws = self._cloneTestWorkspace()
     zeroIndices = [5, 23]
     for i in zeroIndices:
         ws.dataY(i).fill(0.)
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(), ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
     spectrumInfo = outWS.spectrumInfo()
     for i in range(outWS.getNumberHistograms()):
         if i in zeroIndices:
             self.assertEquals(outWS.readY(i)[0], 0.)
             self.assertTrue(spectrumInfo.isMasked(i))
         else:
             self.assertGreater(outWS.readY(i)[0], 0.)
             self.assertFalse(spectrumInfo.isMasked(i))
Example #4
0
 def _delete(self, ws):
     """Delete the given workspace in ws if it is not protected, and
     deletion is actually turned on.
     """
     if not self._doDelete:
         return
     try:
         ws = str(ws)
     except RuntimeError:
         return
     if ws not in self._protected and mtd.doesExist(ws):
         DeleteWorkspace(Workspace=ws, EnableLogging=self._deleteAlgorithmLogging)
Example #5
0
 def _delete(self, ws):
     """Delete the given workspace in ws if it is not protected, and
     deletion is actually turned on.
     """
     if not self._doDelete:
         return
     try:
         ws = str(ws)
     except RuntimeError:
         return
     if ws not in self._protected and mtd.doesExist(ws):
         DeleteWorkspace(Workspace=ws,
                         EnableLogging=self._deleteAlgorithmLogging)
 def testIntegration(self):
     ws = self._cloneTestWorkspace()
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'DebyeWallerCorrection': 'Correction OFF',
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(), ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
 def testIntegration(self):
     ws = self._cloneTestWorkspace()
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'DebyeWallerCorrection': 'Correction OFF',
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(),
                       ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
 def testIntegrationWithoutDebyeWallerCorrection(self):
     ws = self._cloneTestWorkspace()
     for i in range(ws.getNumberHistograms()):
         ws.dataY(i).fill(float(i + 1))
         ws.dataE(i).fill(numpy.sqrt(float(i + 1)))
     numBins = ws.blocksize()
     eppWSName = 'eppWS'
     self._EPPTable(ws, eppWSName)
     outWSName = 'outWS'
     algProperties = {
         'InputWorkspace': self._TEST_WS_NAME,
         'OutputWorkspace': outWSName,
         'EPPWorkspace': eppWSName,
         'DebyeWallerCorrection': 'Correction OFF',
         'rethrow': True
     }
     run_algorithm('DirectILLIntegrateVanadium', **algProperties)
     self.assertTrue(mtd.doesExist(outWSName))
     outWS = mtd[outWSName]
     self.assertEquals(outWS.getNumberHistograms(), ws.getNumberHistograms())
     self.assertEquals(outWS.blocksize(), 1)
     for i in range(outWS.getNumberHistograms()):
         self.assertEquals(outWS.readY(i)[0], float(i + 1) * numBins)
         self.assertAlmostEqual(outWS.readE(i)[0], numpy.sqrt(float(i + 1) * numBins))