def testSumInQModeProducesDX(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     mtd.add('dirWS', dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.refl_create_beam_position_ws('dirBeamPosWS', dirWS, 0., 128)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS, 'dirBeamPosWS')
     dirFgdWS = illhelpers.refl_sum_foreground('dirFgdWS', 'SumInLambda',
                                               dirWS)
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(reflWS)
     illhelpers.add_slit_configuration_D17(reflWS, 0.03, 0.02)
     illhelpers.refl_rotate_detector(reflWS, 1.5)
     mtd.add('reflWS', reflWS)
     illhelpers.refl_create_beam_position_ws('reflBeamPosWS', reflWS, 1.5,
                                             128)
     reflWS = illhelpers.refl_preprocess('reflWS', reflWS, 'reflBeamPosWS')
     fgdWS = illhelpers.refl_sum_foreground('fgdWS', 'SumInQ', reflWS,
                                            dirFgdWS, dirWS)
     args = {
         'InputWorkspace': fgdWS,
         'OutputWorkspace': 'inQ',
         'DirectForegroundWorkspace': dirFgdWS,
         'GroupingQFraction': 0.2,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLConvertToQ', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEqual(outWS.getNumberHistograms(), 1)
     self.assertTrue(outWS.hasDx(0))
 def testReflectedBeamSumInLambdaNoRotation(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     dirWS = illhelpers.refl_add_two_theta(dirWS, 6.7)
     dirWS = illhelpers.refl_preprocess_lineposition('dirWS', dirWS, 51)
     self.assertEqual(
         dirWS.run().getProperty(common.SampleLogs.TWO_THETA).value, 6.7)
     self.assertEqual(
         dirWS.run().getProperty(common.SampleLogs.LINE_POSITION).value, 51)
     args = {
         'InputWorkspace': dirWS,
         'OutputWorkspace': 'dirForeground',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
     dirForeground = alg.getProperty('OutputWorkspace').value
     self.assertEqual(
         dirForeground.run().getProperty(common.SampleLogs.TWO_THETA).value,
         6.7)
     self.assertEqual(
         dirForeground.run().getProperty(
             common.SampleLogs.LINE_POSITION).value, 51)
     self.assertEqual(dirForeground.spectrumInfo().size(), 1)
     self.assertEqual(dirForeground.spectrumInfo().l2(0),
                      dirWS.spectrumInfo().l2(51))
     self.assertAlmostEquals(dirForeground.spectrumInfo().twoTheta(0) *
                             180. / numpy.pi,
                             8.389135285788196,
                             delta=1.e-15)
示例#3
0
 def testReflectedBeamSumInQExecutes(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(dirWS)
     dirBeamPosWS = illhelpers.refl_create_beam_position_ws('dirBeamPosWS', dirWS, 0., 128)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS, dirBeamPosWS)
     args = {
         'InputWorkspace': dirWS,
         'OutputWorkspace': 'dirForeground',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
     dirForeground = alg.getProperty('OutputWorkspace').value
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.refl_rotate_detector(reflWS, 1.2)
     illhelpers.add_chopper_configuration_D17(reflWS)
     reflBeamPosWS = illhelpers.refl_create_beam_position_ws('reflBeamPosWS', reflWS, 1.2, 128)
     reflWS = illhelpers.refl_preprocess('refWS', reflWS, reflBeamPosWS)
     args = {
         'InputWorkspace': reflWS,
         'OutputWorkspace': 'foreground',
         'DirectForegroundWorkspace': dirForeground,
         'SummationType': 'SumInQ',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
 def testReflectedBeamSumInQExecutes(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.02, 0.03)
     dirBeamPosWS = illhelpers.refl_create_beam_position_ws('dirBeamPosWS', dirWS, 0., 128)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS, dirBeamPosWS)
     args = {
         'InputWorkspace': dirWS,
         'OutputWorkspace': 'dirForeground',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
     dirForeground = alg.getProperty('OutputWorkspace').value
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.refl_rotate_detector(reflWS, 1.2)
     illhelpers.add_chopper_configuration_D17(reflWS)
     illhelpers.add_slit_configuration_D17(reflWS, 0.02, 0.03)
     reflBeamPosWS = illhelpers.refl_create_beam_position_ws('reflBeamPosWS', reflWS, 1.2, 128)
     reflWS = illhelpers.refl_preprocess('refWS', reflWS, reflBeamPosWS)
     args = {
         'InputWorkspace': reflWS,
         'OutputWorkspace': 'foreground',
         'DirectForegroundWorkspace': dirForeground,
         'SummationType': 'SumInQ',
         'DirectBeamWorkspace': dirWS,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
示例#5
0
 def testExecutes(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     mtd.add('dirWS', dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     illhelpers.refl_create_beam_position_ws('dirBeamPosWS', dirWS, 0., 128)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS, 'dirBeamPosWS')
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(reflWS)
     illhelpers.add_slit_configuration_D17(reflWS, 0.03, 0.02)
     illhelpers.refl_rotate_detector(reflWS, 1.5)
     mtd.add('reflWS', reflWS)
     illhelpers.refl_create_beam_position_ws('reflBeamPosWS', reflWS, 1.5,
                                             128)
     reflWS = illhelpers.refl_preprocess('reflWS', reflWS, 'reflBeamPosWS')
     fgdWS = illhelpers.refl_sum_in_lambda('fgdWS', reflWS)
     args = {
         'InputWorkspace': fgdWS,
         'OutputWorkspace': 'inQ',
         'ReflectedBeamWorkspace': reflWS,
         'DirectBeamWorkspace': dirWS,
         'GroupingQFraction': 0.2,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLConvertToQ', **args)
     assertRaisesNothing(self, alg.execute)
 def testSumInQModeProducesDX(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     mtd.add('dirWS', dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.refl_create_beam_position_ws('dirBeamPosWS', dirWS, 0., 128)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS, 'dirBeamPosWS')
     dirFgdWS = illhelpers.refl_sum_foreground('dirFgdWS', 'SumInLambda', dirWS)
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(reflWS)
     illhelpers.add_slit_configuration_D17(reflWS, 0.03, 0.02)
     illhelpers.refl_rotate_detector(reflWS, 1.5)
     mtd.add('reflWS', reflWS)
     illhelpers.refl_create_beam_position_ws('reflBeamPosWS', reflWS, 1.5, 128)
     reflWS = illhelpers.refl_preprocess('reflWS', reflWS, 'reflBeamPosWS')
     fgdWS = illhelpers.refl_sum_foreground('fgdWS', 'SumInQ', reflWS, dirFgdWS, dirWS)
     args = {
         'InputWorkspace': fgdWS,
         'OutputWorkspace': 'inQ',
         'DirectForegroundWorkspace': dirFgdWS,
         'GroupingQFraction': 0.2,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLConvertToQ', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEqual(outWS.getNumberHistograms(), 1)
     self.assertTrue(outWS.hasDx(0))
    def testReflectedBeamSumInLambdaDetectorMovingAndRotation(self):
        dirWS = illhelpers.create_poor_mans_d17_workspace()
        illhelpers.add_chopper_configuration_D17(dirWS)
        illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
        dirWS = illhelpers.refl_add_two_theta(dirWS, 6.7)
        dirWS = illhelpers.refl_preprocess_lineposition('dirWS', dirWS, 50.9)
        self.assertEqual(dirWS.run().getProperty(common.SampleLogs.TWO_THETA).value, 6.7)
        self.assertEqual(dirWS.run().getProperty(common.SampleLogs.LINE_POSITION).value, 50.9)
        args = {
            'InputWorkspace': dirWS,
            'OutputWorkspace': 'dirForeground',
            'rethrow': True,
            'child': True
        }
        alg = create_algorithm('ReflectometryILLSumForeground', **args)
        assertRaisesNothing(self, alg.execute)
        self.assertTrue(alg.isExecuted())
        dirForeground = alg.getProperty('OutputWorkspace').value
        self.assertEqual(dirForeground.run().getProperty(common.SampleLogs.TWO_THETA).value, 6.7)
        self.assertEqual(dirForeground.run().getProperty(common.SampleLogs.LINE_POSITION).value, 50.9)
        self.assertEqual(dirForeground.spectrumInfo().size(), 1)
        self.assertAlmostEqual(dirForeground.spectrumInfo().l2(0), 3.101234371122588, delta=1.e-15)
        self.assertAlmostEqual(numpy.degrees(dirForeground.spectrumInfo().twoTheta(0)), 8.3914043569830, delta=1.e-13)

        reflWS = illhelpers.create_poor_mans_d17_workspace()
        illhelpers.refl_rotate_detector(reflWS, 1.2)
        illhelpers.add_chopper_configuration_D17(reflWS)
        illhelpers.add_slit_configuration_D17(reflWS, 0.03, 0.02)
        reflWS = illhelpers.refl_add_two_theta(reflWS, 40.2)
        reflWS = illhelpers.refl_preprocess_lineposition('refWS', reflWS, 120.4)
        self.assertEqual(reflWS.run().getProperty(common.SampleLogs.TWO_THETA).value, 40.2)
        self.assertEqual(reflWS.run().getProperty(common.SampleLogs.LINE_POSITION).value, 120.4)
        args = {
            'InputWorkspace': reflWS,
            'OutputWorkspace': 'foreground',
            'DirectForegroundWorkspace': dirForeground,
            'SummationType': 'SumInLambda',
            'DirectLineWorkspace': dirWS,
            'rethrow': True,
            'child': True
        }
        alg = create_algorithm('ReflectometryILLSumForeground', **args)
        assertRaisesNothing(self, alg.execute)
        out = alg.getProperty('OutputWorkspace').value
        self.assertEqual(out.run().getProperty(common.SampleLogs.TWO_THETA).value, 40.2)
        self.assertEqual(out.run().getProperty(common.SampleLogs.LINE_POSITION).value, 120.4)
        self.assertEqual(out.spectrumInfo().size(), 1)
        self.assertAlmostEqual(out.spectrumInfo().l2(0), 3.0992766423566, delta=1.e-13)
        self.assertAlmostEqual(numpy.degrees(out.spectrumInfo().twoTheta(0)), 40.3568485178340, delta=1.e-13)
        self.assertTrue(alg.isExecuted())
 def testReflectedBeamSumInLambdaDetectorMovingAndRotationD17(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     dirWS = illhelpers.refl_add_two_theta(dirWS, 6.7)
     dirWS = illhelpers.refl_preprocess_lineposition('dirWS', dirWS, 50.5)
     args = {
         'InputWorkspace': dirWS,
         'OutputWorkspace': 'dirForeground',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
示例#9
0
 def testReflectedBeamSumInLambdaExecutes(self):
     dirWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_chopper_configuration_D17(dirWS)
     illhelpers.add_slit_configuration_D17(dirWS, 0.03, 0.02)
     dirWS = illhelpers.refl_add_line_position(dirWS, 128.0)
     dirWS = illhelpers.refl_add_two_theta(dirWS, 6.7)
     dirWS = illhelpers.refl_preprocess('dirWS', dirWS)
     args = {
         'InputWorkspace': dirWS,
         'OutputWorkspace': 'dirForeground',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())
     dirForeground = alg.getProperty('OutputWorkspace').value
     reflWS = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.refl_rotate_detector(reflWS, 1.2)
     illhelpers.add_chopper_configuration_D17(reflWS)
     illhelpers.add_slit_configuration_D17(reflWS, 0.03, 0.02)
     reflWS = illhelpers.refl_add_line_position(reflWS, 128.0)
     reflWS = illhelpers.refl_add_two_theta(reflWS, 6.7)
     reflWS = illhelpers.refl_preprocess('refWS', reflWS)
     args = {
         'InputWorkspace': reflWS,
         'OutputWorkspace': 'foreground',
         'DirectForegroundWorkspace': dirForeground,
         'SummationType': 'SumInLambda',
         'DirectLineWorkspace': dirWS,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLSumForeground', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(alg.isExecuted())