c3.optimizers.calibration

Object that deals with the closed loop optimal control.

Module Contents

class c3.optimizers.calibration.Calibration(eval_func, pmap, algorithm, dir_path=None, exp_type=None, exp_right=None, options={}, run_name=None, logger: List = None)[source]

Bases: c3.optimizers.optimizer.Optimizer

Inheritance diagram of c3.optimizers.calibration.Calibration

Object that deals with the closed loop optimal control.

Parameters
  • dir_path (str) – Filepath to save results

  • eval_func (callable) – infidelity function to be minimized

  • pmap (ParameterMap) – Identifiers for the parameter vector

  • algorithm (callable) – From the algorithm library

  • options (dict) – Options to be passed to the algorithm

  • run_name (str) – User specified name for the run, will be used as root folder

set_eval_func(eval_func, exp_type)[source]

Setter for the eval function.

Parameters

eval_func (callable) – Function to be evaluated

log_setup() None[source]

Create the folders to store data.

Parameters
  • dir_path (str) – Filepath

  • run_name (str) – User specified name for the run

optimize_controls() None[source]

Apply a search algorithm to your gateset given a fidelity function.

goal_run(current_params)[source]

Evaluate the goal function for current parameters.

Parameters

current_params (tf.Tensor) – Vector representing the current parameter values.

Returns

Value of the goal function

Return type

tf.float64

log_pickle(params, seqs, results, results_std, shots)[source]

Save a pickled version of the performed experiment, suitable for model learning.

Parameters
  • params (tf.Tensor) – Vector of parameter values

  • seqs (list) – Strings identifying the performed instructions

  • results (list) – Values of the goal function

  • results_std (list) – Standard deviation of the results, in the case of noisy data

  • shots (list) – Number of repetitions used in averaging noisy data

replace_logdir(new_logdir)

Specify a new filepath to store the log.

Parameters

new_logdir

set_created_by(config) None

Store the config file location used to created this optimizer.

load_best(init_point, extend_bounds=False) None

Load a previous parameter point to start the optimization from. Legacy wrapper. Method moved to Parametermap.

Parameters
  • init_point (str) – File location of the initial point

  • extend_bounds (bool) – Whether or not to allow the loaded optimal parameters’ bounds to be extended if they exceed those specified.

start_log() None

Initialize the log with current time.

end_log() None

Finish the log by recording current time and total runtime.

log_best_unitary() None

Save the best unitary in the log.

log_parameters(params) None

Log the current status. Write parameters to log. Update the current best parameters. Call plotting functions as set up.

lookup_gradient(x)

Return the stored gradient for a given parameter set.

Parameters

x (np.array) – Parameter set.

Returns

Value of the gradient.

Return type

np.array

fct_to_min(input_parameters: Union[numpy.ndarray, tensorflow.constant]) Union[numpy.ndarray, tensorflow.constant]

Wrapper for the goal function.

Parameters

input_parameters ([np.array, tf.constant]) – Vector of parameters in the optimizer friendly way.

Returns

Value of the goal function. Float if input is np.array else tf.constant

Return type

[np.ndarray, tf.constant]

fct_to_min_autograd(x)

Wrapper for the goal function, including evaluation and storage of the gradient.

Parameters
xnp.array

Vector of parameters in the optimizer friendly way.

float

Value of the goal function.