Skip to content
Snippets Groups Projects
Unverified Commit 5de18655 authored by Pete Peterson's avatar Pete Peterson Committed by GitHub
Browse files

Merge pull request #21285 from mantidproject/21126_ELWIN

Indirect analysis interface ELWIN tab not working with BASIS files
parents 31e0d1ff 9d2ddafd
No related branches found
No related tags found
No related merge requests found
5233fbb6e769a810a69e74b41306fef3
6cbb3bee5de6a9e4cf3747b93da7623b
......@@ -2,30 +2,82 @@ from __future__ import (absolute_import, division, print_function)
import stresstesting
from mantid import config
from mantid.simpleapi import BASISDiffraction
from mantid.simpleapi import (BASISDiffraction, Load, GroupWorkspaces,
ElasticWindowMultiple)
class OrientedSampleTest(stresstesting.MantidStressTest):
class PreppingMixin(object):
r"""Common code for tests classes
"""
Run a reduction for a scan of runs probing different orientations
of a crystal.
"""
def __init__(self):
super(OrientedSampleTest, self).__init__()
self.config = None
self.setUp()
def setUp(self):
def prepset(self, subdir):
self.config = {p: config[p] for p in ('default.facility',
'default.instrument',
'datasearch.directories')}
config['default.facility'] = 'SNS'
config['default.instrument'] = 'BASIS'
config.appendDataSearchSubDir('BASIS/BASISDiffraction')
config.appendDataSearchSubDir('BASIS/{}/'.format(subdir))
def preptear(self):
for (key, value) in self.config.items():
config[key] = value # config object does not have update method like python dict
class ElwinTest(stresstesting.MantidStressTest, PreppingMixin):
r"""ELWIN tab of the Indirect Inelastic Interface
"""
def __init__(self):
super(ElwinTest, self).__init__()
self.config = None
self.prepset('ELWIN')
def requiredFiles(self):
return ['BASIS_63652_sqw.nxs',
'BASIS_63700_sqw.nxs',
'BASIS_elwin_eq2.nxs']
def runTest(self):
"""
Override parent method, does the work of running the test
"""
# Load files and create workspace group
try:
names = ('BASIS_63652_sqw', 'BASIS_63700_sqw')
[Load(Filename=name + '.nxs', OutputWorkspace=name) for name in names]
GroupWorkspaces(InputWorkspaces=names, OutputWorkspace='elwin_input')
ElasticWindowMultiple(InputWorkspaces='elwin_input',
IntegrationRangeStart=-0.0035,
IntegrationRangeEnd=0.0035,
BackgroundRangeStart=-0.1,
BackgroundRangeEnd=-0.05,
SampleEnvironmentLogName='SensorA',
SampleEnvironmentLogValue='average',
OutputInQ='outQ',
OutputInQSquared='outQ2',
OutputELF='ELF',
OutputELT='ELT')
finally:
self.preptear()
def tearDown(self):
config.update(self.config)
def validate(self):
"""
Inform of workspace output after runTest(), and associated file to
compare to.
:return: strings for workspace and file name
"""
self.tolerance = 0.1
self.disableChecking.extend(['SpectraMap', 'Instrument'])
return 'outQ2', 'BASIS_elwin_eq2.nxs'
class CrystalDiffractionTest(stresstesting.MantidStressTest, PreppingMixin):
r"""Reduction for a scan of runs probing different orientations of a crystal.
"""
def __init__(self):
super(CrystalDiffractionTest, self).__init__()
self.config = None
self.prepset('BASISDiffraction')
def requiredFiles(self):
return ['BASIS_Mask_default_diff.xml',
......@@ -44,7 +96,7 @@ class OrientedSampleTest(stresstesting.MantidStressTest):
RunNumbers='74799-74800',
MaskFile='BASIS_Mask_default_diff.xml',
VanadiumRuns='64642',
BackgroundRun='75527',
BackgroundRuns='75527',
PsiAngleLog='SE50Rot',
PsiOffset=-27.0,
LatticeSizes=[10.71, 10.71, 10.71],
......@@ -57,7 +109,7 @@ class OrientedSampleTest(stresstesting.MantidStressTest):
Nbins=300,
OutputWorkspace='peaky')
finally:
self.tearDown()
self.preptear()
def validate(self):
"""
......
9abcc21224d7486948e6006b0424fe73
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment