Skip to content

Commit

Permalink
add VanadiumIntegWorkspace to EnggCalibrate, test now fast, re #12426
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Jul 15, 2015
1 parent 0318f17 commit 60746a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def PyInit(self):
'are added as two columns in a single row. If not given, no table is '
'generated.')

self.declareProperty(ITableWorkspaceProperty("VanadiumIntegWorkspace", "",
Direction.Input, PropertyMode.Optional),
'Results of integrating the spectra of a Vanadium run, with one column '
'(integration result) and one row per spectrum. This can be used in '
'combination with OutVanadiumCurveFits from a previous execution and '
'VanadiumWorkspace to provide pre-calculated values for Vanadium correction.')

self.declareProperty("Difc", 0.0, direction = Direction.Output,\
doc = "Calibrated Difc value for the bank or range of pixels/detectors given")

Expand Down Expand Up @@ -121,6 +128,10 @@ def _focusRun(self, ws, vanWS, bank, indices):
alg.setProperty('Bank', bank)
alg.setProperty(self.INDICES_PROP_NAME, indices)

integWS = self.getProperty('VanadiumIntegWorkspace').value
if integWS:
alg.setProperty('VanadiumIntegWorkspace', integWS)

detPos = self.getProperty('DetectorPositions').value
if detPos:
alg.setProperty('DetectorPositions', detPos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class EnggCalibrateTest(unittest.TestCase):

_data_ws = None
_van_ws = None
_van_integ_tbl = None

# Note not using @classmethod setUpClass / tearDownClass because that's not supported in the old
# unittest of rhel6
Expand All @@ -17,7 +18,15 @@ def setUp(self):
self.__class__._data_ws = LoadNexus("ENGINX00228061.nxs", OutputWorkspace='ENGIN-X_test_ws')

if not self.__class__._van_ws:
self.__class__._van_ws = LoadNexus("ENGINX00236516.nxs", OutputWorkspace='ENGIN-X_test_vanadium_ws')
# Note the pre-calculated file instead of the too big vanadium run
# self.__class__._van_ws = LoadNexus("ENGINX00236516.nxs", OutputWorkspace='ENGIN-X_test_vanadium_ws')
self.__class__._van_ws = LoadNexus(Filename=
'ENGINX_precalculated_vanadium_run000236516_bank_curves.nxs',
OutputWorkspace='ENGIN-X_vanadium_curves_test_ws')
self.__class__._van_integ_tbl = LoadNexus(Filename=
'ENGINX_precalculated_vanadium_run000236516_integration.nxs',
OutputWorkspace='ENGIN-X_vanadium_integ_test_ws')


def test_issues_with_properties(self):
"""
Expand Down Expand Up @@ -70,6 +79,7 @@ def test_runs_ok(self):

difc, zero = EnggCalibrate(InputWorkspace=self.__class__._data_ws,
VanadiumWorkspace=self.__class__._van_ws,
VanadiumIntegWorkspace=self.__class__._van_integ_tbl,
ExpectedPeaks=[1.6, 1.1, 1.8], Bank='2')

self.check_3peaks_values(difc, zero)
Expand All @@ -83,6 +93,7 @@ def test_runs_ok_with_peaks_file(self):
filename = 'EnginX_3_expected_peaks_unittest.csv'
difc, zero = EnggCalibrate(InputWorkspace=self.__class__._data_ws,
VanadiumWorkspace=self.__class__._van_ws,
VanadiumIntegWorkspace=self.__class__._van_integ_tbl,
ExpectedPeaks=[-4, 40, 323], # nonsense, but FromFile should prevail
ExpectedPeaksFromFile=filename,
Bank='2')
Expand Down

0 comments on commit 60746a9

Please sign in to comment.