Exemple #1
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 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 test_that_can_add_workspaces_to_WorkspaceGroup_when_in_ADS(self):
        self.create_matrix_workspace_in_ADS("ws1")
        self.create_matrix_workspace_in_ADS("ws2")

        ws_group = WorkspaceGroup()
        mtd.add("group1", ws_group)

        ws_group.add("ws1")
        ws_group.add("ws2")

        self.assertTrue("ws1" in mtd["group1"])
        self.assertTrue("ws2" in mtd["group1"])
    def test_that_can_add_workspaces_to_WorkspaceGroup_when_in_ADS(self):
        self.create_matrix_workspace_in_ADS("ws1")
        self.create_matrix_workspace_in_ADS("ws2")

        ws_group = WorkspaceGroup()
        mtd.add("group1", ws_group)

        ws_group.add("ws1")
        ws_group.add("ws2")

        self.assertTrue("ws1" in mtd["group1"])
        self.assertTrue("ws2" in mtd["group1"])
 def testExecutes(self):
     ws = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_flipper_configuration_D17(ws, 1, 1)
     mtd.add('ws', ws)
     illhelpers.refl_create_beam_position_ws('beamPosWS', ws, 0., 128)
     ws = illhelpers.refl_preprocess('ws', ws, 'beamPosWS')
     ws = illhelpers.refl_sum_foreground('ws', 'SumInLambda', ws)
     args = {
         'InputWorkspaces': 'ws',
         'OutputWorkspace': 'corrected',
         'EfficiencyFile': 'ILL/D17/PolarizationFactors.txt',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPolarizationCor', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(mtd.doesExist('corrected_++'))
 def testExecutes(self):
     ws = illhelpers.create_poor_mans_d17_workspace()
     illhelpers.add_flipper_configuration_D17(ws, 1, 1)
     mtd.add('ws', ws)
     illhelpers.refl_create_beam_position_ws('beamPosWS', ws, 0., 128)
     ws = illhelpers.refl_preprocess('ws', ws, 'beamPosWS')
     ws = illhelpers.refl_sum_foreground('ws', 'SumInLambda', ws)
     args = {
         'InputWorkspaces': 'ws',
         'OutputWorkspace': 'corrected',
         'EfficiencyFile': 'ILL/D17/PolarizationFactors.txt',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPolarizationCor', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(mtd.doesExist('corrected_++'))
    def test_that_instantiated_WorkspaceGroup_can_be_added_to_the_ADS(self):
        ws_group = WorkspaceGroup()
        mtd.add("group1", ws_group)

        self.assertEqual(AnalysisDataService.getObjectNames(), ["group1"])
        self.assertIsInstance(mtd["group1"], WorkspaceGroup)
    def test_that_instantiated_WorkspaceGroup_can_be_added_to_the_ADS(self):
        ws_group = WorkspaceGroup()
        mtd.add("group1", ws_group)

        self.assertEqual(AnalysisDataService.getObjectNames(), ["group1"])
        self.assertIsInstance(mtd["group1"], WorkspaceGroup)