c3.experiment
¶
Experiment class that models and simulates the whole experiment.
It combines the information about the model of the quantum device, the control stack and the operations that can be done on the device.
Given this information an experiment run is simulated, returning either processes, states or populations.
Module Contents¶
- class c3.experiment.Experiment(pmap: c3.parametermap.ParameterMap = None, prop_method=None, sim_res=100000000000.0)[source]¶
It models all of the behaviour of the physical experiment, serving as a host for the individual parts making up the experiment.
- Parameters
pmap (ParameterMap) –
including model: Model
The underlying physical device.
- generator: Generator
The infrastructure for generating and sending control signals to the device.
- gateset: GateSet
A gate level description of the operations implemented by control pulses.
- set_prop_method(prop_method=None) None [source]¶
Configure the selected propagation method by either linking the function handle or looking it up in the library.
- load_quick_setup(filepath: str) None [source]¶
Load a quick setup file.
- Parameters
filepath (str) – Location of the configuration file
- quick_setup(cfg, base_dir: str = None) None [source]¶
Load a quick setup cfg and create all necessary components.
- Parameters
cfg (Dict) – Configuration options
- read_config(filepath: str) None [source]¶
Load a file and parse it to create a Model object.
- Parameters
filepath (str) – Location of the configuration file
- evaluate_legacy(sequences, psi_init: tensorflow.Tensor = None)[source]¶
Compute the population values for a given sequence of operations.
- Parameters
sequences (str list) – A list of control pulses/gates to perform on the device.
psi_init (tf.Tensor) – A tensor containing the initial statevector
- Returns
A list of populations
- Return type
list
- evaluate_qasm(sequences, psi_init: tensorflow.Tensor = None)[source]¶
Compute the population values for a given sequence (in QASM format) of operations.
- Parameters
sequences (dict list) – A list of control pulses/gates to perform on the device in QASM format.
psi_init (tf.Tensor) – A tensor containing the initial statevector
- Returns
A list of populations
- Return type
list
- lookup_gate(name, qubits, params=None) tensorflow.constant [source]¶
Returns a fixed operation or a parametric virtual Z gate. To be extended to general parametric gates.
- process(populations, labels=None)[source]¶
Apply a readout procedure to a population vector. Very specialized at the moment.
- Parameters
populations (list) – List of populations from evaluating.
labels (list) – List of state labels specifying a subspace.
- Returns
A list of processed populations.
- Return type
list
- get_perfect_gates(gate_keys: list = None) Dict[str, numpy.ndarray] [source]¶
Return a perfect gateset for the gate_keys.
- Parameters
gate_keys (list) – (Optional) List of gates to evaluate.
- Returns
A dictionary of gate names and np.array representation of the corresponding unitary
- Return type
Dict[str, np.array]
- Raises
Exception – Raise general exception for undefined gate
- compute_propagators()[source]¶
Compute the unitary representation of operations. If no operations are specified in self.opt_gates the complete gateset is computed.
- Returns
A dictionary of gate names and their unitary representation.
- Return type
dict
- set_opt_gates(gates)[source]¶
Specify a selection of gates to be computed.
- Parameters
gates (Identifiers of the gates of interest. Can contain duplicates.) –
- set_opt_gates_seq(seqs)[source]¶
Specify a selection of gates to be computed.
- Parameters
seqs (Identifiers of the sequences of interest. Can contain duplicates.) –
- set_enable_store_unitaries(flag, logdir, exist_ok=False)[source]¶
Saving of unitary propagators.
- Parameters
flag (boolean) – Enable or disable saving.
logdir (str) – File path location for the resulting unitaries.
- store_Udict(goal)[source]¶
Save unitary as text and pickle.
- goal: tf.float64
Value of the goal function, if used.
- populations(state, lindbladian)[source]¶
Compute populations from a state or density vector.
- Parameters
state (tf.Tensor) – State or densitiy vector.
lindbladian (boolean) – Specify if conversion to density matrix is needed.
- Returns
Vector of populations.
- Return type
tf.Tensor