コード例 #1
0
 def test_RawCountValidator_construction(self):
     """
         Test that the HistogramValidator can be constructed
         with no args or a single bool
     """
     testhelpers.assertRaisesNothing(self, RawCountValidator)
     testhelpers.assertRaisesNothing(self, RawCountValidator, False)
コード例 #2
0
 def test_plotconstE_nonListArgsExecutes(self):
     kwargs = {
         'workspaces': self._sqw,
         'E' : -1.,
         'dE' : 1.5
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstE, **kwargs)
コード例 #3
0
 def test_properties_obey_attached_validators(self):
     """
         Test property declarations with validator.
         The validators each have their own test.
     """
     class PropertiesWithValidation(PythonAlgorithm):
         
         def PyInit(self):
             only_positive = IntBoundedValidator()
             only_positive.setLower(0)
             self.declareProperty('NumPropWithDefaultDir', -1, only_positive)
             self.declareProperty('NumPropWithInOutDir', -1, only_positive,"doc string", Direction.InOut)
         
         def PyExec(self):
             pass
     ###################################################
     alg = PropertiesWithValidation()
     alg.initialize()
     props = alg.getProperties()
     self.assertEquals(2, len(props))
     
     def_dir = alg.getProperty("NumPropWithDefaultDir")
     self.assertEquals(def_dir.direction, Direction.Input)
     self.assertNotEquals("", def_dir.isValid)
     self.assertRaises(ValueError, alg.setProperty, "NumPropWithDefaultDir", -10)
     testhelpers.assertRaisesNothing(self, alg.setProperty, "NumPropWithDefaultDir", 11)
コード例 #4
0
 def test_WorkspaceUnitValidator_construction(self):
     """
         Test that the WorkspaceUnitValidator can be constructed
         with a single string
     """
     testhelpers.assertRaisesNothing(self, WorkspaceUnitValidator,"DeltaE")
     self.assertRaises(Exception, WorkspaceUnitValidator)
コード例 #5
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))
コード例 #6
0
 def test_NumericAxisValidator_construction(self):
     """
         Test that the NumericAxis can be constructed
         with no args or a single integer
     """
     testhelpers.assertRaisesNothing(self, NumericAxisValidator)
     testhelpers.assertRaisesNothing(self, NumericAxisValidator, 0)
