c3.model

The model class, containing information on the system and its modelling.

Module Contents

class c3.model.Model(subsystems=None, couplings=None, tasks=None, max_excitations=0)[source]

What the theorist thinks about from the system.

Class to store information about our system/problem/device. Different models can represent the same system.

Parameters
  • subsystems (list) – List of individual, non-interacting physical components like qubits or resonators

  • couplings (list) – List of interaction operators between subsystems, like couplings or drives.

  • tasks (list) – Badly named list of processing steps like line distortions and read out modeling

  • max_excitations (int) – Allow only up to max_excitations in the system

get_init_state() tensorflow.Tensor[source]

Get an initial state. If a task to compute a thermal state is set, return that.

set_max_excitations(max_excitations) None[source]

Set the maximum number of excitations in the system used for propagation.

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

fromdict(cfg: dict) None[source]

Load a file and parse it to create a Model object.

Parameters

cfg (dict) – configuration file

write_config(filepath: str) None[source]

Write dictionary to a HJSON file.

asdict() dict[source]

Return a dictionary compatible with config files.

__str__() str[source]

Return str(self).

set_dressed(dressed)[source]

Go to a dressed frame where static couplings have been eliminated.

Parameters

dressed (boolean) –

set_lindbladian(lindbladian: bool) None[source]

Set whether to include open system dynamics.

Parameters

lindbladian (boolean) –

set_FR(use_FR)[source]

Setter for the frame rotation option for adjusting the individual rotating frames of qubits when using gate sequences

get_Hamiltonian(signal=None)[source]

Get a hamiltonian with an optional signal. This will return an hamiltonian over time. Can be used e.g. for tuning the frequency of a transmon, where the control hamiltonian is not easily accessible. If max.excitation is non-zero the resulting Hamiltonian is cut accordingly

update_Hamiltonians()[source]

Recompute the matrix representations of the Hamiltonians.

update_Lindbladians()[source]

Return Lindbladian operators and their prefactors.

reorder_frame(e: tensorflow.constant, v: tensorflow.constant, ordered: bool) Tuple[tensorflow.constant, tensorflow.constant, tensorflow.constant][source]

Reorders the new basis states according to their overlap with bare qubit states.

update_drift_eigen(ordered=True)[source]

Compute the eigendecomposition of the drift Hamiltonian and store both the Eigenenergies and the transformation matrix.

update_dressed(ordered=True)[source]

Compute the Hamiltonians in the dressed basis by diagonalizing the drift and applying the resulting transformation to the control Hamiltonians.

get_Frame_Rotation(t_final: numpy.float64, freqs: dict, framechanges: dict)[source]

Compute the frame rotation needed to align Lab frame and rotating Eigenframes of the qubits.

Parameters
  • t_final (tf.float64) – Gate length

  • freqs (list) – Frequencies of the local oscillators.

  • framechanges (list) – List of framechanges. A phase shift applied to the control signal to compensate relative phases of drive oscillator and qubit.

Returns

A (diagonal) propagator that adjust phases

Return type

tf.Tensor

get_dephasing_channel(t_final, amps)[source]

Compute the matrix of the dephasing channel to be applied on the operation.

Parameters
  • t_final (tf.float64) – Duration of the operation.

  • amps (dict of tf.float64) – Dictionary of average amplitude on each drive line.

Returns

Matrix representation of the dephasing channel.

Return type

tf.tensor

Hs_of_t(signal, interpolate_res=2)[source]

Generate a list of Hamiltonians for each time step of interpolated signal for Runge-Kutta Methods.

Parameters
  • signal (_type_) – Input signal

  • interpolate_res (int, optional) – Interpolation resolution according to RK method. Defaults to 2.

  • L_dag_L (tf.tensor, optional) – List of {L^dagger L} where L represents the collapse operators. Defaults to None. This is only used for stochastic case.

Returns

List of Hamiltonians (or effective Hamiltonians for stochastic case) for each time step.

Return type

dict

class c3.model.Model_basis_change(subsystems=None, couplings=None, tasks=None, max_excitations=0, U_transform=None)[source]

Bases: Model

Inheritance diagram of c3.model.Model_basis_change

Model with an additional unitary basis change.

Parameters

U_transform (tf.constant(dtype=tf.complex128)) – Unitary matrix describing the basis change of the system

update_drift_eigen(ordered: bool = True)[source]

Set the basis transform to U_transform

get_init_state() tensorflow.Tensor

Get an initial state. If a task to compute a thermal state is set, return that.

set_max_excitations(max_excitations) None

Set the maximum number of excitations in the system used for propagation.

read_config(filepath: str) None

Load a file and parse it to create a Model object.

Parameters

filepath (str) – Location of the configuration file

fromdict(cfg: dict) None

Load a file and parse it to create a Model object.

Parameters

cfg (dict) – configuration file

write_config(filepath: str) None

Write dictionary to a HJSON file.

asdict() dict

Return a dictionary compatible with config files.

__str__() str

Return str(self).

set_dressed(dressed)

Go to a dressed frame where static couplings have been eliminated.

Parameters

dressed (boolean) –

set_lindbladian(lindbladian: bool) None

Set whether to include open system dynamics.

Parameters

lindbladian (boolean) –

set_FR(use_FR)

Setter for the frame rotation option for adjusting the individual rotating frames of qubits when using gate sequences

get_Hamiltonian(signal=None)

Get a hamiltonian with an optional signal. This will return an hamiltonian over time. Can be used e.g. for tuning the frequency of a transmon, where the control hamiltonian is not easily accessible. If max.excitation is non-zero the resulting Hamiltonian is cut accordingly

update_Hamiltonians()

Recompute the matrix representations of the Hamiltonians.

update_Lindbladians()

Return Lindbladian operators and their prefactors.

reorder_frame(e: tensorflow.constant, v: tensorflow.constant, ordered: bool) Tuple[tensorflow.constant, tensorflow.constant, tensorflow.constant]

Reorders the new basis states according to their overlap with bare qubit states.

update_dressed(ordered=True)

Compute the Hamiltonians in the dressed basis by diagonalizing the drift and applying the resulting transformation to the control Hamiltonians.

get_Frame_Rotation(t_final: numpy.float64, freqs: dict, framechanges: dict)

Compute the frame rotation needed to align Lab frame and rotating Eigenframes of the qubits.

Parameters
  • t_final (tf.float64) – Gate length

  • freqs (list) – Frequencies of the local oscillators.

  • framechanges (list) – List of framechanges. A phase shift applied to the control signal to compensate relative phases of drive oscillator and qubit.

Returns

A (diagonal) propagator that adjust phases

Return type

tf.Tensor

get_dephasing_channel(t_final, amps)

Compute the matrix of the dephasing channel to be applied on the operation.

Parameters
  • t_final (tf.float64) – Duration of the operation.

  • amps (dict of tf.float64) – Dictionary of average amplitude on each drive line.

Returns

Matrix representation of the dephasing channel.

Return type

tf.tensor

Hs_of_t(signal, interpolate_res=2)

Generate a list of Hamiltonians for each time step of interpolated signal for Runge-Kutta Methods.

Parameters
  • signal (_type_) – Input signal

  • interpolate_res (int, optional) – Interpolation resolution according to RK method. Defaults to 2.

  • L_dag_L (tf.tensor, optional) – List of {L^dagger L} where L represents the collapse operators. Defaults to None. This is only used for stochastic case.

Returns

List of Hamiltonians (or effective Hamiltonians for stochastic case) for each time step.

Return type

dict