diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py index a46981d209cf1ac3ca2f2ea4b33af04051960b92..ed4bb5b7a214472ebe4437040f9448b1ac9fa52c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/DirectInelasticDiagnostic.py @@ -1,6 +1,6 @@ #pylint: disable=no-init from stresstesting import MantidStressTest -from mantid.simpleapi import MaskDetectors, config +import mantid.simpleapi as ms import Direct.DirectEnergyConversion as reduction import os @@ -42,10 +42,10 @@ class DirectInelasticDiagnostic(MantidStressTest): sample = reducer.get_run_descriptor(sample) sample_ws = sample.get_workspace() - MaskDetectors(Workspace=sample_ws, MaskedWorkspace=diag_mask) + ms.MaskDetectors(Workspace=sample_ws, MaskedWorkspace=diag_mask) # Save the masked spectra nmubers to a simple ASCII file for comparison - self.saved_diag_file = os.path.join(config['defaultsave.directory'], 'CurrentDirectInelasticDiag.txt') + self.saved_diag_file = os.path.join(ms.config['defaultsave.directory'], 'CurrentDirectInelasticDiag.txt') handle = file(self.saved_diag_file, 'w') for index in range(sample_ws.getNumberHistograms()): if sample_ws.getDetector(index).isMasked(): @@ -58,7 +58,8 @@ class DirectInelasticDiagnostic(MantidStressTest): if self.succeeded(): os.remove(self.saved_diag_file) else: - os.rename(self.saved_diag_file, os.path.join(config['defaultsave.directory'], 'DirectInelasticDiag-Mismatch.txt')) + os.rename(self.saved_diag_file, os.path.join(ms.config['defaultsave.directory'], + 'DirectInelasticDiag-Mismatch.txt')) def validateMethod(self): return 'validateASCII' diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py index a03c1b747471916606bc34eecb852deab2a93d59..561b98ef6b65eefc2f82be22aa145ada5ed450d6 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSDarkCurrentAPIv2.py @@ -7,17 +7,16 @@ from mantid.api import * import os class EQSANSDarkCurrent(stresstesting.MantidStressTest): - + """ + Analysis Tests for EQSANS + Testing that the I(Q) output of is correct + """ def cleanup(self): absfile = FileFinder.getFullPath("EQSANS_1466_event_reduction.log") if os.path.exists(absfile): os.remove(absfile) return True - """ - Analysis Tests for EQSANS - Testing that the I(Q) output of is correct - """ def runTest(self): config = ConfigService.Instance() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py index 79486d62dfb8320f5c7fb6740ecd1b02daea1e41..c8b858fbff769dd9f9a4001c894bd9a0db6dfb20 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/EQSANSSolidAPIv2.py @@ -14,21 +14,20 @@ def do_cleanup(): return True class EQSANSSolid(stresstesting.MantidStressTest): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(False) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() @@ -57,20 +56,20 @@ class EQSANSSolid(stresstesting.MantidStressTest): return "EQSANS_1466_event_Iq", 'EQSANSSolid.nxs' class EQSANSSolidEvent(EQSANSSolid): - - def cleanup(self): - do_cleanup() - return True """ Analysis Tests for EQSANS Testing that the I(Q) output of is correct """ + def cleanup(self): + do_cleanup() + return True + def runTest(self): """ Check that EQSANSTofStructure returns the correct workspace """ - config = ConfigService.Instance() - config["facilityName"]='SNS' + configI = ConfigService.Instance() + configI["facilityName"]='SNS' EQSANS(True) AppendDataFile("EQSANS_1466_event.nxs") SolidAngle() diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py index 2bf08bb2d5a81488f77c7a9dc19fd1e554db2691..81eab361aefb80608ab7023fa68c21f8eef06282 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/HFIRTestsAPIv2.py @@ -173,9 +173,9 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): self.n_tests = 0 self.n_passed = 0 self.failed_tests = [] - for item in dir(self): - m = getattr(self, item) - if item.startswith("test_") and type(m)==types.MethodType: + for current_item in dir(self): + m = getattr(self, current_item) + if current_item.startswith("test_") and type(m)==types.MethodType: self.n_tests += 1 t = TestStub(m) result = t.run_test() @@ -183,7 +183,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): if result is None or result==True: self.n_passed += 1 else: - self.failed_tests.append(item) + self.failed_tests.append(current_item) self.all_passed = False def test_data_path(self): @@ -353,7 +353,27 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.268942,0.272052,0.269806,0.27129,0.273852,0.271301,0.271732,0.271103,0.270996,0.269677,0.27098,0.266802,0.26789,0.268222,0.266125,0.262736,0.262752,0.263827,0.26315,0.262775,0.261541,0.260818,0.258955,0.257675,0.255908,0.254088,0.256778,0.256883,0.253568,0.25636,0.252323,0.251833,0.251914,0.252298,0.249375,0.247718,0.247768,0.244636,0.245604,0.243996,0.244332,0.244363,0.242985,0.242234,0.241118,0.241411,0.24084,0.239293,0.2392,0.236565,0.234557,0.233974,0.232905,0.231898,0.231085,0.229586,0.22862,0.227001,0.226783,0.225837,0.224835,0.223807,0.222296,0.221557,0.220464,0.219139,0.217611,0.217049,0.21606,0.215739,0.216233,0.213467,0.213141,0.213275,0.219695,0.216121,0.215502,0.21792,0.209364,0.209368,0.2064,0.205844,0.20431,0.203443,0.202442,0.200195,0.199408,0.19853,0.195654,0.195514,0.193086,0.193388,0.19137,0.190122,0.189119,0.18864,0.185473,0.184958,0.183981,0.182581] + check = [0.268942,0.272052,0.269806,0.27129,0.273852, + 0.271301,0.271732,0.271103,0.270996,0.269677, + 0.27098,0.266802,0.26789,0.268222,0.266125, + 0.262736,0.262752,0.263827,0.26315,0.262775, + 0.261541,0.260818,0.258955,0.257675,0.255908, + 0.254088,0.256778,0.256883,0.253568,0.25636, + 0.252323,0.251833,0.251914,0.252298,0.249375, + 0.247718,0.247768,0.244636,0.245604,0.243996, + 0.244332,0.244363,0.242985,0.242234,0.241118, + 0.241411,0.24084,0.239293,0.2392,0.236565, + 0.234557,0.233974,0.232905,0.231898,0.231085, + 0.229586,0.22862,0.227001,0.226783,0.225837, + 0.224835,0.223807,0.222296,0.221557,0.220464, + 0.219139,0.217611,0.217049,0.21606,0.215739, + 0.216233,0.213467,0.213141,0.213275,0.219695, + 0.216121,0.215502,0.21792,0.209364,0.209368, + 0.2064,0.205844,0.20431,0.203443,0.202442, + 0.200195,0.199408,0.19853,0.195654, + 0.195514,0.193086,0.193388,0.19137, + 0.190122,0.189119,0.18864,0.185473, + 0.184958,0.183981,0.182581] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -369,7 +389,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.269037,0.272176,0.269917,0.271416,0.273988,0.271432,0.271857,0.271232,0.271118,0.269797,0.271095,0.266912,0.268015,0.268356,0.266256,0.26287,0.262888,0.263964,0.263281,0.262905,0.261669,0.26094,0.259081,0.257802,0.256029,0.254228,0.256913,0.257021,0.253692,0.256491,0.252454,0.251969,0.25204,0.252423,0.249516,0.247844,0.247895,0.24476,0.245734,0.244125,0.244474,0.244491,0.243126,0.242359,0.241239,0.24154,0.240976,0.239421,0.23933,0.236688,0.234685,0.234105,0.233034,0.232036,0.231208,0.229714,0.228749,0.227122,0.226918,0.225969,0.22497,0.223933,0.222426,0.221684,0.2206,0.219277,0.217739,0.217173,0.216193,0.215869,0.216354,0.213597,0.213271,0.213407,0.219829,0.216259,0.215635,0.218058,0.209499,0.209503,0.206529,0.205981,0.20445,0.203577,0.202577,0.200334,0.199544,0.198663,0.195786,0.195653,0.19322,0.193537,0.191503,0.190253,0.189253,0.188771,0.1856,0.185099,0.184111,0.182717] + check = [0.269037,0.272176,0.269917,0.271416,0.273988,0.271432, + 0.271857,0.271232,0.271118,0.269797,0.271095,0.266912, + 0.268015,0.268356,0.266256,0.26287,0.262888,0.263964, + 0.263281,0.262905,0.261669,0.26094,0.259081,0.257802, + 0.256029,0.254228,0.256913,0.257021,0.253692,0.256491, + 0.252454,0.251969,0.25204,0.252423,0.249516,0.247844, + 0.247895,0.24476,0.245734,0.244125,0.244474,0.244491, + 0.243126,0.242359,0.241239,0.24154,0.240976,0.239421, + 0.23933,0.236688,0.234685,0.234105,0.233034,0.232036, + 0.231208,0.229714,0.228749,0.227122,0.226918,0.225969, + 0.22497,0.223933,0.222426,0.221684,0.2206,0.219277, + 0.217739,0.217173,0.216193,0.215869,0.216354,0.213597, + 0.213271,0.213407,0.219829,0.216259,0.215635,0.218058, + 0.209499,0.209503,0.206529,0.205981,0.20445,0.203577, + 0.202577,0.200334,0.199544,0.198663,0.195786, + 0.195653,0.19322,0.193537,0.191503,0.190253, + 0.189253,0.188771,0.1856,0.185099,0.184111,0.182717] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -388,7 +424,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.514758,0.520759,0.516451,0.51932,0.524206,0.519275,0.520125,0.518997,0.518729,0.516198,0.518718,0.51072,0.512816,0.513449,0.509453,0.502968,0.503003,0.505098,0.503835,0.503088,0.500716,0.499304,0.495777,0.49332,0.489926,0.486497,0.491656,0.491858,0.48546,0.490808,0.483111,0.482176,0.482359,0.483098,0.477528,0.474279,0.474485,0.468472,0.470305,0.467228,0.467934,0.467971,0.465358,0.463885,0.461762,0.462352,0.461285,0.458322,0.458118,0.453064,0.44927,0.448151,0.446129,0.444207,0.442629,0.439792,0.437958,0.434826,0.434443,0.432655,0.430731,0.428771,0.425893,0.424477,0.422421,0.419886,0.416942,0.415876,0.414037,0.41339,0.414353,0.409062,0.408431,0.408712,0.419282,0.412833,0.41062,0.414427,0.400056,0.400141,0.394724,0.393821,0.390721,0.38932,0.387497,0.383062,0.381603,0.380016,0.374635,0.374214,0.369733,0.370353,0.366464,0.364109,0.362184,0.361299,0.355246,0.354339,0.352412,0.349748] + check = [0.514758,0.520759,0.516451,0.51932,0.524206,0.519275, + 0.520125,0.518997,0.518729,0.516198,0.518718,0.51072, + 0.512816,0.513449,0.509453,0.502968,0.503003,0.505098, + 0.503835,0.503088,0.500716,0.499304,0.495777,0.49332, + 0.489926,0.486497,0.491656,0.491858,0.48546,0.490808, + 0.483111,0.482176,0.482359,0.483098,0.477528,0.474279, + 0.474485,0.468472,0.470305,0.467228,0.467934,0.467971, + 0.465358,0.463885,0.461762,0.462352,0.461285,0.458322, + 0.458118,0.453064,0.44927,0.448151,0.446129,0.444207, + 0.442629,0.439792,0.437958,0.434826,0.434443,0.432655, + 0.430731,0.428771,0.425893,0.424477,0.422421,0.419886, + 0.416942,0.415876,0.414037,0.41339,0.414353,0.409062, + 0.408431,0.408712,0.419282,0.412833,0.41062,0.414427, + 0.400056,0.400141,0.394724,0.393821,0.390721,0.38932, + 0.387497,0.383062,0.381603,0.380016,0.374635,0.374214, + 0.369733,0.370353,0.366464,0.364109,0.362184,0.361299, + 0.355246,0.354339,0.352412,0.349748] deltas = map(_diff_iq, data, check) delta = reduce(_add, deltas)/len(deltas) @@ -511,7 +563,23 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): ws = AnalysisDataService.retrieve("BioSANS_test_data_Iq") data = ws.dataY(0) - check = [0.374914,0.393394,0.414756,0.443152,0.460175,0.456802,0.477264,0.478456,0.488523,0.489758,0.489871,0.487127,0.497585,0.499346,0.49526,0.489273,0.486082,0.486923,0.494208,0.494531,0.492264,0.494608,0.478766,0.487872,0.48357,0.474654,0.48052,0.483367,0.485269,0.480079,0.482254,0.47413,0.48245,0.471207,0.476589,0.474701,0.472014,0.465479,0.468236,0.462524,0.46773,0.458851,0.457653,0.461929,0.465216,0.451887,0.45733,0.450281,0.45045,0.447508,0.446209,0.445063,0.446328,0.445735,0.444096,0.438758,0.43707,0.432302,0.437903,0.430176,0.426317,0.427858,0.433131,0.423087,0.418146,0.421584,0.417606,0.420891,0.414255,0.412448,0.413393,0.405706,0.404541,0.403016,0.402806,0.400023,0.394248,0.396725,0.389808,0.386475,0.386525,0.386674,0.386575,0.382081,0.373986,0.370391,0.37367,0.373686,0.367479,0.36732,0.36031,0.366588,0.362994,0.361712,0.351433,0.349867,0.3479,0.352355,0.344987,0.340605] + check = [0.374914,0.393394,0.414756,0.443152,0.460175,0.456802, + 0.477264,0.478456,0.488523,0.489758,0.489871,0.487127, + 0.497585,0.499346,0.49526,0.489273,0.486082,0.486923, + 0.494208,0.494531,0.492264,0.494608,0.478766,0.487872, + 0.48357,0.474654,0.48052,0.483367,0.485269,0.480079, + 0.482254,0.47413,0.48245,0.471207,0.476589,0.474701, + 0.472014,0.465479,0.468236,0.462524,0.46773,0.458851, + 0.457653,0.461929,0.465216,0.451887,0.45733,0.450281, + 0.45045,0.447508,0.446209,0.445063,0.446328,0.445735, + 0.444096,0.438758,0.43707,0.432302,0.437903,0.430176, + 0.426317,0.427858,0.433131,0.423087,0.418146,0.421584, + 0.417606,0.420891,0.414255,0.412448,0.413393,0.405706, + 0.404541,0.403016,0.402806,0.400023,0.394248,0.396725, + 0.389808,0.386475,0.386525,0.386674,0.386575,0.382081, + 0.373986,0.370391,0.37367,0.373686,0.367479,0.36732, + 0.36031,0.366588,0.362994,0.361712,0.351433,0.349867, + 0.3479,0.352355,0.344987,0.340605] # Check that I(q) is the same for both data sets deltas = map(_diff_iq, data, check) @@ -545,7 +613,25 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): self.assertTrue(math.fabs(delta)<0.1) def test_noDC_eff_with_DC(self): - ref = [28.06525, 136.94662, -16.20412, 0.00000, 147.79915, 146.42713, 302.00869, 0.00000, 0.00000,-1869.20724,-2190.89681,-1892.14939,-2140.79608,-1980.60037,-2096.75974,-2221.30118,-2263.51541,-2264.89989,-2364.83528,-2420.58152,-2444.51906,-2418.28886,-2606.16991,-2556.93660,-2623.71380,-2547.79671,-2670.60962,-2714.35237,-2717.01692,-2730.84974,-2768.92925,-2753.96396,-2732.66316,-2795.89687,-2780.37320,-2755.38910,-2814.88120,-2830.74081,-2803.42030,-2815.33244,-2754.70444,-2718.55136,-2740.03811,-2754.60415,-2815.96387,-2754.62039,-2781.54596,-2765.26282,-2676.04665,-2762.33751,-2722.94832,-2707.74990,-2730.50371,-2721.71272,-2682.02439,-2703.36446,-2679.47677,-2658.57573,-2669.41871,-2618.90655,-2638.41601,-2614.69128,-2583.29713,-2589.39730,-2567.19209,-2535.09328,-2539.43296,-2489.60117,-2500.76844,-2456.22248,-2444.13734,-2392.68589,-2410.98591,-2348.68064,-2334.84651,-2310.41426,-2250.24085,-2220.02192,-2184.65990,-2154.19638,-2099.56797,-2058.51585,-2004.05601,-1966.52356,-1910.47283,-1876.72098,-1817.69045,-1768.62167,-1721.56444,-1666.47199,-1608.86707,-1544.26178,-1492.78389,-1438.69256,-1358.60437,-1299.34476,-1221.57010,-1080.69421,-609.77891, -77.72765] + ref = [28.06525, 136.94662, -16.20412, 0.00000, 147.79915, 146.42713, 302.00869, + 0.00000, 0.00000,-1869.20724,-2190.89681,-1892.14939,-2140.79608,-1980.60037, + -2096.75974,-2221.30118,-2263.51541,-2264.89989,-2364.83528, + -2420.58152,-2444.51906,-2418.28886,-2606.16991,-2556.93660, + -2623.71380,-2547.79671,-2670.60962,-2714.35237,-2717.01692, + -2730.84974,-2768.92925,-2753.96396,-2732.66316,-2795.89687, + -2780.37320,-2755.38910,-2814.88120,-2830.74081,-2803.42030, + -2815.33244,-2754.70444,-2718.55136,-2740.03811,-2754.60415, + -2815.96387,-2754.62039,-2781.54596,-2765.26282,-2676.04665, + -2762.33751,-2722.94832,-2707.74990,-2730.50371,-2721.71272, + -2682.02439,-2703.36446,-2679.47677,-2658.57573,-2669.41871, + -2618.90655,-2638.41601,-2614.69128,-2583.29713,-2589.39730, + -2567.19209,-2535.09328,-2539.43296,-2489.60117,-2500.76844, + -2456.22248,-2444.13734,-2392.68589,-2410.98591,-2348.68064, + -2334.84651,-2310.41426,-2250.24085,-2220.02192,-2184.65990, + -2154.19638,-2099.56797,-2058.51585,-2004.05601,-1966.52356, + -1910.47283,-1876.72098,-1817.69045,-1768.62167,-1721.56444, + -1666.47199,-1608.86707,-1544.26178,-1492.78389,-1438.69256, + -1358.60437,-1299.34476,-1221.57010,-1080.69421,-609.77891, -77.72765] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() # name clash with SolidAngle algorithm @@ -553,7 +639,8 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True) #IQxQy(nbins=100) DirectBeamCenter("BioSANS_empty_cell.xml") - SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) + SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, + dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) DivideByThickness(1) SetTransmission(1, 0) ThetaDependentTransmission(True) @@ -572,8 +659,22 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): msg="result point %d: %g, found %g" % (i, ref[i], res[i])) def test_DC_eff_with_DC(self): - #ref = [8328.70241,8506.01586,5118.44441, 0.00000,7774.69442,8455.91783,14509.24224, 0.00000, 0.00000,-27551.42890,-34835.52157,-28076.35417,-32645.28731,-29923.90302,-32544.89749,-34519.58590,-35354.19282,-35242.21670,-37201.40137,-38547.80168,-38708.50152,-38339.04967,-41672.21115,-40898.80246,-41881.33026,-40789.34624,-43124.60460,-43846.74602,-43608.61731,-44050.49270,-44607.80184,-44662.71286,-44125.45576,-45197.75580,-45086.38543,-44502.49049,-45552.66509,-45678.42736,-45347.87980,-45613.96643,-44424.82296,-43888.62587,-44292.95665,-44465.13383,-45647.14865,-44450.82619,-44951.69404,-44597.94666,-43277.63573,-44605.52402,-44004.61793,-43774.86031,-44169.38692,-43970.30050,-43316.88231,-43786.96873,-43355.97746,-42952.99756,-43062.07976,-42184.58157,-42578.47214,-42199.41403,-41700.43004,-41780.97621,-41386.94893,-40865.71000,-40932.98886,-40036.67895,-40214.90469,-39471.74497,-39278.21830,-38383.80488,-38728.91704,-37705.78298,-37327.89414,-36943.11807,-35906.89550,-35399.21901,-34751.80556,-34209.49716,-33271.20006,-32530.08744,-31561.29164,-30906.03234,-29895.47664,-29278.16621,-28248.29021,-27341.79392,-26549.84441,-25476.57298,-24453.63444,-23305.85255,-22332.01538,-21306.01200,-19867.21655,-18795.14216,-17317.28374,-14745.54556,-6037.28367,4125.05228] - ref = [28.0476,136.906,-16.3079,0,147.757,146.403,301.982,0,0,-1869.21,-2190.93,-1892.16,-2140.81,-1980.62,-2096.79,-2221.34,-2263.55,-2264.93,-2364.87,-2420.61,-2444.56,-2418.32,-2606.21,-2556.98,-2623.75,-2547.84,-2670.66,-2714.39,-2717.06,-2730.89,-2768.96,-2754.01,-2732.7,-2795.93,-2780.41,-2755.42,-2814.92,-2830.79,-2803.46,-2815.38,-2754.75,-2718.6,-2740.08,-2754.65,-2816.01,-2754.66,-2781.59,-2765.3,-2676.09,-2762.38,-2722.99,-2707.8,-2730.55,-2721.76,-2682.07,-2703.41,-2679.52,-2658.62,-2669.46,-2618.95,-2638.46,-2614.74,-2583.34,-2589.44,-2567.23,-2535.14,-2539.48,-2489.64,-2500.81,-2456.26,-2444.18,-2392.73,-2411.03,-2348.73,-2334.89,-2310.46,-2250.28,-2220.07,-2184.7,-2154.24,-2099.61,-2058.56,-2004.1,-1966.57,-1910.52,-1876.76,-1817.73,-1768.67,-1721.61,-1666.51,-1608.91,-1544.31,-1492.83,-1438.74,-1358.65,-1299.39,-1221.61,-1080.73,-609.821,-77.7712] + ref = [28.0476,136.906,-16.3079,0,147.757,146.403,301.982, + 0,0,-1869.21,-2190.93,-1892.16,-2140.81,-1980.62,-2096.79, + -2221.34,-2263.55,-2264.93,-2364.87,-2420.61,-2444.56, + -2418.32,-2606.21,-2556.98,-2623.75,-2547.84,-2670.66, + -2714.39,-2717.06,-2730.89,-2768.96,-2754.01,-2732.7, + -2795.93,-2780.41,-2755.42,-2814.92,-2830.79,-2803.46, + -2815.38,-2754.75,-2718.6,-2740.08,-2754.65,-2816.01, + -2754.66,-2781.59,-2765.3,-2676.09,-2762.38,-2722.99, + -2707.8,-2730.55,-2721.76,-2682.07,-2703.41,-2679.52, + -2658.62,-2669.46,-2618.95,-2638.46,-2614.74,-2583.34, + -2589.44,-2567.23,-2535.14,-2539.48,-2489.64,-2500.81, + -2456.26,-2444.18,-2392.73,-2411.03,-2348.73,-2334.89, + -2310.46,-2250.28,-2220.07,-2184.7,-2154.24,-2099.61, + -2058.56,-2004.1,-1966.57,-1910.52,-1876.76,-1817.73, + -1768.67,-1721.61,-1666.51,-1608.91,-1544.31, + -1492.83,-1438.74,-1358.65,-1299.39,-1221.61,-1080.73,-609.821,-77.7712] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() @@ -582,7 +683,8 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): AzimuthalAverage(n_bins=100, n_subpix=1, log_binning=True) #IQxQy(nbins=100) DirectBeamCenter("BioSANS_empty_cell.xml") - SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) + SensitivityCorrection('BioSANS_flood_data.xml', min_sensitivity=0.5, + max_sensitivity=1.5, dark_current='BioSANS_empty_trans.xml', use_sample_dc=False) DivideByThickness(1) SetTransmission(1, 0) ThetaDependentTransmission(True) @@ -601,8 +703,20 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): msg="result point %d: %g, found %g" % (i, ref[i], res[i])) def test_DC_eff_noDC(self): - #ref = [7164.60565,7752.68818,5711.05627, 0.00000,5900.87667,8062.67404, 0.00000, 0.00000,-24761.10043,-23989.79632,-27228.05671,-27520.90826,-28702.43297,-30016.08164,-31857.27731,-32831.96025,-33274.36135,-33765.95318,-35208.90831,-37330.42544,-38283.00967,-38157.84654,-40398.13178,-40807.56861,-40981.56490,-40010.58202,-42502.81591,-43001.82289,-42582.26700,-43857.23377,-44163.99857,-44732.14970,-43799.50312,-44791.12989,-44777.68791,-43985.74941,-45468.56174,-45452.90859,-45309.47499,-45759.04142,-43969.71697,-43854.45515,-44260.09016,-44420.83533,-45370.71500,-44500.35745,-45047.70688,-44404.89711,-43526.84357,-44566.97107,-43693.66349,-43741.61517,-44045.48712,-43860.53110,-43371.59488,-43623.05598,-43456.87922,-42905.84855,-42947.82849,-42114.29792,-42493.59647,-41998.37587,-41635.60470,-41808.27092,-41359.04234,-40774.21357,-40842.43155,-40073.84107,-40151.59039,-39504.86741,-39166.91772,-38472.64978,-38668.95577,-37731.30203,-37416.76227,-36798.92809,-35971.80065,-35477.59413,-34782.44503,-34089.54104,-33225.67613,-32520.31544,-31591.39201,-30937.42531,-29962.72283,-29241.95009,-28269.99833,-27317.23101,-26561.76975,-25533.91747,-24418.32912,-23309.34592,-22383.49546,-21298.00468,-19889.28546,-18800.07365,-17315.89420,-14744.66783,-6047.10832,4171.62004] - ref = [10.4139,124.814,25.0443,0,38.3413,133.417,0,0,-1733.56,-1627.57,-1811.38,-1851.58,-1888.38,-1957.07,-2056.47,-2117.52,-2139.32,-2176.94,-2239.91,-2350.65,-2417.75,-2406.99,-2525.48,-2551.45,-2566.83,-2499.38,-2632.35,-2662.17,-2653.14,-2718.65,-2740.78,-2758.94,-2712,-2771.35,-2761.38,-2724.05,-2809.97,-2815.92,-2801.25,-2824.54,-2726.76,-2716.63,-2737.83,-2752.06,-2798.95,-2757.7,-2787.58,-2753.12,-2691.47,-2759.93,-2703.94,-2705.55,-2722.64,-2714.75,-2685.28,-2693.49,-2685.75,-2655.65,-2662.42,-2614.47,-2633.12,-2602.29,-2579.4,-2591.17,-2565.28,-2529.61,-2533.85,-2491.87,-2496.78,-2458.25,-2437.25,-2398.16,-2407.29,-2350.32,-2340.43,-2301.5,-2254.37,-2224.97,-2186.64,-2146.73,-2096.71,-2058.12,-2006.2,-1968.6,-1914.93,-1874.31,-1819.05,-1767.14,-1722.35,-1670.38,-1606.61,-1544.51,-1496.24,-1438.21,-1360.12,-1299.68,-1221.61,-1080.91,-610.638,-71.9557] + ref = [10.4139,124.814,25.0443,0,38.3413,133.417,0,0,-1733.56,-1627.57, + -1811.38,-1851.58,-1888.38,-1957.07,-2056.47,-2117.52, + -2139.32,-2176.94,-2239.91,-2350.65,-2417.75,-2406.99,-2525.48, + -2551.45,-2566.83,-2499.38,-2632.35,-2662.17,-2653.14,-2718.65, + -2740.78,-2758.94,-2712,-2771.35,-2761.38,-2724.05,-2809.97, + -2815.92,-2801.25,-2824.54,-2726.76,-2716.63,-2737.83,-2752.06, + -2798.95,-2757.7,-2787.58,-2753.12,-2691.47,-2759.93,-2703.94, + -2705.55,-2722.64,-2714.75,-2685.28,-2693.49,-2685.75,-2655.65, + -2662.42,-2614.47,-2633.12,-2602.29,-2579.4,-2591.17,-2565.28, + -2529.61,-2533.85,-2491.87,-2496.78,-2458.25,-2437.25, + -2398.16,-2407.29,-2350.32,-2340.43,-2301.5,-2254.37,-2224.97, + -2186.64,-2146.73,-2096.71,-2058.12,-2006.2,-1968.6,-1914.93, + -1874.31,-1819.05,-1767.14,-1722.35,-1670.38,-1606.61, + -1544.51,-1496.24,-1438.21,-1360.12,-1299.68,-1221.61,-1080.91,-610.638,-71.9557] BIOSANS() SetSampleDetectorOffset(837.9) #SolidAngle() @@ -710,6 +824,7 @@ class HFIRTestsAPIv2(stresstesting.MantidStressTest): print item return self.all_passed +#pylint: disable=too-many-arguments,unused-argument def assertAlmostEqual(first, second, places=None, msg=None, delta=None, rel_delta=None): """ Simple test to compare two numbers diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py index c918b179a1b38d0515d2a0cf2c3f984e5fca0f30..20124243941c97e6ece0d1b0379169294f30cffe 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ILLIN5Test.py @@ -2,7 +2,7 @@ import stresstesting from mantid.api import MatrixWorkspace, mtd -from mantid.simpleapi import LoadILL +from mantid.simpleapi import * import unittest @@ -57,7 +57,7 @@ class ILLIN5Tests(unittest.TestCase): #================== Private methods ================================ - + #pylint: disable=unused-argument def _run_load(self, dataFile, vanaFile=None,vanaWS=None,outWSName=wsData_name): """ ILL Loader @@ -72,7 +72,7 @@ class ILLIN5Tests(unittest.TestCase): #==================================================================================== class LoadILLIN5Test(stresstesting.MantidStressTest): - + _success=False def runTest(self): self._success = False # Custom code to create and run this single test suite diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py index 9dd54ffab5d901da67bec594c9c0b3d9a363a149..ef5d9cf1b346912c8da3a6040f05ce4860a393e7 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISDirectInelastic.py @@ -27,12 +27,14 @@ class ISISDirectInelasticReduction(stresstesting.MantidStressTest): - hard_mask: An hard mask file or None """ __metaclass__ = ABCMeta # Mark as an abstract class + tolerance=0. + tolerance_is_reller=True @abstractmethod def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implement get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") @abstractmethod def get_result_workspace(self): @@ -88,6 +90,7 @@ class MARIReductionFromFile(ISISDirectInelasticReduction): def runTest(self): #self.red.run_reduction() + #pylint: disable=unused-variable outWS = self.red.reduce() outWS*=self.scale_to_fix_abf @@ -98,15 +101,17 @@ class MARIReductionFromFile(ISISDirectInelasticReduction): return "MARIReduction.nxs" class MARIReductionFromFileCache(ISISDirectInelasticReduction): + _counter=0 def __init__(self): ISISDirectInelasticReduction.__init__(self) self.tolerance = 1e-9 from ISIS_MariReduction import ReduceMARIFromFile - + self._file_to_clear = None self.red = ReduceMARIFromFile() self.red.def_advanced_properties() self.red.def_main_properties() + self.counter=0 def prepare_test_file(self): """ This method will run instead of pause and @@ -182,9 +187,9 @@ class MARIReductionFromWorkspace(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=self.scale_to_fix_abf @@ -208,9 +213,9 @@ class MARIReductionMon2Norm(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=0.989834962505304 def get_result_workspace(self): @@ -230,10 +235,10 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): def __init__(self): ISISDirectInelasticReduction.__init__(self) - # This test has not been run properly so reference file is kind-of - # arbitrary. It just checks that this reduction works. - # Mari reduction masks are not correct for monitors loaded separately, - # This explains all the difference encountered. + # This test has not been run properly so reference file is kind-of + # arbitrary. It just checks that this reduction works. + # Mari reduction masks are not correct for monitors loaded separately, + # This explains all the difference encountered. from ISIS_MariReduction import ReduceMARIMonitorsSeparate self.red = ReduceMARIMonitorsSeparate() @@ -242,10 +247,11 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test""" - # temporary fix cross-influence of tests for MARI. changes to nex ticket make this unnecessary + # temporary fix cross-influence of tests for MARI. changes to nex ticket make this unnecessary PropertyManager.mono_correction_factor.set_cash_mono_run_number(None) + #pylint: disable=unused-variable outWS=self.red.reduce() - # temporary fix to account for different monovan integral + # temporary fix to account for different monovan integral outWS*=0.997966051169129 @@ -254,8 +260,8 @@ class MARIReductionMonSeparate(ISISDirectInelasticReduction): return "outWS" def get_reference_file(self): - # monitor separate for MARI needs new maps and masks so, it is easier to redefine - # reference file for the time being + # monitor separate for MARI needs new maps and masks so, it is easier to redefine + # reference file for the time being return "MARIReductionMonSeparate.nxs" class MARIReductionSum(ISISDirectInelasticReduction): @@ -271,10 +277,11 @@ class MARIReductionSum(ISISDirectInelasticReduction): def runTest(self): """Defines the workflow for the test - It verifies operation on summing two files on demand. No absolute units - """ + It verifies operation on summing two files on demand. No absolute units + """ + #pylint: disable=unused-variable outWS=self.red.reduce() - #outWS*=1.00001556766686 + #outWS*=1.00001556766686 def get_result_workspace(self): """Returns the result workspace to be checked""" @@ -293,6 +300,8 @@ class MARIReductionWaitAndSum(ISISDirectInelasticReduction): self.red = MARIReductionSum() self.red.def_advanced_properties() self.red.def_main_properties() + self._counter=0 + self._file_to_clear = '' def prepare_test_file(self): """ This method will run instead of pause and @@ -325,6 +334,7 @@ class MARIReductionWaitAndSum(ISISDirectInelasticReduction): self._counter=0 self.red.reducer.prop_man.sample_run=[11001,11002] + #pylint: disable=unused-variable outWS = self.red.run_reduction() self.red.wait_for_file =0 @@ -351,21 +361,21 @@ class MAPSDgreduceReduction(ISISDirectInelasticReduction): ISISDirectInelasticReduction.__init__(self) from ISIS_MAPS_DGSReduction import ReduceMAPS - + self.ws_name='' self.red = ReduceMAPS() self.red.def_advanced_properties() self.red.def_main_properties() def runTest(self): - + #pylint: disable=unused-variable outWS=self.red.reduce() - #New WBI value 0.02720959162181584 - #Old WBI Value 0.027209867107187088 - # fix old system test. - #outWS*=0.02720959162181584/0.027209867107187088 + #New WBI value 0.02720959162181584 + #Old WBI Value 0.027209867107187088 + # fix old system test. + #outWS*=0.02720959162181584/0.027209867107187088 - # rename workspace to the name expected by unit test framework - #RenameWorkspace(InputWorkspace=outWS,OutputWorkspace=wsName) + # rename workspace to the name expected by unit test framework + #RenameWorkspace(InputWorkspace=outWS,OutputWorkspace=wsName) self.ws_name = 'outWS' @@ -386,7 +396,7 @@ class MERLINReduction(ISISDirectInelasticReduction): def __init__(self): ''' Test relies on MERLIN_Parameters.xml file introduced in July 2014 - ''' + ''' ISISDirectInelasticReduction.__init__(self) from ISIS_MERLINReduction import ReduceMERLIN @@ -396,6 +406,7 @@ class MERLINReduction(ISISDirectInelasticReduction): self.red.def_main_properties() def runTest(self): + #pylint: disable=unused-variable outWS = self.red.reduce() def get_reference_file(self): @@ -417,7 +428,8 @@ class MERLINReduction(ISISDirectInelasticReduction): # class LETReduction(stresstesting.MantidStressTest): - + tolerance = 1e-6 + tolerance_is_reller=True def requiredMemoryMB(self): """Far too slow for managed workspaces. They're tested in other places. Requires 2Gb""" return 2000 @@ -432,7 +444,7 @@ class LETReduction(stresstesting.MantidStressTest): red = ReduceLET_OneRep() red.def_main_properties() red.def_advanced_properties() - + #pylint: disable=unused-variable outWS=red.reduce() @@ -447,9 +459,10 @@ class LETReduction(stresstesting.MantidStressTest): class LETReductionEvent2015Multirep(stresstesting.MantidStressTest): """ - written in a hope that most of the stuff find here will eventually find its way into main reduction routines - """ - + written in a hope that most of the stuff find here will eventually find its way into main reduction routines + """ + tolerance = 1e-6 + tolerance_is_reller=True def requiredMemoryMB(self): """Far too slow for managed workspaces. They're tested in other places. Requires 20Gb""" return 20000 @@ -466,14 +479,11 @@ class LETReductionEvent2015Multirep(stresstesting.MantidStressTest): red.def_advanced_properties() red.def_main_properties() - + #pylint: disable=unused-variable out_ws_list=red.run_reduction() - #for ind,ws in enumerate(out_ws_list): - # ws *=mults[ind] - - - + #for ind,ws in enumerate(out_ws_list): + # ws *=mults[ind] def validate(self): diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py index 5d88d3a15811f78acd2ff63af9099cd09ec4270e..04bd5536fa80174ccb85c8b1d10b38a7322cd7cd 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysis.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,invalid-name,attribute-defined-outside-init +#pylint: disable=no-init,invalid-name,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import math import stresstesting from mantid.simpleapi import * @@ -30,7 +30,7 @@ class ISISMuonAnalysis(stresstesting.MantidStressTest): def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implmenent get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") def get_result_workspace(self): """Returns the result workspace to be checked""" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py index bf411b23d563efaf3d4b42b0f8e7f4bc0423ea35..f4cd88a8049f523ebe3b95d4809781459d8bbf0f 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISISMuonAnalysisGrouping.py @@ -1,4 +1,4 @@ -#pylint: disable=no-init,attribute-defined-outside-init +#pylint: disable=no-init,attribute-defined-outside-init,too-many-instance-attributes,too-few-public-methods import stresstesting from mantid.simpleapi import * @@ -27,7 +27,7 @@ class ISISMuonAnalysisGrouping(stresstesting.MantidStressTest): def get_reference_file(self): """Returns the name of the reference file to compare against""" raise NotImplementedError("Implmenent get_reference_file to return " - "the name of the file to compare against.") + "the name of the file to compare against.") def get_result_workspace(self): """Returns the result workspace to be checked""" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py index 4b63de346581345e122a8a1642f6b36e12cf513a..b3fa6c93a64d7f7e69e34b66ba9c34db6f958743 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MERLINReduction.py @@ -1,6 +1,6 @@ #pylint: disable=invalid-name """ Sample MERLIN reduction scrip """ -import os +#import os #os.environ["PATH"] = r"c:/Mantid/Code/builds/br_master/bin/Release;"+os.environ["PATH"] from Direct.ReductionWrapper import * @@ -25,7 +25,8 @@ class ReduceMERLIN(ReductionWrapper): # Absolute units reduction properties. #prop['monovan_run'] = 17589 - #prop['sample_mass'] = 10/(94.4/13) # -- this number allows to get approximately the same system test intensities for MAPS as the old test + #prop['sample_mass'] = 10/(94.4/13) + # -- this number allows to get approximately the same system test intensities for MAPS as the old test #prop['sample_rmm'] = 435.96 # return prop @@ -65,7 +66,7 @@ if __name__=="__main__": #data_dir ='d:/Data/Mantid_Testing/14_11_27' #ref_data_dir = 'd:/Data/MantidSystemTests/SystemTests/AnalysisTests/ReferenceResults' #config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir)) - #config.appendDataSearchDir('d:/Data/Mantid_GIT/Test/AutoTestData') + #config.appendDataSearchDir('d:/Data/Mantid_GIT/Test/AutoTestData') #config['defaultsave.directory'] = data_dir # folder to save resulting spe/nxspe files. Defaults are in # execute stuff from Mantid diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py index 8d045980429b9f61c9a9dd3b9616347abb766926..ef9998fcc48d76859af66ca510bdaf0cb6850304 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ISIS_MariReduction.py @@ -319,8 +319,8 @@ if __name__ == "__main__": #### uncomment rows below to generate web variables and save then to transfer to ### ## web services. run_dir = os.path.dirname(os.path.realpath(__file__)) - file = os.path.join(run_dir,'reduce_vars.py') - rd.save_web_variables(file) + filename = os.path.join(run_dir,'reduce_vars.py') + rd.save_web_variables(filename) #### Set up time interval (sec) for reducer to check for input data file. #### # If this file is not present and this value is 0,reduction fails diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py index e66d1ab75053d8ce431cfe43ff9f6bed995fe97e..85677c09a85355a3c38a4457c91ad25f435b2bea 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/LoadAndCheckBase.py @@ -74,7 +74,7 @@ class LoadAndCheckBase(stresstesting.MantidStressTest): for i in range(0, a.size()): self.do_check_workspace_shape(a[i], b[i]) if self.enable_instrument_checking(): - self.do_check_instrument_applied(a[-1], b[-1]) + self.do_check_instrument_applied(a[a.size()-1], b[b.size()-1]) if self.enable_reference_result_checking(): Integration(InputWorkspace=a[0], OutputWorkspace=self.__comparison_out_workspace_name) else: diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py index aa233a68bb2a0ec3f385c411e94d2696d12d2758..7754f80043d2ea3623db183d99c29e81e5852fe6 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/OFFSPECLoadingTest.py @@ -1,10 +1,10 @@ #pylint: disable=no-init from LoadAndCheckBase import * -''' -Test File loading and basic data integrity checks of OFFSPEC data in Mantid. -''' class OFFSPECLoadingTest(LoadAndCheckBase): + ''' + Test File loading and basic data integrity checks of OFFSPEC data in Mantid. + ''' def get_raw_workspace_filename(self): return "OFFSPEC00010791.raw" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py index 95d182acac79f47f77356fc3a3ff22b1e3203986..a71e744d4b9aa756e9cdf36b700d4cd2936dd35a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/PEARLSystemTest.py @@ -6,10 +6,12 @@ import os import numpy as n from abc import ABCMeta, abstractmethod +#pylint: disable=too-many-instance-attributes class PEARL_Reduction(stresstesting.MantidStressTest): '''Test adapted from actual script used by the scientists''' __metaclass__ = ABCMeta # Mark as an abstract class + validate=None def __init__(self): stresstesting.MantidStressTest.__init__(self) @@ -60,13 +62,12 @@ class PEARL_Reduction(stresstesting.MantidStressTest): def validateGSS(self): '''Validate the created gss file''' - from mantid.api import FileFinder return self.saved_gssfile,FileFinder.getFullPath(self.reference_gss) def PEARL_getlambdarange(self): return 0.03,6.00 - def PEARL_getmonitorspectrum(self, runno): + def PEARL_getmonitorspectrum(self, dummy_runno): return 1 def PEARL_getfilename(self, run_number,ext): @@ -75,7 +76,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): numdigits=8 filename="PEARL" - for i in range(0,numdigits-digit): + for dummy_i in range(0,numdigits-digit): filename=filename+"0" filename+=str(run_number)+"."+ext @@ -167,6 +168,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): mtd.remove(monitor) return + #pylint: disable=too-many-arguments,too-many-branches def PEARL_focus(self, number,ext="raw",fmode="trans",ttmode="TT70",atten=True,van_norm=True): self.tt_mode=ttmode @@ -357,6 +359,7 @@ class PEARL_Reduction(stresstesting.MantidStressTest): #================================================================================ class PEARL_Mode_trans(PEARL_Reduction): + validate=None def do_focus(self): #self.reference_nexus = "PRL75318_75323.nxs" return self.PEARL_focus("75318_75323","raw",fmode="trans",ttmode="TT70",atten=True) @@ -373,12 +376,14 @@ class PEARL_Mode_trans(PEARL_Reduction): return 'PRL75318_75323_noatten','PEARL75318_75323_noatten.nxs' #================================================================================ +#pylint: disable=too-few-public-methods class PEARL_Mode_all_Si(PEARL_Reduction): def do_focus(self): #self.reference_nexus = "PRL74798_74800.nxs" return self.PEARL_focus("74798_74800","raw",fmode="all",ttmode="TT70",atten=False) #================================================================================ +#pylint: disable=too-few-public-methods class PEARL_Mode_all_CeO2(PEARL_Reduction): def do_focus(self): #self.reference_nexus = "PRL74795_74797.nxs" diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py b/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py index d3bcc804d7cafcffaddc9ce5e12f0749e32cc27b..d9bc20ec5fbb023f5433c2b56c7d7d30dc6f7a11 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/Peak2ConvCell_Test.py @@ -1,4 +1,4 @@ -#pylint: disable=invalid-name,no-init +#pylint: disable=invalid-name,no-init,too-many-arguments,too-many-branches #This script creates numerous PeaksWorkspaces for different Crystal Types and Centerings. Random errors #are also introduced into the peak's. Each PeaksWorkspace is sent through the algorithm's FindPeaksMD, #FindUBUsingFFT, and SelectByForm to determine the corresponding Primitive and Conventional cells. These @@ -8,7 +8,7 @@ #!!!!!!!!! REPLACE THE "XXX" OR else !!!!!!!!!! -import stresstesting +#import stresstesting import numpy from numpy import matrix import math @@ -18,7 +18,7 @@ from mantid.simpleapi import * #from mantid.simpleapi import * #TODO premultiply cases, fix up.. Maybe not needed Cause Conv cell was "Nigglied" #TODO: SWitch cases, if use approx inequality, may get error cause low level code [does Not](does) premult but when it [should](should not) -class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): +class Peak2ConvCell_Test(object):#(stresstesting.MantidStressTest): conventionalUB=numpy.zeros(shape=(3,3)) Cubic=[1,3,5] Tetr=[6,7,11,15,18,21] @@ -34,16 +34,16 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): CentC=[10,13,14,17,20,23,25,27,28,29,30,36,37,38,39,40,41] - def CalcConventionalUB(self,a,b,c,alpha,beta,gamma,type): + def CalcConventionalUB(self,a,b,c,alpha,beta,gamma,celltype): Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]]) - if type=='O': + if celltype=='O': Res[0,0]=1./a Res[1,1]=1./b Res[2,2]=1./c - elif type=='H': + elif celltype=='H': Res[0,0]= a*1.0 Res[1,0]= -a/2. Res[1,1]= a*.866 @@ -160,21 +160,21 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): return RUB.I - def CalcNiggliUB( self,a, b,c,alpha, beta, gamma,type, Center): + def CalcNiggliUB( self,a, b,c,alpha, beta, gamma,celltype, Center): if Center=='P': - X = self.CalcConventionalUB( a,b,c,alpha,beta,gamma,type) + X = self.CalcConventionalUB( a,b,c,alpha,beta,gamma,celltype) return X Res= matrix([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]]) - ConvUB = self.CalcConventionalUB(a,b,c,alpha,beta,gamma,type) + ConvUB = self.CalcConventionalUB(a,b,c,alpha,beta,gamma,celltype) if ConvUB== None: return None ResP = numpy.matrix.copy(ConvUB) ResP =ResP.I - if type=='H' and Center =='I': + if celltype=='H' and Center =='I': Center ='R' if Center == 'I': @@ -198,7 +198,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='F': - if type =='H' or type=='M': + if celltype =='H' or celltype=='M': return None ss = [0,0,0] @@ -217,25 +217,25 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='A' or Center=='B'or Center=='C': - if type =='H' : + if celltype =='H' : return None - if type =='M' and Center== 'B': + if celltype =='M' and Center== 'B': return None r=2 if Center =='A' : r=0 - if b==c and type=='O':# result would be orthorhombic primitive + if b==c and celltype=='O':# result would be orthorhombic primitive return None elif Center =='B': r=1 - if a==c and type=='O': + if a==c and celltype=='O': return None - elif a==b and type=='O': + elif a==b and celltype=='O': return None k=0 @@ -262,7 +262,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): elif Center =='R': - if type != 'H' or alpha >120:#alpha =120 planar, >120 no go or c under a-b plane. + if celltype != 'H' or alpha >120:#alpha =120 planar, >120 no go or c under a-b plane. self.conventionalUB=NiggliUB = None return None @@ -803,7 +803,7 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): print ["Formnum,Lat1,Lat0",FormXtal[i1],Lat1,Lat0] if math.fabs(Lat0[0]-Lat1[0])<tolerance and math.fabs(Lat0[1]-Lat1[1])<tolerance and math.fabs(Lat0[2]-Lat1[2])<tolerance: - for i in range(3): + for dummy_i in range(3): if math.fabs(Lat0[3]-Lat1[3])<angTolerance and math.fabs(Lat0[4]-Lat1[4])<angTolerance and math.fabs(Lat0[5]-Lat1[5])<angTolerance: break if Lat1[0]>Lat1[1]-tolerance: @@ -900,7 +900,8 @@ class Peak2ConvCell_Test:#(stresstesting.MantidStressTest): InPks=IndexPeaks(Peaks,.10) - CopySample(Peaks,"Sws",CopyMaterial="0",CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1") + CopySample(Peaks,"Sws",CopyMaterial="0", + CopyEnvironment="0",CopyName="0",CopyShape="0",CopyLattice="1") OrLat= mtd["Sws"].sample().getOrientedLattice() Lat1= [OrLat.a(),OrLat.b(),OrLat.c(),OrLat.alpha(),OrLat.beta(),OrLat.gamma()] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py index 1af0a4ae036ccac77c8498b7bf314ad1cec9713f..e42ffe890ccf118f128d17051e4c2d9c436b6a46 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReflectometryQuickCombineMulti.py @@ -22,7 +22,7 @@ class ReflectometryQuickCombineMulti(stresstesting.MantidStressTest): for transmissionNumber in transmissionNumbers: LoadISISNexus(Filename=str(transmissionNumber), OutputWorkspace=str(transmissionNumber)) - transmissionRuns = ",".join(map(str, transmissionNumbers)) + transmissionRuns = ",".join([str(tn) for tn in transmissionNumbers])) # Run quick quick.quick(str(runNumber), trans=transmissionRuns, theta=incidentAngle) finally: diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py index b259692221b7d35b3fc2f9635ad19be754089d4d..3f89437a7150a58fa528fbd41f502b29e4ff055d 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ReuseExistingCalibration.py @@ -6,25 +6,26 @@ import stresstesting class ReuseExistingCalibration(stresstesting.MantidStressTest): + det_pos_first_run = None + det_pos_second_run = None def requiredFiles(self): return ["HRP39180.RAW", "HRP38094Calib.nxs"] def runTest(self): - from mantid.simpleapi import Load, CopyInstrumentParameters, MoveInstrumentComponent - + import mantid.simpleapi as ms def do_reduction(calibration): # load data - data = Load("HRP39180.RAW") + data = ms.Load("HRP39180.RAW") # copy parameters from calibration to data - CopyInstrumentParameters(calibration, data) + ms.CopyInstrumentParameters(calibration, data) # Now move component on data workspace using a relative move, where that component was a detector in the calibrated workspace - MoveInstrumentComponent(data, DetectorID=1100,X=0.0,Y=0.0,Z=5.0,RelativePosition=True) + ms.MoveInstrumentComponent(data, DetectorID=1100,X=0.0,Y=0.0,Z=5.0,RelativePosition=True) return data.getDetector(0).getPos() #### # load calibration - calibration = Load("HRP38094Calib") + calibration = ms.Load("HRP38094Calib") self.det_pos_first_run = do_reduction(calibration) # again not reloading of calibration self.det_pos_second_run = do_reduction(calibration) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py index f1003e6c927cad44d851427e19e8fd324f77ddec..a9635171ff1ffd3b12cf043e643aa1f96f01cc0a 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SANS2DReductionGUI.py @@ -248,7 +248,7 @@ class SANS2DGUIReduction(SANS2DGUIBatchReduction): def checkFittingSettings(self): settings = {'scale':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.scale, - 'shift':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.shift} + 'shift':i.ReductionSingleton().instrument.getDetector('FRONT').rescaleAndShift.shift} super(SANS2DGUIReduction,self).checkFittingSettings(settings) diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py b/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py index bf9c55906db4d5614cd009a535e90c07a8f81c31..feaacd185befad16aa9ab9fc002fef0bae9fa521 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/SEQUOIAreduction.py @@ -12,6 +12,8 @@ from mantid.simpleapi import * from numpy import * class DirectInelaticSNSTest(stresstesting.MantidStressTest): + _nxspe_filename="" + customDataDir="" #setup routines def topbottom(self): @@ -100,12 +102,12 @@ class DirectInelaticSNSTest(stresstesting.MantidStressTest): newruns=[] try: len(runs) - except: + except TypeError: runs=[runs] for r in runs: try: len(r) - except: + except TypeError: r=[r] temppath=[] tempnewruns=[] @@ -152,6 +154,7 @@ class DirectInelaticSNSTest(stresstesting.MantidStressTest): if os.path.exists(self.customDataDir): shutil.rmtree(self.customDataDir) + #pylint: disable=too-many-locals,too-many-branches def runTest(self): self.setupFiles() runs=[[12384,12385]] diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py index 650b656da435fa6ce017d01e99aeb97e0c00076d..d015337c8d8d4c562c7a18c48cf71ad319370f6c 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/ValidateGroupingFiles.py @@ -8,6 +8,8 @@ EXPECTED_EXT = '.expected' class ValidateGroupingFiles(stresstesting.MantidStressTest): + xsdFile ='' + def skipTests(self): try: import genxmlif @@ -45,9 +47,9 @@ class ValidateGroupingFiles(stresstesting.MantidStressTest): print "----------------------------------------" print "Validating '%s'" % filename pyxsval.parseAndValidateXmlInput(filename, xsdFile=self.xsdFile, validateSchema=0) - except Exception, e: + except Exception, err: print "VALIDATION OF '%s' FAILED WITH ERROR:" % filename - print e + print err failed.append(filename) # final say on whether or not it 'worked' diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py b/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py index a6716e54bba943baa4e9c328cbb144322c20b8dc..b676087dde5602f99261f24efbf3d3f2bfcf99f7 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/WishMasking.py @@ -20,7 +20,7 @@ class WishMasking(stresstesting.MantidStressTest): try: index = int(line_contents[0].strip()) select = int(line_contents[3].strip()) - group = int(line_contents[4].strip()) + dummy_group = int(line_contents[4].strip()) if index == requested_index: return select except ValueError: @@ -30,22 +30,23 @@ class WishMasking(stresstesting.MantidStressTest): # 1) Uses the masks to create a cal file # 2) Read the cal file # 3) Use the known masking boundaries to determine whether the cal file has been created propertly accoring to the function inputs. + #pylint: disable=too-many-arguments def do_test_cal_file(self, masked_workspace, should_invert, expected_masking_identifier, expected_not_masking_identifier, masking_edge): cal_filename = 'wish_masking_system_test_temp.cal' cal_file_full_path = os.path.join(config['defaultsave.directory'],cal_filename) MaskWorkspaceToCalFile(InputWorkspace=masked_workspace, OutputFile=cal_file_full_path, Invert=should_invert) - file = open(cal_file_full_path, 'r') + cfile = open(cal_file_full_path, 'r') try: - mask_boundary_inside = self.get_masking_for_index(file, masking_edge) - mask_boundary_outside = self.get_masking_for_index(file, masking_edge+1) + mask_boundary_inside = self.get_masking_for_index(cfile, masking_edge) + mask_boundary_outside = self.get_masking_for_index(cfile, masking_edge+1) self.assertTrue(mask_boundary_inside == expected_masking_identifier) self.assertTrue(mask_boundary_outside == expected_not_masking_identifier) except LookupError: print "Could not find the requested index" self.assertTrue(False) finally: - file.close() + cfile.close() os.remove(cal_file_full_path) def requiredMemoryMB(self): @@ -124,7 +125,7 @@ class WishMasking(stresstesting.MantidStressTest): MaskWorkspaceToCalFile(InputWorkspace=ws, OutputFile=update_cal_file_name, Invert=True) MergeCalFiles(UpdateFile=update_cal_file_path, MasterFile=master_cal_file_path, - OutputFile=merged_cal_file_name, MergeSelections=True) + OutputFile=merged_cal_file_name, MergeSelections=True) update_cal_file = open(update_cal_file_path, 'r') merged_cal_file = open(merged_cal_file_path, 'r') diff --git a/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py b/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py index ea4ce19e8e59e3bbe9440c28120a73e2c104469d..ba8f732a1cb8a017c2d579a4209256ff917d6015 100644 --- a/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py +++ b/Code/Mantid/Testing/SystemTests/tests/analysis/utils.py @@ -173,19 +173,17 @@ def expecting(): print "---", a,b,c,d a, b = c, d = f() print "---", a,b,c,d - ''' - #}}} - - """ Developers Notes: + + Developers Notes: Now works with an multiple assigments correctly. This is verified by test() and test1() below - """ + ''' f = inspect.currentframe().f_back.f_back i = f.f_lasti # index of the last attempted instruction in byte code ins=decompile(f.f_code) #pretty_print(ins) - for (offset, op, name, argument, argtype, argvalue) in ins: + for (offset, dummy_op, name, argument, dummy_argtype, dummy_argvalue) in ins: if offset > i: if name == 'POP_TOP': return 0 @@ -215,17 +213,23 @@ def lhs(output='names'): follow the form below. ''' - """ Developers Notes: - """ + f = inspect.currentframe().f_back.f_back i = f.f_lasti # index of the last attempted instruction in byte code ins=decompile(f.f_code) #pretty_print(ins) CallFunctionLocation={} - first=False; StartIndex=0; StartOffset=0 + first=False + StartIndex=0 + StartOffset=0 # we must list all of the operators that behave like a function call in byte-code - OperatorNames=set(['CALL_FUNCTION','UNARY_POSITIVE','UNARY_NEGATIVE','UNARY_NOT','UNARY_CONVERT','UNARY_INVERT','GET_ITER', 'BINARY_POWER','BINARY_MULTIPLY','BINARY_DIVIDE', 'BINARY_FLOOR_DIVIDE', 'BINARY_TRUE_DIVIDE', 'BINARY_MODULO','BINARY_ADD','BINARY_SUBTRACT','BINARY_SUBSCR','BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR','BINARY_OR']) + OperatorNames=set(['CALL_FUNCTION','UNARY_POSITIVE','UNARY_NEGATIVE', + 'UNARY_NOT','UNARY_CONVERT','UNARY_INVERT','GET_ITER', + 'BINARY_POWER','BINARY_MULTIPLY','BINARY_DIVIDE', + 'BINARY_FLOOR_DIVIDE', 'BINARY_TRUE_DIVIDE', 'BINARY_MODULO', + 'BINARY_ADD','BINARY_SUBTRACT','BINARY_SUBSCR', + 'BINARY_LSHIFT','BINARY_RSHIFT','BINARY_AND','BINARY_XOR','BINARY_OR']) for index in range(len(ins)): (offset, op, name, argument, argtype, argvalue) = ins[index]