diff --git a/Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py b/Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py index 31be17b981cc17de96c60136dad2409db11d4fb6..630a4dfd11445fe633833af873422fb8d97c433b 100644 --- a/Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py +++ b/Framework/PythonInterface/plugins/algorithms/AlignAndFocusPowderFromFiles.py @@ -11,8 +11,8 @@ from mantid.api import mtd, AlgorithmFactory, DistributedDataProcessorAlgorithm, from mantid.kernel import Direction, PropertyManagerDataService from mantid.simpleapi import AlignAndFocusPowder, CompressEvents, ConvertDiffCal, ConvertUnits, CopyLogs, \ CreateCacheFilename, DeleteWorkspace, DetermineChunking, Divide, EditInstrumentGeometry, FilterBadPulses, \ - LoadDiffCal, Load, LoadNexusProcessed, PDDetermineCharacterizations, Plus, RebinToWorkspace, RemoveLogs, \ - RenameWorkspace, SaveNexusProcessed + LoadDiffCal, Load, LoadIDFFromNexus, LoadNexusProcessed, PDDetermineCharacterizations, Plus, \ + RebinToWorkspace, RemoveLogs, RenameWorkspace, SaveNexusProcessed import os import numpy as np @@ -366,8 +366,13 @@ class AlignAndFocusPowderFromFiles(DistributedDataProcessorAlgorithm): self.__setupCalibration(chunkname) # copy the necessary logs onto the workspace - if haveAccumulationForFile and len(chunks) > 1 and canSkipLoadingLogs: + if len(chunks) > 1 and canSkipLoadingLogs and haveAccumulationForFile: CopyLogs(InputWorkspace=wkspname, OutputWorkspace=chunkname, MergeStrategy='WipeExisting') + # re-load instrument so detector positions that depend on logs get initialized + try: + LoadIDFFromNexus(Workspace=chunkname, Filename=filename, InstrumentParentPath='/entry') + except RuntimeError as e: + self.log().warning('Reloading instrument using "LoadIDFFromNexus" failed: {}'.format(e)) # get the underlying loader name if we used the generic one if self.__loaderName == 'Load': diff --git a/Framework/PythonInterface/plugins/algorithms/SNAPReduce.py b/Framework/PythonInterface/plugins/algorithms/SNAPReduce.py index 7fe4447e4a82238ea5da7c92125b4b0e060b3dac..0ab071068e68bf8772de81cbe70f5eb5fd97514e 100644 --- a/Framework/PythonInterface/plugins/algorithms/SNAPReduce.py +++ b/Framework/PythonInterface/plugins/algorithms/SNAPReduce.py @@ -187,6 +187,9 @@ class SNAPReduce(DataProcessorAlgorithm): + "All detectors as one group, Groups (East,West for " + "SNAP), Columns for SNAP, detector banks") + self.declareProperty("MaxChunkSize", 16., + "Specify maximum Gbytes of file to read in one chunk. Zero reads the whole file at once.") + mode = ["Set-Up", "Production"] self.declareProperty("ProcessingMode", mode[1], StringListValidator(mode), "Set-Up Mode is used for establishing correct parameters. Production " @@ -394,7 +397,7 @@ class SNAPReduce(DataProcessorAlgorithm): progEnd = progStart + .9 * progDelta # pass all of the work to the child algorithm AlignAndFocusPowderFromFiles(Filename=filename, OutputWorkspace=wkspname , - MaxChunkSize=16, # GiB + MaxChunkSize=self.chunksize, UnfocussedWorkspace=unfocussed, # can be empty string startProgress=progStart, endProgress=progEnd, @@ -412,6 +415,7 @@ class SNAPReduce(DataProcessorAlgorithm): in_Runs = self.getProperty("RunNumbers").value progress = Progress(self, 0., .25, 3) finalUnits = self.getPropertyValue("FinalUnits") + self.chunkSize = self.getProperty('MaxChunkSize').value # default arguments for AlignAndFocusPowder self.alignAndFocusArgs = {'Tmin': 0, diff --git a/docs/source/release/v4.2.0/diffraction.rst b/docs/source/release/v4.2.0/diffraction.rst index 4475f6eda2f2292fef0eda361629f9be2c643993..8edd5768d67e58b6428f1a439a40a1f98d185a86 100644 --- a/docs/source/release/v4.2.0/diffraction.rst +++ b/docs/source/release/v4.2.0/diffraction.rst @@ -19,12 +19,13 @@ Improvements - The file-naming scheme for ISIS powder is now controlled by a string template - The file-naming of output on HRPD as been updated to closely match old script outputs - Geometry definition for LLB 5C1 +- :ref:`SNAPReduce <algm-SNAPReduce-v1>` has an additional parameter ``MaxChunkSize`` for customizing the chunking behavior Bug Fixes ######### - The values used to mask the prompt pulse on HRPD have been fixed. - +- :ref:`AlignAndFocusPowderFromFiles <algm-AlignAndFocusPowderFromFiles-v1>` will reload the instrument if logs are skipped Engineering Diffraction -----------------------