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)[source]¶
Bases:
c3.optimizers.optimizer.Optimizer
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(self, eval_func, exp_type)[source]¶
Setter for the eval function.
- Parameters
eval_func (callable) – Function to be evaluated
- log_setup(self) None [source]¶
Create the folders to store data.
- Parameters
dir_path (str) – Filepath
run_name (str) – User specified name for the run
- optimize_controls(self) None [source]¶
Apply a search algorithm to your gateset given a fidelity function.
- goal_run(self, 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(self, 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(self, new_logdir)¶
Specify a new filepath to store the log.
- Parameters
new_logdir –
- set_created_by(self, config) None ¶
Store the config file location used to created this optimizer.
- load_best(self, init_point) 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
- start_log(self) None ¶
Initialize the log with current time.
- end_log(self) None ¶
Finish the log by recording current time and total runtime.
- log_best_unitary(self) None ¶
Save the best unitary in the log.
- log_parameters(self) None ¶
Log the current status. Write parameters to log. Update the current best parameters. Call plotting functions as set up.
- lookup_gradient(self, 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(self, 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(self, 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.