From 47fcc83f0624affa6087c5b10cee3a395e5a888e Mon Sep 17 00:00:00 2001 From: Antti Soininen <soininen@ill.fr> Date: Tue, 4 Sep 2018 14:44:42 +0200 Subject: [PATCH] Fix DirectILL* usage examples Facility has to be set to 'ILL' in testsetup. Re #20453 --- .../DirectILLApplySelfShielding-v1.rst | 5 ++++ .../algorithms/DirectILLCollectData-v1.rst | 5 ++++ .../algorithms/DirectILLDiagnostics-v1.rst | 10 +++++++ .../DirectILLIntegrateVanadium-v1.rst | 5 ++++ .../algorithms/DirectILLSelfShielding-v1.rst | 5 ++++ docs/source/techniques/DirectILL.rst | 30 +++++++++++++++++++ 6 files changed, 60 insertions(+) diff --git a/docs/source/algorithms/DirectILLApplySelfShielding-v1.rst b/docs/source/algorithms/DirectILLApplySelfShielding-v1.rst index 8d7f43e17d6..cec71400d68 100644 --- a/docs/source/algorithms/DirectILLApplySelfShielding-v1.rst +++ b/docs/source/algorithms/DirectILLApplySelfShielding-v1.rst @@ -22,6 +22,11 @@ Usage **Example - Absorption corrections and empty container subtraction** +.. testsetup:: IN4Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN4Example import numpy diff --git a/docs/source/algorithms/DirectILLCollectData-v1.rst b/docs/source/algorithms/DirectILLCollectData-v1.rst index 3a7330a400d..9b544928e02 100644 --- a/docs/source/algorithms/DirectILLCollectData-v1.rst +++ b/docs/source/algorithms/DirectILLCollectData-v1.rst @@ -120,6 +120,11 @@ Usage **Example - Basic usage as an advanced loader** +.. testsetup:: IN4Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN4Example # It is recommended to use DirectILLCollectData over the basic Load diff --git a/docs/source/algorithms/DirectILLDiagnostics-v1.rst b/docs/source/algorithms/DirectILLDiagnostics-v1.rst index 15281023083..fbe08a8a5e0 100644 --- a/docs/source/algorithms/DirectILLDiagnostics-v1.rst +++ b/docs/source/algorithms/DirectILLDiagnostics-v1.rst @@ -105,6 +105,11 @@ Usage **Example - Diagnostics on IN4 workspace** +.. testsetup:: IN4Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN4Example DirectILLCollectData( @@ -138,6 +143,11 @@ Output: **Example - Diagnostics on IN5 workspace** +.. testsetup:: IN5Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN5Example # On IN5 we don't usually diagnose the pixels, but apply diff --git a/docs/source/algorithms/DirectILLIntegrateVanadium-v1.rst b/docs/source/algorithms/DirectILLIntegrateVanadium-v1.rst index 90f039437d8..57868b99773 100644 --- a/docs/source/algorithms/DirectILLIntegrateVanadium-v1.rst +++ b/docs/source/algorithms/DirectILLIntegrateVanadium-v1.rst @@ -31,6 +31,11 @@ Usage **Example - Integrating vanadium** +.. testsetup:: IN4Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN4Example DirectILLCollectData( diff --git a/docs/source/algorithms/DirectILLSelfShielding-v1.rst b/docs/source/algorithms/DirectILLSelfShielding-v1.rst index 0f1230f207f..bd0309424c8 100644 --- a/docs/source/algorithms/DirectILLSelfShielding-v1.rst +++ b/docs/source/algorithms/DirectILLSelfShielding-v1.rst @@ -24,6 +24,11 @@ Usage **Example - Calculating absorption corrections** +.. testsetup:: IN4Example + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: IN4Example preprocessed = DirectILLCollectData(Run='ILL/IN4/087294-087295') diff --git a/docs/source/techniques/DirectILL.rst b/docs/source/techniques/DirectILL.rst index fd9182f92db..51667964a9f 100644 --- a/docs/source/techniques/DirectILL.rst +++ b/docs/source/techniques/DirectILL.rst @@ -59,6 +59,11 @@ A very basic reduction would include a vanadium reference and a sample and follo On instruments like IN4 and IN6, these steps would translate to something like the following simple Python script: +.. testsetup:: BasicIN4Reduction + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: BasicIN4Reduction # Uncomment to add a temporary data search directory. @@ -187,6 +192,11 @@ A more complete reduction example would include corrections for self-shielding: The above workflow would translate to this kind of Python script for IN4 and IN6: +.. testsetup:: SelfShieldingReduction + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: SelfShieldingReduction # Uncomment to add a temporary data search directory. @@ -266,6 +276,11 @@ Mantid can be picky with binning when doing arithmetics between workspaces. This To alleviate the situation, the output workspaces of :ref:`algm-DirectILLCollectData` can be forced to use the same wavelength. The following Python script shows how to propagate the calibrated incident energy from the first loaded workspace into the rest: +.. testsetup:: SampleContainerCompatibility + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: SampleContainerCompatibility # Sample @@ -320,6 +335,11 @@ With empty container data, the steps to reduce the experimental data might look A corresponding Python script follows. +.. testsetup:: ContainerSubtraction + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: ContainerSubtraction # Uncomment to add a temporary data search directory. @@ -401,6 +421,11 @@ Interpolation of container data to different temperatures Sometimes the empty container is not measured at all the experiment's temperature points. One can use Mantid's workspace arithmetics to perform simple linear interpolation in temperature: +.. testsetup:: ContainerInterpolation + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: ContainerInterpolation import numpy @@ -479,6 +504,11 @@ Lets put it all together into a complex Python script. The script below reduces * Need to interpolate to 50K. +.. testsetup:: FullExample + + config['default.facility'] = 'ILL' + config['default.instrument'] = 'IN4' + .. testcode:: FullExample # Uncomment to add a temporary data search directory. -- GitLab