diff --git a/Framework/Kernel/src/Property.cpp b/Framework/Kernel/src/Property.cpp index 920a52e495247bef941ee746f531ea7bd3c76bdd..938358d8e2b8cc063baf842bfe20b322c02ac7f9 100644 --- a/Framework/Kernel/src/Property.cpp +++ b/Framework/Kernel/src/Property.cpp @@ -351,6 +351,7 @@ std::string getUnmangledTypeName(const std::type_info &type) { typestrings.emplace(typeid(string).name(), string("string")); typestrings.emplace(typeid(std::vector<string>).name(), string("str list")); typestrings.emplace(typeid(std::vector<int>).name(), string("int list")); + typestrings.emplace(typeid(std::vector<long>).name(), string("long list")); typestrings.emplace(typeid(std::vector<int64_t>).name(), string("int list")); typestrings.emplace(typeid(std::vector<size_t>).name(), diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py index ac71d1bf20681879319ce4e2b11f084a706e98a6..6fddc8cc8b710a9229680cce4682afe7952f585c 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLAutoProcess.py @@ -108,7 +108,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): def category(self): """Return the categories of the algrithm.""" - return 'ILL\\Reflectometry;Workflow\\Reflectometry' + return 'ILL\\Reflectometry;ILL\\Auto;Workflow\\Reflectometry' def name(self): """Return the name of the algorithm.""" @@ -116,7 +116,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): def summary(self): """Return a summary of the algorithm.""" - return "Reduction of ILL reflectometry data." + return "Performs reduction of ILL reflectometry data, instruments D17 and FIGARO." def seeAlso(self): """Return a list of related algorithm names.""" @@ -142,7 +142,6 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): nonnegativeFloatArray.setLower(0.) stringArrayValidator = StringArrayLengthValidator() stringArrayValidator.setLengthMin(1) - listOrSingleNumber = ': provide either a list or a single value.' #======================== Main Properties ======================== self.declareProperty(PropertyNames.POLARIZATION_OPTION, @@ -283,7 +282,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): PropertyNames.THETA, values=[Property.EMPTY_DBL] ), - doc='A user-defined angle theta in degree' + listOrSingleNumber + doc='A user-defined angle theta in degree' ) self.declareProperty( StringArrayProperty( @@ -352,7 +351,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): validator=nonnegativeInts, ), doc='Distance of flat background region towards smaller detector angles from the ' + - 'foreground centre, in pixels' + listOrSingleNumber + 'foreground centre, in pixels' ) self.setPropertyGroup(PropertyNames.LOW_BKG_OFFSET_DIRECT, preProcessDirect) self.declareProperty( @@ -362,7 +361,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): validator=nonnegativeInts, ), doc='Width of flat background region towards smaller detector angles from the ' + - 'foreground centre, in pixels' + listOrSingleNumber + 'foreground centre, in pixels' ) self.setPropertyGroup(PropertyNames.LOW_BKG_WIDTH_DIRECT, preProcessDirect) self.declareProperty( @@ -381,7 +380,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): validator=nonnegativeInts, ), doc='Distance of flat background region towards larger detector angles from the ' + - 'foreground centre, in pixels' + listOrSingleNumber + 'foreground centre, in pixels' ) self.setPropertyGroup(PropertyNames.HIGH_BKG_OFFSET_DIRECT, preProcessDirect) self.declareProperty( @@ -391,7 +390,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): validator=nonnegativeInts, ), doc='Width of flat background region towards larger detector angles from the ' + - 'foreground centre, in pixels' + listOrSingleNumber + 'foreground centre, in pixels' ) self.setPropertyGroup(PropertyNames.HIGH_BKG_WIDTH_DIRECT, preProcessDirect) self.declareProperty( @@ -400,7 +399,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): values=[0], validator=nonnegativeInts, ), - doc='Start histogram index used for peak fitting' + listOrSingleNumber + doc='Start histogram index used for peak fitting' ) self.setPropertyGroup(PropertyNames.START_WS_INDEX_DIRECT, preProcessDirect) self.declareProperty( @@ -409,7 +408,7 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): values=[255], validator=nonnegativeInts, ), - doc='Last histogram index used for peak fitting' + listOrSingleNumber + doc='Last histogram index used for peak fitting' ) self.setPropertyGroup(PropertyNames.END_WS_INDEX_DIRECT, preProcessDirect) self.declareProperty( @@ -774,12 +773,13 @@ class ReflectometryILLAutoProcess(DataProcessorAlgorithm): self._autoCleanup.protect(convertedToQName) progress.report() - try: - stitched = self._outWS + '_stitched' - Stitch1DMany(InputWorkspaces=to_group, OutputWorkspace=stitched) - to_group.append(stitched) - except RuntimeError as re: - self.log().warning('Unable to stitch automatically, consider stitching manually: ' + re.message) + if len(to_group) > 1: + try: + stitched = self._outWS + '_stitched' + Stitch1DMany(InputWorkspaces=to_group, OutputWorkspace=stitched) + to_group.append(stitched) + except RuntimeError as re: + self.log().warning('Unable to stitch automatically, consider stitching manually: ' + re.message) GroupWorkspaces(InputWorkspaces=to_group, OutputWorkspace=self._outWS) self.setProperty(Prop.OUTPUT_WS, self._outWS) diff --git a/docs/source/algorithms/ReflectometryILLAutoProcess-v1.rst b/docs/source/algorithms/ReflectometryILLAutoProcess-v1.rst index 5b69e0a0c7d265949af9ebae4dee6bb6e0726d89..acfcd8375c5c20705e32c0224c3e50c51179ff57 100644 --- a/docs/source/algorithms/ReflectometryILLAutoProcess-v1.rst +++ b/docs/source/algorithms/ReflectometryILLAutoProcess-v1.rst @@ -2,33 +2,47 @@ .. summary:: -.. relatedalgorithms:: - -.. properties:: - Description ----------- -This is the reduction work-flow algorithm for the ILL reflectometers D17 and FIGARO. -A various number of corresponding direct and reflected angles can be processed. -Some input properties like the background indices accept either a single entry for all angles, i.e. number of reflected or direct beams, or an entry for each corresponding angle. -Please note, however, that direct beam work-spaces for each angle are stored in the AnalysisDataService for efficient re-use of further reductions. -The input runs must be NeXus files (file ending .nxs) and different angles will be comma separated while merging angles will be performed when giving a *+*. +This algorithm executes the full data reduction for ILL reflectometers D17 and FIGARO in TOF mode (specular reflection). +It supports the treatment of measurements at several angles together. +It offers incoherent (sum along constant :math:`\lambda`) or coherent (sum along constant :math:`Q_{z}`) methods of peak summation. +Treatment of polarized measurements is also provided. -Limitations ------------ +Input +----- + +The mandatory inputs are comma separated list of nexus files for direct and reflected beam measurements. +`,` stands as the separator of different angle configurations. +`+` (sum) or `-` (range sum) operations can be used to sum different files at the same instrument configuration. +When summing, the metadata (e.g. acquisition time) will also be summed, so that the subsequent normalisation is handled correctly. +There must be the same number of angle configurations both for direct and reflected beam inputs. + +Output +------ + +The output is a workspace group that contains the calculated reflectivity curves as a function of the momentum transfer. +The output is point data and has the calculated Q resolution attributed to it. +There is a separate output for each angle configuration. +An automatically stitched result is also produced. +Stitch in this case just takes the union of all the initial points without merging or removal, only scaling can be applied. +The outputs can be readily saved by :ref:`SaveReflectometryAscii <algm-SaveReflectometryAscii>` algorithm for further analysis. -The polarisation correction is foreseen but not exposed to be used (missing reflected beam inputs). -The D17 incoherent reduction with Sample Angle option will most likely produce equivalent data to Cosmos. -The D17 incoherent reduction with Detector Angle option may show a shift in Momentum Transfer. -The D17 coherent reduction often produces equivalent data to Cosmos, but rarely a shift in Momentum Transfer can be observed and need still to be investigated. -The detector angle option is more critical to use than the sample angle option. -It likely happens that the reduced output work-space does not have the same number of points as the Cosmos reduction result. -For FIGARO, a good agreement of the reduction could be observed, but not enough experiments were compared. -Not all options of the Cosmos GUI are available. For example, a modification of variables taken from the NeXus file should be done via the available instrument control tools. +BraggAngle +---------- -Work-flow ---------- +If user specified :math:`\theta` angles are provided, they will be used. +Otherwise `SampleAngle` or `DetectorAngle` (default) option is executed. + +Options +------- + +Many options can be specified as a single value, which will be applied to all the angle configurations, or as a list of values. +In the case of the latter, the list must be of the same size, as many different angle configurations there are. + +Workflow +-------- The processing of the direct and reflected beams are shown in the following diagrams. @@ -52,24 +66,32 @@ Usage ws = ReflectometryILLAutoProcess( Run='ILL/D17/317370.nxs', DirectRun='ILL/D17/317369.nxs', - DirectLowAngleForegroundHalfWidth=foreground, - DirectHighAngleForegroundHalfWidth=foreground, + DirectLowAngleFrgHalfWidth=foreground, + DirectHighAngleFrgHalfWidth=foreground, DirectLowAngleBkgOffset=angleOffset, DirectLowAngleBkgWidth=angleWidth, DirectHighAngleBkgOffset=angleOffset, DirectHighAngleBkgWidth=angleWidth, - LowAngleForegroundHalfWidth=foreground, - HighAngleForegroundHalfWidth=foreground, - LowAngleBkgOffset=angleOffset, - LowAngleBkgWidth=angleWidth, - HighAngleBkgOffset=angleOffset, - HighAngleBkgWidth=angleWidth, - WavelengthLower=0.0, - WavelengthUpper=31.0 - ) + ReflLowAngleFrgHalfWidth=foreground, + ReflHighAngleFrgHalfWidth=foreground, + ReflLowAngleBkgOffset=angleOffset, + ReflLowAngleBkgWidth=angleWidth, + ReflHighAngleBkgOffset=angleOffset, + ReflHighAngleBkgWidth=angleWidth, + WavelengthLowerBound=3.5, + WavelengthUpperBound=25. + ) + + print('The R(Q) workspace has {0} points, from {1} to {2} inverse Angstrom'.format(ws.getItem(0).blocksize(), ws.getItem(0).readX(0)[0], ws.getItem(0).readX(0)[-1])) .. testoutput:: ReflectometryILLAutoProcess1 + The R(Q) workspace has 688 points, from 0.00678002009846 to 0.0479086988309 inverse Angstrom + +.. relatedalgorithms:: + +.. properties:: + .. categories:: .. sourcelink::