ess.reflectometry.tools.batch_compute#

ess.reflectometry.tools.batch_compute(workflow, runs, target=ess.reflectometry.orso.OrsoIofQDataset, *, scale_to_overlap=False)[source]#

Computes requested target(s) from a supplied workflow for a number of runs. Each entry of runs is a mapping of parameters and values needed to produce the targets.

This is an alternative to using batch_processor(): instead of returning a BatchProcessor object which can operate on multiple workflows at once, this function directly computes the requested targets, reducing the risk of accidentally compromizing the workflows in the collection.

It also provides the option to scale the reflectivity curves so that they overlap in the regions where they have the same Q-value.

Beginners should prefer this function over batch_processor() unless they need the extra flexibility of the latter (caching intermediate results, quickly exploring results, etc).

Example:

` :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`list\` \| \:py\:class\:\`\~collections.abc.Mapping\

from ess.reflectometry import amor, tools

workflow = amor.AmorWorkflow()

runs = {
‘608’: {

SampleRotationOffset[SampleRun]: sc.scalar(0.05, unit=’deg’), Filename[SampleRun]: “file_608.hdf”,

}, ‘609’: {

SampleRotationOffset[SampleRun]: sc.scalar(0.05, unit=’deg’), Filename[SampleRun]: “file_609.hdf”,

}, ‘610’: {

SampleRotationOffset[SampleRun]: sc.scalar(0.05, unit=’deg’), Filename[SampleRun]: “file_610.hdf”,

}, ‘611’: {

SampleRotationOffset[SampleRun]: sc.scalar(0.05, unit=’deg’), Filename[SampleRun]: “file_611.hdf”,

},

}

r_of_q = tools.batch_compute(workflow, runs, target=ReflectivityOverQ) ```

Additionally, if a list of filenames is provided for Filename[SampleRun], the events from the files will be concatenated into a single event list before processing.

Example:

``` runs = {

‘608’: {

Filename[SampleRun]: “file_608.hdf”,

}, ‘609+610’: {

Filename[SampleRun]: [“file_609.hdf”, “file_610.hdf”],

},

}#

type workflow:

Pipeline

param workflow:

The sciline workflow used to compute ReflectivityOverQ for each of the runs.

type runs:

Sequence[Mapping[type, Any]] | Mapping[Any, Mapping[type, Any]]

param runs:

The sciline parameters to be used for each run.

type target:

type | Sequence[type], default: ess.reflectometry.orso.OrsoIofQDataset

param target:

The domain type(s) to compute for each run.

type scale_to_overlap:

bool | tuple[Variable, Variable] | list[Variable], default: False

param scale_to_overlap:

If True the loaded data will be scaled so that the computed reflectivity curves to overlap. If a tuple is provided, it is interpreted as a critical edge interval where the reflectivity is known to be 1.