From a59f035c948b1889bb1a879e0b360cf149aa006c Mon Sep 17 00:00:00 2001 From: Harriet Brown <harriet.brown@stfc.ac.uk> Date: Tue, 4 Feb 2020 14:47:35 +0000 Subject: [PATCH] Add test for new functionality for powder polaris This commit adds system tests for the new fourier filter in powder polaris. re: 27773 --- .../tests/analysis/ISIS_PowderPolarisTest.py | 23 +++++++++++++++++-- .../polaris_routines/polaris_algs.py | 1 - 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Testing/SystemTests/tests/analysis/ISIS_PowderPolarisTest.py b/Testing/SystemTests/tests/analysis/ISIS_PowderPolarisTest.py index 6dd9274baf6..a38d58126db 100644 --- a/Testing/SystemTests/tests/analysis/ISIS_PowderPolarisTest.py +++ b/Testing/SystemTests/tests/analysis/ISIS_PowderPolarisTest.py @@ -229,13 +229,32 @@ class TotalScatteringPdfTypeTest(systemtesting.MantidSystemTest): self.assertAlmostEqual(self.pdf_output.dataY(0)[37], 1.0152123, places=3) -def run_total_scattering(run_number, merge_banks, q_lims=None, output_binning=None, pdf_type="G(r)"): +class TotalScatteringFilterTest(systemtesting.MantidSystemTest): + + pdf_output = None + + def runTest(self): + setup_mantid_paths() + # Load Focused ws + mantid.LoadNexus(Filename=total_scattering_input_file, OutputWorkspace='98533-Results-TOF-Grp') + q_lims = np.array([2.5, 3, 4, 6, 7, 3.5, 5, 7, 11, 40]).reshape((2, 5)) + self.pdf_output = run_total_scattering('98533', True, q_lims=q_lims, freq_params=[1]) + + def validate(self): + # Whilst total scattering is in development, the validation will avoid using reference files as they will have + # to be updated very frequently. In the meantime, the expected peak in the PDF at ~3.9 Angstrom will be checked. + # After rebin this is at X index 37 + self.assertAlmostEqual(self.pdf_output.dataY(0)[37], 0.6068334, places=3) + + +def run_total_scattering(run_number, merge_banks, q_lims=None, output_binning=None, pdf_type="G(r)", freq_params=None): pdf_inst_obj = setup_inst_object(mode="PDF") return pdf_inst_obj.create_total_scattering_pdf(run_number=run_number, merge_banks=merge_banks, q_lims=q_lims, output_binning=output_binning, - pdf_type=pdf_type) + pdf_type=pdf_type, + freq_params=freq_params) def _gen_required_files(): diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py index b4b2ca10511..272cdb642e0 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py @@ -7,7 +7,6 @@ from __future__ import (absolute_import, division, print_function) import numpy as np -from mantid import AnalysisDataService as ADS import mantid.simpleapi as mantid from six import string_types -- GitLab