Mesh Scan

Samples a points on a uniform mesh, or from a user defined set of values. The mesh is either constructed from (min, max, samples), taking equally spaced samples between min and max or can be from a user defined mesh stored in NumPy’s default .npy format. For N parameters and M samples this will result in the evaluation of M^N in total.

For a mesh scan if the final code of the job chain is serial Python and if an objective function is not provided (see below) then the return value of the Python function must be either None or float.

Configuration

Requirements and optional keys for setting up the configuration file to use Mesh Scan are given below.

Codes Blocks

  • samples [int (required)]: Each parameter must have a specified number of samples given. If samples: 1 then the parameter is set to its start value.

Options

The following required and optional keys can be used within the options: block:

  • software [str (required)]: mesh_scan

  • mesh_file [str (optional)]: The name of a file giving the points to evaluate for the scan. The array should be formatted to have a shape of (N, M) where N is the length of the parameter vector and M is the number of samples.

  • software_options [dict (optional)]: * sampler_repeats: Default=1. Repeat the scan this many times. Repeated points will be run after the first

    point until completed before new samples are run.

Objective Function

An objective function is not required for a sampling run, but may be provided. If an objective function is provided the returned value will be recorded in the f field of the history file. The objective function must return a single value of type float.

 1   # As passed to options.objective_function:
 2   def obj_f(J):
 3       # Objective function is always passed
 4       # to the rsopt job dictionary `J`
 5
 6       # ... Code to calculate objective value `f`
 7
 8       return f
 9
10   # Example if using code block type `python`
11   # without options.objective_function:
12   def my_function(x, y):
13       # Assuming user defined `parameters` (x, y)
14       # in the configuration file
15
16       f = x**2 + y**2 + x * y
17
18       return f