コード例 #7
0
 def testWaterWorkspace(self):
     inWSName = 'ReflectometryILLPreprocess_test_ws'
     self.create_sample_workspace(inWSName)
     # Add a peak to the sample workspace.
     ws = mtd[inWSName]
     for i in range(ws.getNumberHistograms()):
         ys = ws.dataY(i)
         ys.fill(10.27)
     args = {
         'InputWorkspace': inWSName,
         'OutputWorkspace': 'unused_for_child',
         'WaterWorkspace': inWSName,
         'FluxNormalisation': 'Normalisation OFF',
         'FlatBackground': 'Background OFF',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPreprocess', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEquals(outWS.getNumberHistograms(), 100)
     ysSize = outWS.blocksize()
     for i in range(outWS.getNumberHistograms()):
         ys = outWS.readY(i)
         numpy.testing.assert_equal(ys, [1.0] * ysSize)
     self.assertEquals(mtd.getObjectNames(), ['ReflectometryILLPreprocess_test_ws'])
コード例 #8
0
 def test_clear_functions_do_not_throw(self):
     # Test they don't throw for now
     testhelpers.assertRaisesNothing(self, FrameworkManager.clear)
     testhelpers.assertRaisesNothing(self, FrameworkManager.clearData)
     testhelpers.assertRaisesNothing(self, FrameworkManager.clearAlgorithms)
     testhelpers.assertRaisesNothing(self, FrameworkManager.clearInstruments)
     testhelpers.assertRaisesNothing(self, FrameworkManager.clearPropertyManagers)
コード例 #9
0
 def testForegroundBackgroundRanges(self):
     inWSName = 'ReflectometryILLPreprocess_test_ws'
     self.create_sample_workspace(inWSName)
     ws = mtd[inWSName]
     # Add special background fitting zones around the exclude zones.
     lowerBkgIndices = [26]
     for i in lowerBkgIndices:
         ys = ws.dataY(i)
         ys += 5.0
     # Add negative 'exclude zone' around the peak.
     lowerExclusionIndices = [27, 28]
     for i in lowerExclusionIndices:
         ys = ws.dataY(i)
         ys -= 1000.0
     # Add a peak to the sample workspace.
     foregroundIndices = [29, 30, 31]
     for i in foregroundIndices:
         ys = ws.dataY(i)
         ys += 1000.0
     # The second exclusion zone is wider.
     upperExclusionIndices = [32, 33, 34]
     for i in upperExclusionIndices:
         ys = ws.dataY(i)
         ys -= 1000.0
     # The second fitting zone is wider.
     upperBkgIndices = [35, 36]
     for i in upperBkgIndices:
         ys = ws.dataY(i)
         ys += 5.0
     args = {
         'InputWorkspace': inWSName,
         'OutputWorkspace': 'unused_for_child',
         'BeamCentre': 30,
         'ForegroundHalfWidth': [1],
         'LowAngleBkgOffset': len(lowerExclusionIndices),
         'LowAngleBkgWidth': len(lowerBkgIndices),
         'HighAngleBkgOffset': len(upperExclusionIndices),
         'HighAngleBkgWidth': len(upperBkgIndices),
         'FluxNormalisation': 'Normalisation OFF',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPreprocess', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEquals(outWS.getNumberHistograms(), 100)
     for i in range(outWS.getNumberHistograms()):
         ys = outWS.readY(i)
         if i in lowerBkgIndices:
             numpy.testing.assert_equal(ys, 0)
         elif i in lowerExclusionIndices:
             numpy.testing.assert_equal(ys, -1005)
         elif i in foregroundIndices:
             numpy.testing.assert_equal(ys, 995)
         elif i in upperExclusionIndices:
             numpy.testing.assert_equal(ys, -1005)
         elif i in upperBkgIndices:
             numpy.testing.assert_equal(ys, 0)
         else:
             numpy.testing.assert_equal(ys, -5)
コード例 #10
0
 def testAsymmetricForegroundRanges(self):
     inWSName = 'ReflectometryILLPreprocess_test_ws'
     self.create_sample_workspace(inWSName)
     ws = mtd[inWSName]
     # Add special background fitting zones around the exclude zones.
     foregroundIndices = [21, 22, 23, 24]
     for i in range(ws.getNumberHistograms()):
         ys = ws.dataY(i)
         es = ws.dataE(i)
         if i in foregroundIndices:
             ys.fill(1000.0)
             es.fill(numpy.sqrt(1000.0))
         else:
             ys.fill(-100)
             es.fill(numpy.sqrt(100))
     args = {
         'InputWorkspace': inWSName,
         'OutputWorkspace': 'unused_for_child',
         'BeamCentre': 23,
         'ForegroundHalfWidth': [2, 1],
         'FlatBackground': 'Background OFF',
         'FluxNormalisation': 'Normalisation OFF',
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPreprocess', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEquals(outWS.getNumberHistograms(), 100)
     logs = outWS.run()
     properties = ['foreground.first_workspace_index', 'foreground.centre_workspace_index', 'foreground.last_workspace_index']
     values = [21, 23, 24]
     for p, val in zip(properties, values):
         self.assertTrue(logs.hasProperty(p))
         self.assertEqual(logs.getProperty(p).value, val)
コード例 #11
0
 def test_MDFrameValidator_construction(self):
     """
         Test that the MDFrameValidator can be constructed
         with a single string
     """
     testhelpers.assertRaisesNothing(self, MDFrameValidator, "HKL")
     self.assertRaises(Exception, MDFrameValidator)
コード例 #12
0
 def _backgroundSubtraction(self, subtractionType):
     inWSName = 'ReflectometryILLPreprocess_test_ws'
     self.create_sample_workspace(inWSName)
     # Add a peak to the sample workspace.
     ws = mtd[inWSName]
     ys = ws.dataY(49)
     ys += 10.0
     args = {
         'InputWorkspace': inWSName,
         'OutputWorkspace': 'unused_for_child',
         'LinePosition': 49,
         'FluxNormalisation': 'Normalisation OFF',
         'FlatBackground': subtractionType,
         'rethrow': True,
         'child': True
     }
     alg = create_algorithm('ReflectometryILLPreprocess', **args)
     assertRaisesNothing(self, alg.execute)
     outWS = alg.getProperty('OutputWorkspace').value
     self.assertEquals(outWS.getNumberHistograms(), 100)
     ysSize = outWS.blocksize()
     for i in range(outWS.getNumberHistograms()):
         ys = outWS.readY(i)
         if i != 49:
             numpy.testing.assert_almost_equal(ys, [0.0] * ysSize)
         else:
             numpy.testing.assert_almost_equal(ys, [10.0] * ysSize)
     self.assertEquals(mtd.getObjectNames(), ['ReflectometryILLPreprocess_test_ws'])
コード例 #13
0
    def test_that_script_is_executable_in_mantid(self):
        # data files are here
        self.scriptElement.dataDir  = ''

        # vanadium runs & comment
        self.scriptElement.vanRuns  = 'TOFTOFTestdata.nxs'

        # empty can runs, comment, and factor
        self.scriptElement.ecRuns   = 'TOFTOFTestdata.nxs'
        self.scriptElement.ecTemp   = OptionalFloat(21.0)
        self.scriptElement.ecFactor = 0.9

        # data runs: [(runs,comment, temperature), ...]
        self.scriptElement.dataRuns = [
            [unicode('TOFTOFTestdata.nxs'), unicode('H2O 21C'), OptionalFloat(None)],
            [unicode('TOFTOFTestdata.nxs'), unicode('H2O 34C'), OptionalFloat(34.0)]
        ]

        self.scriptElement.maskDetectors = '1,2'

        # options
        self.scriptElement.subtractECVan = True
        self.scriptElement.normalise     = TOFTOFScriptElement.NORM_MONITOR
        self.scriptElement.correctTof    = TOFTOFScriptElement.CORR_TOF_VAN
        self.scriptElement.replaceNaNs   = True
        self.scriptElement.createDiff    = True
        self.scriptElement.keepSteps     = True

        testhelpers.assertRaisesNothing(self, self.execScript, 
                                        self.scriptElement.to_script().replace('import matplotlib.pyplot as plt', ''))
コード例 #14
0
 def test_plotconstQ_titles(self):
     kwargs = {
         'workspaces': self._sqw,
         'Q' : 1.9,
         'dQ' : 0.2,
     }
     figure, axes, cuts = testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
     titleLines = axes.get_title().split('\n')
     self.assertEquals(len(titleLines), 4)
     kwargs = {
         'workspaces': self._sqw,
         'Q' : [0.9, 1.9],
         'dQ' : 0.2,
     }
     figure, axes, cuts = testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
     titleLines = axes.get_title().split('\n')
     self.assertEquals(len(titleLines), 3)
     kwargs = {
         'workspaces': [self._sqw, self._sqw],
         'Q' : 0.9,
         'dQ' : 0.2,
     }
     figure, axes, cuts = testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
     titleLines = axes.get_title().split('\n')
     self.assertEquals(len(titleLines), 2)
     kwargs = {
         'workspaces': [self._sqw, self._sqw],
         'Q' : [0.9, 1.9],
         'dQ' : 0.2,
     }
     figure, axes, cuts = testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
     titleLines = axes.get_title().split('\n')
     self.assertEquals(len(titleLines), 1)
コード例 #15
0
 def test_attributes(self):
     testhelpers.assertRaisesNothing(self, FunctionWrapper, "Polynomial", attributes={'n': 3}, A0=4, A1=3, A2=2, A3=1)
     testhelpers.assertRaisesNothing(self, FunctionWrapper, "Polynomial", n=3, A0=4, A1=3, A2=2, A3=1)
     p = Polynomial(n=3, A0=1, A1=2, A2=4, A3=3)
     self.assertEqual(p['n'],3)
     p['n'] = 4
     self.assertEqual(p['n'],4)
コード例 #16
0
 def test_alg_with_overridden_attrs(self):
     testhelpers.assertRaisesNothing(self,AlgorithmManager.createUnmanaged, "TestPyAlgOverriddenAttrs")
     alg = AlgorithmManager.createUnmanaged("TestPyAlgOverriddenAttrs")
     self.assertEquals(alg.name(), "TestPyAlgOverriddenAttrs")
     self.assertEquals(alg.version(), 2)
     self.assertEquals(alg.category(), "BestAlgorithms")
     self.assertEquals(alg.helpURL(), "Optional documentation URL")
コード例 #17
0
 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())
コード例 #18
0
 def test_plotconstQ_nonListArgsExecutes(self):
     kwargs = {
         'workspaces': self._sqw,
         'Q' : 2.3,
         'dQ' : 0.3
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #19
0
 def test_plotconstQ_QListExecutes(self):
     kwargs = {
         'workspaces': self._sqw,
         'Q' : [1.8, 3.1],
         'dQ' : 0.32,
         'style' : 'm'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #20
0
 def test_plotconstQ_nonListArgsExecutes(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {
         'workspaces': ws,
         'Q' : 523.,
         'dQ' : 42.
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #21
0
 def test_alg_with_default_attrs(self):
     testhelpers.assertRaisesNothing(self,AlgorithmManager.createUnmanaged, "TestPyAlgDefaultAttrs")
     alg = AlgorithmManager.createUnmanaged("TestPyAlgDefaultAttrs")
     testhelpers.assertRaisesNothing(self,alg.initialize)
    
     self.assertEquals(alg.name(), "TestPyAlgDefaultAttrs")
     self.assertEquals(alg.version(), 1)
     self.assertEquals(alg.category(), "PythonAlgorithms")
コード例 #22
0
 def test_plotconstQ_wsListExecutes(self):
     kwargs = {
         'workspaces': [self._sqw, self._sqw],
         'Q' : 2.4,
         'dQ' : 0.42,
         'style' : 'l'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #23
0
 def test_plotconstQ_dQListExecutes(self):
     kwargs = {
         'workspaces': self._sqw,
         'Q' : 1.9,
         'dQ' : [0.2, 0.4],
         'style' : 'ml'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #24
0
 def _assert_run_algorithm_succeeds(self, args, expected):
     """Run the algorithm with the given args and check it succeeds, 
     and that the additional workspaces produced match the expected list.
     Clear these additional workspaces from the ADS"""
     alg = create_algorithm('ReflectometryISISLoadAndProcess', **args)
     assertRaisesNothing(self, alg.execute)
     actual = mtd.getObjectNames()
     self.assertEquals(set(actual), set(expected))
コード例 #25
0
 def test_plotconstE_wsListExecutes(self):
     kwargs = {
         'workspaces': [self._sqw, self._sqw],
         'E' : -2.,
         'dE' : 1.5,
         'style' : 'l'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstE, **kwargs)
コード例 #26
0
 def test_plotconstE_dEListExecutes(self):
     kwargs = {
         'workspaces': self._sqw,
         'E' : 3.,
         'dE' : [1.5, 15.],
         'style' : 'lm'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstE, **kwargs)
コード例 #27
0
 def test_multidomainfunction_creation(self):
     g0 = FunctionWrapper( "Gaussian", Height=7.5, Sigma=1.2, PeakCentre=10)
     g1 = FunctionWrapper( "Gaussian", Height=8.5, Sigma=1.2, PeakCentre=11)
     testhelpers.assertRaisesNothing(self, MultiDomainFunctionWrapper, g0, g1)
     m = MultiDomainFunctionWrapper( g0, g1, Global=["Height"])
     self.assertEqual( m.nDomains, 2)
     m_str = str(m)
     self.assertEqual( m_str.count("ties"),1)
     self.assertEqual( m_str.count("Height"),4) # 2 in functions 2 in ties
コード例 #28
0
 def test_Validator_on_ArrayProperty_accepts_array_with_length_in_range(self):
     alg = self._create_alg_with_range_validator(3,5)
     input_vals = []
     for i in range(1,7):
         input_vals.append(float(1))
         if i < 3 or i > 5:
             self.assertRaises(ValueError, alg.setProperty, "Input", input_vals)
         else:
             testhelpers.assertRaisesNothing(self, alg.setProperty, "Input", input_vals)
コード例 #29
0
 def test_plotconstQ_dQListExecutes(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {
         'workspaces': ws,
         'Q' : 523.,
         'dQ' : [17., 2.],
         'style' : 'ml'
     }
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #30
0
ファイル: UnitCellTest.py プロジェクト: AlistairMills/mantid
 def test_numpy_array_conversion(self):
     row0 = (0.162546756312, 0.00815256992072, -0.00145274558861)
     row1 = (row0[1], 0.028262965555, 0.00102046431298)
     row2 = (row0[2], row1[2], 0.0156808990098 )
     gstar = np.array( [row0,row1,row2] )
     
     u = UnitCell()
     testhelpers.assertRaisesNothing(self, u.recalculateFromGstar, gstar)
     self._check_cell(u)
コード例 #31
0
 def test_plotconstE_dEListExecutes(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {'workspaces': ws, 'E': 13., 'dE': [1.5, 15.], 'style': 'lm'}
     testhelpers.assertRaisesNothing(self, directtools.plotconstE, **kwargs)
コード例 #32
0
 def test_that_FittingMode_has_been_exported_to_python_correctly(self):
     assertRaisesNothing(self, self._create_sequential_fitting_mode)
     assertRaisesNothing(self, self._create_simultaneous_fitting_mode)
     assertRaisesNothing(
         self, self._create_sequential_and_simultaneous_fitting_mode)
コード例 #33
0
 def test_construction_does_not_raise_error_when_both_are_ints(self):
     testhelpers.assertRaisesNothing(self, IntBoundedValidator, 1, 20)
コード例 #34
0
 def test_setting_log_channel_levels(self):
     testhelpers.assertRaisesNothing(self, config.setLogLevel, 4, True)
コード例 #35
0
 def test_wsreport(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {'workspace': ws}
     testhelpers.assertRaisesNothing(self, directtools.wsreport, **kwargs)
コード例 #36
0
 def test_plotSofQW(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {'workspace': 'ws'}
     testhelpers.assertRaisesNothing(self, directtools.plotSofQW, **kwargs)
     kwargs = {'workspace': ws}
     testhelpers.assertRaisesNothing(self, directtools.plotSofQW, **kwargs)
コード例 #37
0
 def test_Validator_on_ArrayProperty_accepts_array_of_specified_length(self):
     fixedlength = 6
     alg = self._create_alg_with_fixedlength_validator(fixedlength)
     input_vals = [1.,2.4,5.6,8.0,4.6,6.]
     testhelpers.assertRaisesNothing(self, alg.setProperty, "Input", input_vals)
コード例 #38
0
 def test_minimal_positional_arguments_with_functionwrapper_work(self):
     if platform.system() == 'Darwin':  # crashes
         return
     fb = FunctionWrapper("FlatBackground")
     testhelpers.assertRaisesNothing(self, Fit, fb, self._raw_ws)
コード例 #39
0
 def test_InstrumentValidator_construction(self):
     """
         Test that the InstrumentValidator can be constructed
         with no args
     """
     testhelpers.assertRaisesNothing(self, InstrumentValidator)
コード例 #40
0
 def test_minimal_positional_arguments_work(self):
     if platform.system() == 'Darwin':  # crashes
         return
     testhelpers.assertRaisesNothing(self, Fit, "name=FlatBackground",
                                     self._raw_ws)
コード例 #41
0
 def test_OrientedLatticeValidator_construction(self):
     """
         Test that the OrientedLatticeValidator can be constructed
         with no args
     """
     testhelpers.assertRaisesNothing(self, OrientedLatticeValidator)
コード例 #42
0
 def test_construction_does_not_raise_error_when_both_are_floats(self):
     testhelpers.assertRaisesNothing(self, FloatBoundedValidator, 1.0, 2.0)
コード例 #43
0
 def test_plotconstQ_nonListArgsExecutes(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {'workspaces': ws, 'Q': 523., 'dQ': 42.}
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #44
0
 def test_initialization_does_not_raise(self):
     assertRaisesNothing(self, self._create_widget)
コード例 #45
0
 def test_plotconstQ_dQListExecutes(self):
     ws = LoadILLTOF('ILL/IN4/084446.nxs')
     kwargs = {'workspaces': ws, 'Q': 523., 'dQ': [17., 2.], 'style': 'ml'}
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #46
0
 def test_convolution_creation(self):
     g0 = FunctionWrapper("Gaussian", Height=7.5, Sigma=1.2, PeakCentre=10)
     g1 = FunctionWrapper("Gaussian", Height=8.5, Sigma=1.2, PeakCentre=11)
     testhelpers.assertRaisesNothing(self, ConvolutionWrapper, g0, g1)
コード例 #47
0
 def test_subplots(self):
     testhelpers.assertRaisesNothing(self, directtools.subplots)
コード例 #48
0
 def test_values_within_array_bounds_are_accepted_by_validator(self):
     alg = self._create_alg_with_ArrayBoundedValidator(5.1, 10.4)
     input_vals = [5.1, 5.6, 10.4, 9.2]
     testhelpers.assertRaisesNothing(self, alg.setProperty, "Input",
                                     input_vals)
コード例 #49
0
 def test_algorithm_subscription_with_valid_object_succeeds(self):
     testhelpers.assertRaisesNothing(self, AlgorithmFactory.subscribe,
                                     IsAnAlgorithm)
コード例 #50
0
 def _assert_run_algorithm_succeeds(self, args):
     """ Run the algorithm with the given args and check it succeeds """
     alg = create_algorithm('ReflectometryBackgroundSubtraction', **args)
     assertRaisesNothing(self, alg.execute)
     self.assertTrue(mtd.doesExist('output'))
     return mtd['output']
コード例 #51
0
 def test_no_error_when_zero_proton_charge(self):
     """
     Run focusing on one bank but on a ws with no proton charge
     """
     assertRaisesNothing(self, self.run_with_zero_proton_charge)
コード例 #52
0
 def test_constructor_succeeds_with_non_empty_string_name(self):
     assertRaisesNothing(self, FunctionProperty, "Function")
コード例 #53
0
 def test_convolution_creation_by_name(self):
     g0 = Gaussian(Height=7.5, Sigma=1.2, PeakCentre=10)
     g1 = Gaussian(Height=8.5, Sigma=1.2, PeakCentre=11)
     testhelpers.assertRaisesNothing(self, Convolution, g0, g1)
コード例 #54
0
 def test_valid_string_value_gives_function_object_as_value(self):
     alg = self.TestFunctionPropAlg()
     alg.initialize()
     alg.setProperty("fun", "name=Gaussian,PeakCentre=5.0,Height=1.0")
     alg.setRethrows(True)
     assertRaisesNothing(self, alg.execute)
コード例 #55
0
 def test_nothing_raised_when_getting_completions_from_a_not_imported_module(self):
     completer = self._get_completer("# My code")
     assertRaisesNothing(self, completer._get_module_call_tips, 'this.doesnt.exist')
コード例 #56
0
 def test_Init(self):
     assertRaisesNothing(self, AlgorithmManager.create,
                         ("PoldiCreatePeaksFromFile"))
コード例 #57
0
 def test_construction_with_Exclusive_bounds_with_ints(self):
     testhelpers.assertRaisesNothing(self, IntBoundedValidator, 1, 20, True)
コード例 #58
0
 def test_CommonBinsValidator_construction(self):
     """
         Test that the CommonBinsValidator can be constructed
         with no args
     """
     testhelpers.assertRaisesNothing(self, CommonBinsValidator)
コード例 #59
0
 def test_plotconstQ_nonListArgsExecutes(self):
     kwargs = {'workspaces': self._sqw, 'Q': 2.3, 'dQ': 0.3}
     testhelpers.assertRaisesNothing(self, directtools.plotconstQ, **kwargs)
コード例 #60
0
 def test_construction_with_Exclusive_bounds_with_floats(self):
     testhelpers.assertRaisesNothing(self, FloatBoundedValidator, 1.0, 2.0,
                                     True)