diff --git a/docs/source/release/v3.10.0/sans.rst b/docs/source/release/v3.10.0/sans.rst index ac6e98c873e7093c56f88a353d3d7c20dab02e3f..85971e8707d16ae3b746ecf92c8ba58743bd1a51 100644 --- a/docs/source/release/v3.10.0/sans.rst +++ b/docs/source/release/v3.10.0/sans.rst @@ -13,5 +13,7 @@ Bug Fixes - Fixed LOQ Batch mode bug where custom user file without a .txt ending was not being picked up. - Fixed Batch mode bug where the output name suffix was hardcoded to SANS2D. It now takes the individual instruments into account. - Fixed LOQ bug where prompt peak was not set correctly for monitor normalisation. +- Fixed Batch mode bug where merged reductions set in the GUI were not respected. + `Full list of changes on github <http://github.com/mantidproject/mantid/pulls?q=is%3Apr+milestone%3A%22Release+3.10%22+is%3Amerged+label%3A%22Component%3A+SANS%22>`__ diff --git a/scripts/SANS/SANSBatchMode.py b/scripts/SANS/SANSBatchMode.py index ab0ab26821c34ea2a47016c5a47f1823df563aa7..533a1a271fa929fe2041c94610ca1400129691ed 100644 --- a/scripts/SANS/SANSBatchMode.py +++ b/scripts/SANS/SANSBatchMode.py @@ -226,6 +226,10 @@ def BatchReduce(filename, format, plotresults=False, saveAlgs={'SaveRKH':'txt'}, original_user_file = ReductionSingleton().user_settings.filename current_user_file = original_user_file + # Store the original combineDet which was set either by the input. this should be used whenever we are using the + # original user file + original_combine_det = combineDet + # Now loop over all the lines and do a reduction (hopefully) for each for run in runinfo: # Set the user file, if it is required @@ -235,12 +239,16 @@ def BatchReduce(filename, format, plotresults=False, saveAlgs={'SaveRKH':'txt'}, original_user_file=original_user_file, original_settings = settings, original_prop_man_settings = prop_man_settings) - # When we set a new user file, that means that the combineDet feature could be invalid, - # ie if the detector under investigation changed in the user file. We need to change this - # here too. But only if it is not None. - if combineDet is not None: - new_combineDet = ReductionSingleton().instrument.get_detector_selection() - combineDet = su.get_correct_combinDet_setting(ins_name, new_combineDet) + + if current_user_file == original_user_file: + combineDet = original_combine_det + else: + # When we set a new user file, that means that the combineDet feature could be invalid, + # ie if the detector under investigation changed in the user file. We need to change this + # here too. But only if it is not None. + if combineDet is not None: + new_combineDet = ReductionSingleton().instrument.get_detector_selection() + combineDet = su.get_correct_combinDet_setting(ins_name, new_combineDet) except (RuntimeError, ValueError) as e: sanslog.warning("Error in Batchmode user files: Could not reset the specified user file %s. More info: %s" %( str(run['user_file']), str(e))) diff --git a/scripts/SANS/SANSUtility.py b/scripts/SANS/SANSUtility.py index 784a9277e78b23ff7c9b2bb2f2bc3058554eaacc..14c223bfdda4d35ebeabe4e22dbafe5e4d130cb5 100644 --- a/scripts/SANS/SANSUtility.py +++ b/scripts/SANS/SANSUtility.py @@ -1997,7 +1997,7 @@ def get_correct_combinDet_setting(instrument_name, detector_selection): detector_selection = detector_selection.upper() # If we are dealing with LOQ, then the correct combineDet selection is if instrument_name == "LOQ": - if detector_selection == "MAIN": + if detector_selection == "MAIN" or detector_selection == "MAIN-DETECTOR-BANK": new_combine_detector_selection = 'rear' elif detector_selection == "HAB": new_combine_detector_selection = 'front' @@ -2012,9 +2012,9 @@ def get_correct_combinDet_setting(instrument_name, detector_selection): # If we are dealing with SANS2D, then the correct combineDet selection is if instrument_name == "SANS2D": - if detector_selection == "REAR": + if detector_selection == "REAR" or detector_selection == "REAR-DETECTOR": new_combine_detector_selection = 'rear' - elif detector_selection == "FRONT": + elif detector_selection == "FRONT" or detector_selection == "FRONT-DETECTOR": new_combine_detector_selection = 'front' elif detector_selection == "MERGED": new_combine_detector_selection = 'merged' diff --git a/scripts/test/SANSUtilityTest.py b/scripts/test/SANSUtilityTest.py index 41c4f82cfd8e317b35902390e69285919933a434..796bc47d9d18d2c439d9737e7a12f0c2e609bd39 100644 --- a/scripts/test/SANSUtilityTest.py +++ b/scripts/test/SANSUtilityTest.py @@ -1598,10 +1598,13 @@ class TestSelectNewDetector(unittest.TestCase): def test_that_for_SANS2D_correct_settings_are_selected(self): self.assertTrue(su.get_correct_combinDet_setting("SANS2d", "rear") == "rear") self.assertTrue(su.get_correct_combinDet_setting("SANS2D", "FRONT") == "front") + self.assertTrue(su.get_correct_combinDet_setting("SANS2d", "rear-detector") == "rear") + self.assertTrue(su.get_correct_combinDet_setting("SANS2D", "FRONT-DETECTOR") == "front") self.assertTrue(su.get_correct_combinDet_setting("sAnS2d", "boTH") == "both") self.assertTrue(su.get_correct_combinDet_setting("sans2d", "merged") == "merged") def test_that_for_LOQ_correct_settings_are_selected(self): + self.assertTrue(su.get_correct_combinDet_setting("Loq", "main-detector-bank") == "rear") self.assertTrue(su.get_correct_combinDet_setting("Loq", "main") == "rear") self.assertTrue(su.get_correct_combinDet_setting("LOQ", "Hab") == "front") self.assertTrue(su.get_correct_combinDet_setting("lOQ", "boTH") == "both")