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. Ifsamples: 1then the parameter is set to itsstartvalue.
Options¶
The following required and optional keys can be used within the options: block:
software[str (required)]:mesh_scanmesh_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.
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