Circuit#

class scqubits.core.circuit.Circuit(input_string=None, from_file=True, basis_completion='heuristic', ext_basis='discretized', use_dynamic_flux_grouping=False, generate_noise_methods=False, initiate_sym_calc=True, truncated_dim=10, symbolic_param_dict=None, symbolic_hamiltonian=None, evals_method=None, evals_method_options=None, esys_method=None, esys_method_options=None)[source]#

Class for analysis of custom superconducting circuits.

Parameters:
  • input_string (str) – String describing the number of nodes and branches connecting then along with their parameters

  • from_file (bool) – Set to True by default, when a file name should be provided to input_string, else the circuit graph description in YAML should be provided as a string.

  • basis_completion (str) – either “heuristic” or “canonical”, defines the matrix used for completing the transformation matrix. Sometimes used to change the variable transformation to result in a simpler symbolic Hamiltonian, by default “heuristic”

  • ext_basis (str) – can be “discretized” or “harmonic” which chooses whether to use discretized phi or harmonic oscillator basis for extended variables, by default “discretized”

  • use_dynamic_flux_grouping (bool) – set to False by default. Indicates if the flux allocation is done by assuming that flux is time dependent. When set to True, it disables the option to change the closure branches.

  • initiate_sym_calc (bool) – attribute to initiate Circuit instance, by default True

  • truncated_dim (Optional[int]) – truncated dimension if the user wants to use this circuit instance in HilbertSpace, by default None

Return type:

QuantumSystemType

Methods

Circuit.E01()

Returns the qubit's fundamental energy splitting, E_1 - E_0.

Circuit.Q_from_branch(branch)

Circuit.__init__([input_string, from_file, ...])

Circuit.anharmonicity()

Returns the qubit's anharmonicity, (E_2 - E_1) - (E_1 - E_0).

Circuit.broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Circuit.configure([transformation_matrix, ...])

Method which re-initializes a circuit instance to update, hierarchical diagonalization parameters or closure branches or the variable transformation used to describe the circuit.

Circuit.create()

Use ipywidgets to create a new class instance

Circuit.create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Circuit.cutoffs_dict()

Returns a dictionary, where each variable is associated with its respective cutoff.

Circuit.default_params()

Return dictionary with default parameter values for initialization of class instance

Circuit.deserialize(io_data)

Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.

Circuit.discretized_grids_dict_for_vars()

Circuit.effective_noise_channels()

Return a list of noise channels that are used when calculating the effective noise (i.e.

Circuit.eigensys([evals_count, filename, ...])

Calculates eigenvalues and corresponding eigenvectors using scipy.linalg.eigh.

Circuit.eigenvals([evals_count, filename, ...])

Calculates eigenvalues using scipy.linalg.eigh, returns numpy array of eigenvalues.

Circuit.exp_i_operator(var_sym, prefactor)

Returns the bare operator exp(i* heta*prefactor), without the kron product.

Circuit.fetch_symbolic_hamiltonian()

Method to fetch the symbolic hamiltonian of an instance.

Circuit.filewrite(filename)

Convenience method bound to the class.

Circuit.from_symbolic_hamiltonian(...)

Circuit.from_yaml(input_string[, from_file, ...])

Wrapper to Circuit __init__ to create a class instance.

Circuit.generate_bare_eigensys()

Circuit.generate_hamiltonian_sym_for_numerics([...])

Generates a symbolic expression which is ready for numerical evaluation starting from the expression stored in the attribute hamiltonian_symbolic.

Circuit.generate_methods_d_hamiltonian_d()

Generate methods which return the derivative of the Hamiltonian with respect to offset charges, external fluxes and junction energies.

Circuit.generate_noise_methods()

Circuit.generate_overall_t1_capacitive()

Circuit.generate_overall_t1_charge_impedance()

Circuit.generate_overall_t1_flux_bias_line()

Circuit.generate_overall_t1_inductive()

Circuit.generate_overall_t1_quasiparticle_tunneling()

Circuit.generate_overall_tphi_cc()

Circuit.generate_overall_tphi_flux()

Circuit.generate_overall_tphi_ng()

Circuit.generate_subsystems([...])

Generates the subsystems (child instances of Circuit) depending on the attribute self.system_hierarchy

Circuit.generate_sym_potential()

Circuit.generate_t1_flux_bias_line_methods()

Generate methods for flux bias line t1 coherence times.

Circuit.generate_t1_methods()

Circuit.generate_tphi_1_over_f_methods()

Generate methods tphi_1_over_f_{noise_type}{index} methods for noise_type=['cc', 'ng', 'flux']; individual noise sources differentiated using index.

Circuit.generate_wf_plot_data([which, mode, ...])

Returns treated wave function of the current Circuit instance for the specified variables.

Circuit.get_cutoffs()

Method to get the cutoffs for each of the circuit's degree of freedom.

Circuit.get_dispersion_vs_paramvals(...[, ...])

Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values.

Circuit.get_eigenstates()

Returns the eigenstates for the SubSystem instance

Circuit.get_ext_basis()

Get the ext_basis object for the Circuit instance, according to the setting in self.hierarchical_diagonalization

Circuit.get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Circuit.get_matelements_vs_paramvals(...[, ...])

Calculates matrix elements for a varying system parameter, given an array of parameter values.

Circuit.get_operator_by_name(operator_name)

Returns the operator for the given operator symbol which has the same dimension as the hilbertdim of the instance from which the operator is requested.

Circuit.get_operator_names()

Returns a list of all operator names for the quantum system.

Circuit.get_osc_param(var_index[, which_param])

Returns the oscillator parameters based on the oscillator used to diagonalize the Hamiltonian in the harmonic oscillator basis.

Circuit.get_params()

Method to get the circuit parameters set for all the branches.

Circuit.get_spectrum_vs_paramvals(...[, ...])

Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values.

Circuit.get_subsystem_index(var_index)

Returns the subsystem index for the subsystem to which the given var_index belongs.

Circuit.hamiltonian()

Returns the Hamiltonian of the Circuit.

Circuit.hamiltonian_for_qutip_dynamics(...)

Returns the Hamiltonian in a format amenable to be forwarded to mesolve in Qutip.

Circuit.hilbertdim()

Returns the Hilbert dimension of the Circuit instance

Circuit.identity_wrap_for_hd(operator, ...)

Returns an identity wrapped operator whose size is equal to the self.hilbertdim().

Circuit.info()

Describes the Circuit instance, its parameters, and the symbolic Hamiltonian.

Circuit.is_subsystem(instance)

Returns true if the instance is a subsystem of self (regardless of the hierarchy)

Circuit.junction_related_evaluation(...[, calc])

Circuit.matrixelement_table(operator[, ...])

Returns table of matrix elements for operator with respect to the eigenstates of the qubit.

Circuit.offset_charge_transformation()

Prints the variable transformation between offset charges of transformed variables and the node charges.

Circuit.offset_free_charge_values()

Returns all the offset charges set using the circuit attributes for each of the periodic degree of freedom.

Circuit.operator_names_in_hamiltonian_symbolic()

Returns a list of the names (strings) of all operators occurring in the symbolic Hamiltonian.

Circuit.oscillator_list(osc_index_list)

If hierarchical diagonalization is used, specify subsystems that corresponds to single-mode oscillators, if there is any.

Circuit.plot_coherence_vs_paramvals(...[, ...])

Show plots of coherence for various channels supported by the qubit as they vary as a function of a changing parameter.

Circuit.plot_dispersion_vs_paramvals(...[, ...])

Generates a simple plot of a set of curves representing the charge or flux dispersion of transition energies.

Circuit.plot_evals_vs_paramvals(param_name, ...)

Generates a simple plot of a set of eigenvalues as a function of one parameter.

Circuit.plot_matelem_vs_paramvals(operator, ...)

Generates a simple plot of a set of eigenvalues as a function of one parameter.

Circuit.plot_matrixelements(operator[, ...])

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix.

Circuit.plot_potential(**kwargs)

Returns the plot of the potential for the circuit instance.

Circuit.plot_t1_effective_vs_paramvals(...)

Plot effective \(T_1\) coherence time (rate) as a function of changing parameter.

Circuit.plot_t2_effective_vs_paramvals(...)

Plot effective \(T_2\) coherence time (rate) as a function of changing parameter.

Circuit.plot_wavefunction([which, mode, ...])

Returns the plot of the wavefunction in the requested variables.

Circuit.potential_energy(**kwargs)

Returns the full potential of the circuit evaluated in a grid of points as chosen by the user or using default variable ranges.

Circuit.print_expr_in_latex(expr)

Print a sympy expression or a list of equalities in LaTeX

Circuit.process_hamiltonian(native_hamiltonian)

Return qubit Hamiltonian in chosen basis: either return unchanged (i.e., in native basis) or transform into eigenenergy basis

Circuit.process_op(native_op[, energy_esys])

Processes the operator native_op: either hand back native_op unchanged, or transform it into the energy eigenbasis.

Circuit.qubit_list(qbt_index_list)

If hierarchical diagonalization is used, specify subsystems that corresponds to single-mode oscillators, if there is any.

Circuit.receive(event, sender, **kwargs)

Method to help the CentralDispatch keep track of the sync status in Circuit and SubSystem modules

Circuit.return_parent_circuit()

Returns the parent Circuit instance.

Circuit.return_root_child(var_index)

Circuit.serialize()

Convert the content of the current class instance into IOData format.

Circuit.set_and_return(attr_name, value)

Allows to set an attribute after which self is returned. This is useful for doing something like example::.

Circuit.set_bare_eigensys(eigensys)

Circuit.set_discretized_phi_range(...)

Sets the flux range for discretized phi basis or for plotting

Circuit.set_operators()

Creates the operator methods <name>_operator for the circuit.

Circuit.set_params(**kwargs)

Set new parameters through the provided dictionary.

Circuit.set_params_from_gui(change)

Set new parameters through the provided dictionary.

Circuit.supported_noise_channels()

Return a list of supported noise channels

Circuit.sym_external_fluxes()

Method returns a dictionary of Human readable external fluxes with associated branches and loops (represented as lists of branches) for the current instance

Circuit.sym_hamiltonian([subsystem_index, ...])

Prints a user readable symbolic Hamiltonian for the current instance

Circuit.sym_interaction(subsystem_indices[, ...])

Print the interaction between any set of subsystems for the current instance.

Circuit.sym_lagrangian([vars_type, ...])

Method that gives a user readable symbolic Lagrangian for the current instance

Circuit.sym_potential([float_round, ...])

Method prints a user readable symbolic potential for the current instance

Circuit.sync_parameters_with_parent()

Method syncs the parameters of the subsystem with the parent instance.

Circuit.t1(i, j, noise_op, spectral_density)

Calculate the transition time (or rate) using Fermi's Golden Rule due to a noise channel with a spectral density spectral_density and system noise operator noise_op.

Circuit.t1_capacitive([i, j, Q_cap, T, ...])

\(T_1\) due to dielectric dissipation in the Josephson junction capacitances.

Circuit.t1_charge_impedance([i, j, Z, T, ...])

Noise due to charge coupling to an impedance (such as a transmission line).

Circuit.t1_effective([noise_channels, ...])

Calculate the effective \(T_1\) time (or rate).

Circuit.t1_flux_bias_line([i, j, M, Z, T, ...])

Noise due to a bias flux line.

Circuit.t1_inductive([i, j, Q_ind, T, ...])

\(T_1\) due to inductive dissipation in a superinductor.

Circuit.t1_quasiparticle_tunneling([i, j, ...])

Noise due to quasiparticle tunneling across a Josephson junction.

Circuit.t2_effective([noise_channels, ...])

Calculate the effective \(T_2\) time (or rate).

Circuit.tphi_1_over_f(A_noise, i, j, noise_op)

Calculate the 1/f dephasing time (or rate) due to arbitrary noise source.

Circuit.tphi_1_over_f_cc([A_noise, i, j, ...])

Calculate the 1/f dephasing time (or rate) due to critical current noise.

Circuit.tphi_1_over_f_flux([A_noise, i, j, ...])

Calculate the 1/f dephasing time (or rate) due to flux noise.

Circuit.tphi_1_over_f_ng([A_noise, i, j, ...])

Calculate the 1/f dephasing time (or rate) due to charge noise.

Circuit.update([calculate_bare_esys])

Syncs all the parameters of the subsystems with the current instance.

Circuit.update_interactions([recursive])

Update interactions of the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.

Circuit.variable_transformation([...])

Prints the variable transformation used in this circuit

Circuit.widget([params])

Use ipywidgets to modify parameters of class instance

Circuit.wrapper_t1_charge_impedance(branch)

Circuit.wrapper_t1_inductive_capacitive(branch)

Circuit.wrapper_t1_quasiparticle_tunneling(branch)

Attributes

id_str

truncated_dim

Descriptor class for properties that are to be monitored for changes.

E01()#

Returns the qubit’s fundamental energy splitting, E_1 - E_0.

Return type:

float

anharmonicity()#

Returns the qubit’s anharmonicity, (E_2 - E_1) - (E_1 - E_0).

Return type:

float

broadcast(event, **kwargs)#

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters:
  • event (str) – event name from EVENTS

  • **kwargs

Return type:

None

configure(transformation_matrix=None, system_hierarchy=None, subsystem_trunc_dims=None, closure_branches=None, ext_basis=None, use_dynamic_flux_grouping=None, generate_noise_methods=False)[source]#

Method which re-initializes a circuit instance to update, hierarchical diagonalization parameters or closure branches or the variable transformation used to describe the circuit.

Parameters:
  • transformation_matrix (Optional[ndarray]) – A user defined variable transformation which has the dimensions of the number nodes (not counting the ground node), by default None

  • system_hierarchy (Optional[list]) – A list of lists which is provided by the user to define subsystems, by default None

  • subsystem_trunc_dims (Optional[list]) – dict object which can be generated for a specific system_hierarchy using the method truncation_template, by default None

  • closure_branches (Optional[List[Branch]]) – List of branches where external flux variables will be specified, by default None which then chooses closure branches by an internally generated spanning tree. For this option, Circuit should be initialized with use_dynamic_flux_grouping set to False.

  • ext_basis (Optional[str]) – can be “discretized” or “harmonic” which chooses whether to use discretized phi or harmonic oscillator basis for extended variables, by default None

  • use_dynamic_flux_grouping (Optional[bool]) – set to False by default. Indicates if the flux allocation is done by assuming that flux is time dependent. When set to True, it disables the option to change the closure branches.

  • generate_noise_methods (bool) – set to False by default. Indicates if the noise methods should be generated for the circuit instance.

Raises:
  • Exception – When system_hierarchy is set and subsystem_trunc_dims is not set.

  • Exception – When closure_branches is set and the Circuit instance is initialized with the setting use_dynamic_flux_grouping=True.

classmethod create()#

Use ipywidgets to create a new class instance

Return type:

QuantumSystem

classmethod create_from_file(filename)#

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Returns:

new SpectrumData object, initialized with data read from file

Return type:

SpectrumData

Parameters:

filename (str) –

cutoffs_dict()#

Returns a dictionary, where each variable is associated with its respective cutoff.

Return type:

Dict[int, int]

Returns:

Cutoffs dictionary; {var_index: cutoff}

static default_params()[source]#

Return dictionary with default parameter values for initialization of class instance

Return type:

Dict[str, Any]

classmethod deserialize(io_data)#

Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.

Parameters:

io_data (IOData) –

effective_noise_channels()[source]#

Return a list of noise channels that are used when calculating the effective noise (i.e. via t1_effective and t2_effective.

eigensys(evals_count=6, filename=None, return_spectrumdata=False)#

Calculates eigenvalues and corresponding eigenvectors using scipy.linalg.eigh. Returns two numpy arrays containing the eigenvalues and eigenvectors, respectively.

Parameters:
  • evals_count (int) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (Optional[str]) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (if set to true, the returned data is provided as a SpectrumData object) – (default value = False)

Return type:

Union[Tuple[ndarray, ndarray], SpectrumData]

Returns:

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

eigenvals(evals_count=6, filename=None, return_spectrumdata=False)#

Calculates eigenvalues using scipy.linalg.eigh, returns numpy array of eigenvalues.

Parameters:
  • evals_count (int) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (Optional[str]) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Return type:

Union[SpectrumData, ndarray]

Returns:

eigenvalues as ndarray or in form of a SpectrumData object

exp_i_operator(var_sym, prefactor)#

Returns the bare operator exp(i* heta*prefactor), without the kron product. Needs the oscillator lengths to be set in the attribute, osc_lengths, when ext_basis is set to “harmonic”.

Return type:

Union[csc_matrix, ndarray]

Parameters:
  • var_sym (Symbol) –

  • prefactor (float) –

fetch_symbolic_hamiltonian()#

Method to fetch the symbolic hamiltonian of an instance.

filewrite(filename)#

Convenience method bound to the class. Simply accesses the write function.

Return type:

None

Parameters:

filename (str) –

from_yaml(input_string, from_file=True, basis_completion='heuristic', ext_basis='discretized', use_dynamic_flux_grouping=False, generate_noise_methods=False, initiate_sym_calc=True, truncated_dim=None)[source]#

Wrapper to Circuit __init__ to create a class instance. This is deprecated and will not be supported in future releases.

Parameters:
  • input_string (str) – String describing the number of nodes and branches connecting then along with their parameters

  • from_file (bool) – Set to True by default, when a file name should be provided to input_string, else the circuit graph description in YAML should be provided as a string.

  • basis_completion – either “heuristic” or “canonical”, defines the matrix used for completing the transformation matrix. Sometimes used to change the variable transformation to result in a simpler symbolic Hamiltonian, by default “heuristic”

  • ext_basis (str) – can be “discretized” or “harmonic” which chooses whether to use discretized phi or harmonic oscillator basis for extended variables, by default “discretized”

  • initiate_sym_calc (bool) – attribute to initiate Circuit instance, by default True

  • truncated_dim (Optional[int]) – truncated dimension if the user wants to use this circuit instance in HilbertSpace, by default None

  • use_dynamic_flux_grouping (bool) – set to False by default. Indicates if the flux allocation is done by assuming that flux is time dependent. When set to True, it disables the option to change the closure branches.

  • generate_noise_methods (bool) –

generate_hamiltonian_sym_for_numerics(hamiltonian=None, return_exprs=False)#

Generates a symbolic expression which is ready for numerical evaluation starting from the expression stored in the attribute hamiltonian_symbolic. Stores the result in the attribute _hamiltonian_sym_for_numerics.

Parameters:

hamiltonian (Expr | None) –

generate_methods_d_hamiltonian_d()#

Generate methods which return the derivative of the Hamiltonian with respect to offset charges, external fluxes and junction energies.

generate_subsystems(only_update_subsystems=False)#

Generates the subsystems (child instances of Circuit) depending on the attribute self.system_hierarchy

Parameters:

only_update_subsystems (bool) –

generate_t1_flux_bias_line_methods()#

Generate methods for flux bias line t1 coherence times.

generate_tphi_1_over_f_methods()#

Generate methods tphi_1_over_f_{noise_type}{index} methods for noise_type=[‘cc’, ‘ng’, ‘flux’]; individual noise sources differentiated using index.

generate_wf_plot_data(which=0, mode='abs-sqr', var_indices=(1,), eigensys=None, change_discrete_charge_to_phi=True, grids_dict=None)#

Returns treated wave function of the current Circuit instance for the specified variables.

Parameters:
  • which (int) – integer to choose which wave function to plot

  • mode (str) – “abs”, “real”, “imag”, “abs-sqr” - decides which part of the wave function is plotted.

  • var_indices (Tuple[int]) – A tuple containing the indices of the variables chosen to plot the wave function in. Should not have more than 2 entries.

  • eigensys (Optional[ndarray]) – eigenvalues and eigenstates of the Circuit instance; if not provided, calling this method will perform a diagonalization to obtain these.

  • extended_variable_basis (str) – The basis in which the extended variables are plotted. Can be either “phi” or “charge”.

  • periodic_variable_basis (str) – The basis in which the periodic variables are plotted. Can be either “phi” or “charge”.

  • grids_dict (Optional[Dict[int, Grid1d]]) – A dictionary which pairs var indices with the requested grids used to create the plot.

  • change_discrete_charge_to_phi (bool) –

get_cutoffs()#

Method to get the cutoffs for each of the circuit’s degree of freedom.

Return type:

Dict[str, list]

get_dispersion_vs_paramvals(dispersion_name, param_name, param_vals, ref_param=None, transitions=(0, 1), levels=None, point_count=50, num_cpus=None)#

Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values. Returns a SpectrumData object with energy_data[n] containing eigenvalues calculated for parameter value param_vals[n].

Parameters:
  • dispersion_name (str) – parameter inducing the dispersion, typically ‘ng’ or ‘flux’ (will be scanned over range from 0 to 1)

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • ref_param (Optional[str]) – optional, name of parameter to use as reference for the parameter value; e.g., to compute charge dispersion vs. EJ/EC, use EJ as param_name and EC as ref_param

  • transitions (Union[Tuple[int, int], Tuple[Tuple[int, int], ...]]) – integer tuple or tuples specifying for which transitions dispersion is to be calculated (default: = (0,1))

  • levels (Union[int, Tuple[int, ...], None]) – tuple specifying levels (rather than transitions) for which dispersion should be plotted; overrides transitions parameter when given

  • point_count (int) – number of points scanned for the dispersion parameter for determining min and max values of transition energies (default: 50)

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Return type:

SpectrumData

get_eigenstates()#

Returns the eigenstates for the SubSystem instance

Return type:

ndarray

get_ext_basis()#

Get the ext_basis object for the Circuit instance, according to the setting in self.hierarchical_diagonalization

get_initdata()#

Returns dict appropriate for creating/initializing a new Serializable object.

Return type:

Dict[str, Any]

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=None)#

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters:
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Return type:

SpectrumData

get_operator_by_name(operator_name, power=None, bare_esys=None)#

Returns the operator for the given operator symbol which has the same dimension as the hilbertdim of the instance from which the operator is requested.

Parameters:
  • operator_name (str) – Name of a sympy Symbol object which should be one among the symbols in the attribute vars

  • power (Optional[int]) – If asking for an operator raised to a certain power. Which wen set to None defaults to 1

Return type:

Qobj

Returns:

operator identified by operator_name

classmethod get_operator_names()#

Returns a list of all operator names for the quantum system. Note that this list omits any operators that start with “_”.

Parameters:

subsys – Class instance of quantum system

Return type:

List[str]

Returns:

list of operator names

get_osc_param(var_index, which_param='length')#

Returns the oscillator parameters based on the oscillator used to diagonalize the Hamiltonian in the harmonic oscillator basis.

Parameters:
  • var_index (int) – var index whose oscillator parameter needs to be fetched

  • which_param (str) – “length” or “freq” - decides which parameter is returned, by default “length”

Return type:

float

Returns:

returns the float value which is the oscillator length or the frequency of the oscillator corresponding to var_index depending on the string which_param.

get_params()#

Method to get the circuit parameters set for all the branches.

Return type:

List[float]

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=None)#

Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values. Returns a SpectrumData object with energy_data[n] containing eigenvalues calculated for parameter value param_vals[n].

Parameters:
  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool) – return eigenstates along with eigenvalues (default value = False)

  • filename (Optional[str]) – file name if direct output to disk is wanted

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Return type:

SpectrumData

get_subsystem_index(var_index)#

Returns the subsystem index for the subsystem to which the given var_index belongs.

Parameters:

var_index (int) – variable index in integer starting from 1.

Return type:

int

Returns:

subsystem index which can be used to identify the subsystem index in the list self.subsystems.

hamiltonian()#

Returns the Hamiltonian of the Circuit.

Return type:

Union[csc_matrix, ndarray]

hamiltonian_for_qutip_dynamics(free_var_func_dict, prefactor=1.0, extra_terms=None)#

Returns the Hamiltonian in a format amenable to be forwarded to mesolve in Qutip. Also returns the symbolic expressions of time independent and time dependent terms of the Hamiltonian. free_var_func_dict is a dictionary which has a tuple for every time dependent variable with the follwoing two elements: 1 - time dependent function for the variable 2 - the order to which the Hamiltonian needs to be expanded around the drive amplitude For example, to get the Hamiltonian for a circuit where Φ1 is the time varying parameter and the drive is expanded to second order, this method can be called in the following way:

``` :rtype: Tuple[List[Union[Qobj, Tuple[Qobj, Callable]]], Expr, List[Expr]]

def flux_t(t, args):

return np.sin(t*2)

def EJ_t(t, args):

return (1-np.exp(-t/1))*0.2

free_var_func_dict = {“Φ1”: (flux_t, 2), “EJ”:(EJ_t, 1)}

mesolve_input_H = self.hamiltonian_for_qutip_dynamics(free_var_func_dict) ` :type free_var_func_dict: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~typing.Dict\`\\ \\\[\:py\:class\:\`str\`\, \:py\:data\:\`\~typing.Callable\`\]` :param free_var_func_dict: Dict, as defined in the description above :type prefactor: :sphinx_autodoc_typehints_type:`\:py\:class\:\`float\ :param prefactor: float, value with which the Hamiltonian and corresponding operators are multiplied with :type extra_terms: Optional[str] :param extra_terms: str, a string which will be converted into sympy expression, containing terms which are not present in the Circuit Hamiltonian. Is useful to define custom drive operators.

Parameters:
  • free_var_func_dict (Dict[str, Callable]) –

  • prefactor (float) –

  • extra_terms (str | None) –

Return type:

Tuple[List[Qobj | Tuple[Qobj, Callable]], Expr, List[Expr]]

hilbertdim()#

Returns the Hilbert dimension of the Circuit instance

identity_wrap_for_hd(operator, child_instance, bare_esys=None)#

Returns an identity wrapped operator whose size is equal to the self.hilbertdim(). Only converts operator which belongs to a specific variable index. For example, operator Q_1 or cos( heta_1). But not, Q1*Q2.

Parameters:
  • operator (Union[csc_matrix, ndarray, None]) – operator in the form of csc_matrix, ndarray

  • instance – The subsystem to which the operator belongs

  • bare_esys (Dict[int, Tuple] | None) –

Return type:

Qobj

Returns:

identity wrapped operator.

info()#

Describes the Circuit instance, its parameters, and the symbolic Hamiltonian.

is_subsystem(instance)#

Returns true if the instance is a subsystem of self (regardless of the hierarchy)

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)#

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters:
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (Optional[ndarray]) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (Optional[str]) – output file name

  • return_datastore (bool) – if set to true, the returned data is provided as a DataStore object (default value = False)

Return type:

Union[DataStore, ndarray]

offset_charge_transformation()#

Prints the variable transformation between offset charges of transformed variables and the node charges.

Return type:

None

offset_free_charge_values()#

Returns all the offset charges set using the circuit attributes for each of the periodic degree of freedom.

Return type:

List[float]

operator_names_in_hamiltonian_symbolic()#

Returns a list of the names (strings) of all operators occurring in the symbolic Hamiltonian.

Return type:

List[str]

oscillator_list(osc_index_list)[source]#

If hierarchical diagonalization is used, specify subsystems that corresponds to single-mode oscillators, if there is any. The attributes _osc_subsys_list and osc_subsys_list of the hilbert_space attribute of the Circuit instance will be assigned accordingly, enabling the correct identification of harmonic modes for the dispersive regime analysis in ParameterSweep.

Parameters:

osc_index_list (List[int]) – a list of indices of subsystems that are single-mode harmonic oscillators

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=None, **kwargs)#

Show plots of coherence for various channels supported by the qubit as they vary as a function of a changing parameter.

For example, assuming qubit is a qubit object with flux being one of its parameters, one can see how coherence due to various noise channels vary as the flux changes:

qubit.plot_coherence_vs_paramvals(param_name='flux',
                                  param_vals=np.linspace(-0.5, 0.5, 100),
                                  scale=1e-3,
                                  ylabel=r"$\mu s$");
Parameters:
  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • noise_channels (Union[str, List[str], List[Tuple[str, Dict]], None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are used

  • common_noise_options (Optional[Dict]) – common options used when calculating coherence times

  • spectrum_data (Optional[SpectrumData]) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (Optional[int]) – number of cores to be used for computation

Return type:

Figure, Axes

plot_dispersion_vs_paramvals(dispersion_name, param_name, param_vals, ref_param=None, transitions=(0, 1), levels=None, point_count=50, num_cpus=None, **kwargs)#

Generates a simple plot of a set of curves representing the charge or flux dispersion of transition energies.

Parameters:
  • dispersion_name (str) – parameter inducing the dispersion, typically ‘ng’ or ‘flux’ (will be scanned over range from 0 to 1)

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • ref_param (Optional[str]) – optional, name of parameter to use as reference for the parameter value; e.g., to compute charge dispersion vs. EJ/EC, use EJ as param_name and EC as ref_param

  • transitions (Union[Tuple[int, int], Tuple[Tuple[int, int], ...]]) – integer tuple or tuples specifying for which transitions dispersion is to be calculated (default: = (0,1))

  • levels (Union[int, Tuple[int, ...], None]) – int or tuple specifying level(s) (rather than transitions) for which dispersion should be plotted; overrides transitions parameter when given

  • point_count (int) – number of points scanned for the dispersion parameter for determining min and max values of transition energies (default: 50)

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs – standard plotting option (see separate documentation)

Return type:

Tuple[Figure, Axes]

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, num_cpus=None, **kwargs)#

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters:
  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs – standard plotting option (see separate documentation)

Return type:

Tuple[Figure, Axes]

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=None, **kwargs)#

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters:
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (Union[int, List[Tuple[int, int]]]) – either maximum index of desired matrix elements, or list [(i1, i2), (i3, i4), …] of index tuples for specific desired matrix elements (default value = 4)

  • mode (str) – idx_entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs – standard plotting option (see separate documentation)

Return type:

Tuple[Figure, Axes]

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)#

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters:
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (Optional[ndarray]) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str) – idx_entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs – standard plotting option (see separate documentation)

Return type:

Union[Tuple[Figure, Tuple[Axes, Axes]], Tuple[Figure, Axes]]

plot_potential(**kwargs)#

Returns the plot of the potential for the circuit instance. Make sure to not set more than two variables in the instance.potential to a Numpy array, as the the code cannot plot with more than 3 dimensions.

Parameters:

θ<index> – value(s) for the variable \(\theta_i\) occurring in the potential.

Return type:

Tuple[Figure, Axes]

Returns:

Returns a axes and figure for further editing.

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, get_rate=False, scale=1, num_cpus=None, **kwargs)#

Plot effective \(T_1\) coherence time (rate) as a function of changing parameter.

The effective \(T_1\) is calculated by considering a variety of depolarizing noise channels, according to the formula:

\[\frac{1}{T_{1}^{\rm eff}} = \frac{1}{2} \sum_k \frac{1}{T_{1}^{k}}\]

where \(k\) runs over the channels that can contribute to the effective noise. By default all the depolarizing noise channels given by the method effective_noise_channels are included.

For example, assuming qubit is a qubit object with flux being one of its parameters, one can see how the effective \(T_1\) varies as the flux changes:

qubit.plot_t1_effective_vs_paramvals(param_name='flux',
                                     param_vals=np.linspace(-0.5, 0.5, 100),
                                    );
Parameters:
  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • noise_channels (Union[str, List[str], List[Tuple[str, Dict]], None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are used

  • common_noise_options (Optional[Dict]) – common options used when calculating coherence times

  • spectrum_data (Optional[SpectrumData]) – spectral data used during noise calculations

  • get_rate (bool) – determines if rate or time should be plotted

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (Optional[int]) – number of cores to be used for computation

Return type:

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, get_rate=False, scale=1, num_cpus=None, **kwargs)#

Plot effective \(T_2\) coherence time (rate) as a function of changing parameter.

The effective \(T_2\) is calculated from both pure dephasing channels, as well as depolarization channels, according to the formula:

\[\frac{1}{T_{2}^{\rm eff}} = \sum_k \frac{1}{T_{\phi}^{k}} + \frac{1}{2} \sum_j \frac{1}{T_{1}^{j}}\]

where \(k\) (\(j\)) run over the relevant pure dephasing ( depolarization) channels that can contribute to the effective noise. By default all noise channels given by the method effective_noise_channels are included.

For example, assuming qubit is a qubit object with flux being one of its parameters, one can see how the effective \(T_2\) varies as the flux changes:

qubit.plot_t2_effective_vs_paramvals(param_name='flux',
                                     param_vals=np.linspace(-0.5, 0.5, 100),
                                    );
Parameters:
  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • noise_channels (Union[str, List[str], List[Tuple[str, Dict]], None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are used

  • common_noise_options (Optional[Dict]) – common options used when calculating coherence times

  • spectrum_data (Optional[SpectrumData]) – spectral data used during noise calculations

  • get_rate (bool) – determines if rate or time should be plotted

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (Optional[int]) – number of cores to be used for computation

Return type:

Figure, Axes

plot_wavefunction(which=0, mode='abs-sqr', var_indices=(1,), esys=None, change_discrete_charge_to_phi=True, zero_calibrate=True, grids_dict={}, **kwargs)#

Returns the plot of the wavefunction in the requested variables. At most 2 numbers of variables for wavefunction can be specified as plotting axis. If the number of plotting variables for wave function is smaller than the number of variables in the circuit, the marginal probability distribution of the state with respect to the specified variables is plotted. This means the norm square of the wave function is integrated over the rest of the variables and is then plotted.

Parameters:
  • which – integer to choose which wave function to plot

  • mode (str) – “abs”, “real”, “imag”, “abs-sqr” - decides which part of the wave function is plotted, by default “abs-sqr”

  • var_indices (Tuple[int]) – A tuple containing the indices of the variables chosen to plot the wave function in. It should not have more than 2 entries.

  • esys (Optional[Tuple[ndarray, ndarray]]) – The object returned by the method .eigensys, is used to avoid the re-evaluation of the eigen systems if already evaluated.

  • change_discrete_charge_to_phi (bool) – If True, the wave function is plotted in the phi basis for the periodic variables. If False, the wave function is plotted in the charge basis for the periodic variables.

  • zero_calibrate (bool, optional) – if True, colors are adjusted to use zero wavefunction amplitude as the neutral color in the palette

  • grids_dict (Dict[int, Grid1d]) – A dictionary which pairs var indices with the grids used to create the plot. The way to specify the grids is as follows: 1. For extended variables, the grids should be of type discretization.Grid1d. 2. When the discretized phi basis is used for the extended variable, the grids used in the diagonalization is used to plot the wave function instead of the grids specified here. 3. For periodic variables, only if change_discrete_charge_to_phi is True, the grid specified here will used for plotting. The grid is specified as an integer which is the number of points in the grid. The grid has a minimum and maximum value of -pi and pi respectively. 4. If the grid is not specified for a variable that requires a grid for plotting (i.e. extended variable with harmonic oscillator basis, or periodic variable with change_discrete_charge_to_phi set to True), the default grid is used.

  • **kwargs – plotting parameters

Return type:

Tuple[Figure, Axes]

Returns:

Returns a axes and figure for further editing.

potential_energy(**kwargs)#

Returns the full potential of the circuit evaluated in a grid of points as chosen by the user or using default variable ranges.

Parameters:

θ<index> – value(s) for variable :math:` heta_i` in the potential.

Return type:

ndarray

static print_expr_in_latex(expr)#

Print a sympy expression or a list of equalities in LaTeX

Parameters:

expr (Union[Expr, List[Equality]]) – a sympy expressions or a list of equalities

Return type:

None

process_hamiltonian(native_hamiltonian, energy_esys=False)#

Return qubit Hamiltonian in chosen basis: either return unchanged (i.e., in native basis) or transform into eigenenergy basis

Parameters:
  • native_hamiltonian (Union[ndarray, csc_matrix]) – Hamiltonian in native basis

  • energy_esys (Union[bool, Tuple[ndarray, ndarray]]) – If False (default), returns Hamiltonian in the native basis If True, the energy eigenspectrum is computed, returns Hamiltonian in the energy eigenbasis if energy_esys is the energy eigenspectrum, in the form of a tuple containing two ndarrays (eigenvalues and energy eigenvectors), returns Hamiltonian in the energy eigenbasis, and does not have to recalculate eigenspectrum.

Return type:

Union[ndarray, csc_matrix]

Returns:

Hamiltonian, either unchanged in native basis, or transformed into eigenenergy basis

process_op(native_op, energy_esys=False)#

Processes the operator native_op: either hand back native_op unchanged, or transform it into the energy eigenbasis. (Native basis refers to the basis used internally by each qubit, e.g., charge basis in the case of Transmon.

Parameters:
  • native_op (Union[ndarray, csc_matrix]) – operator in native basis

  • energy_esys (Union[bool, Tuple[ndarray, ndarray]]) – If False (default), returns operator in the native basis If True, the energy eigenspectrum is computed, returns operator in the energy eigenbasis if energy_esys is the energy eigenspectrum, in the form of a tuple containing two ndarrays (eigenvalues and energy eigenvectors), returns operator in the energy eigenbasis, and does not have to recalculate eigenspectrum.

Return type:

Union[ndarray, csc_matrix]

Returns:

native_op either unchanged or transformed into eigenenergy basis

qubit_list(qbt_index_list)[source]#

If hierarchical diagonalization is used, specify subsystems that corresponds to single-mode oscillators, if there is any. The attributes _osc_subsys_list and osc_subsys_list of the hilbert_space attribute of the Circuit instance will be assigned accordingly, enabling the correct identification of harmonic modes for the dispersive regime analysis in ParameterSweep.

Parameters:

qbt_index_list (List[int]) – a list of indices of subsystems that are single-mode harmonic oscillators

receive(event, sender, **kwargs)#

Method to help the CentralDispatch keep track of the sync status in Circuit and SubSystem modules

Return type:

None

Parameters:
  • event (str) –

  • sender (object) –

return_parent_circuit()#

Returns the parent Circuit instance.

serialize()#

Convert the content of the current class instance into IOData format.

Return type:

IOData

set_and_return(attr_name, value)#

Allows to set an attribute after which self is returned. This is useful for doing something like example:

qubit.set_and_return('flux', 0.23).some_method()

instead of example:

qubit.flux=0.23
qubit.some_method()
Parameters:
  • attr_name (str) – name of class attribute in string form

  • value (Any) – value that the attribute is to be set to

Return type:

QubitBaseClass

Returns:

self

set_discretized_phi_range(var_indices, phi_range)#

Sets the flux range for discretized phi basis or for plotting

Parameters:
  • var_indices (Tuple[int]) – list of var_indices whose range needs to be changed

  • phi_range (Tuple[float]) – The desired range for each of the discretized phi variables

Return type:

None

set_operators()#

Creates the operator methods <name>_operator for the circuit.

Return type:

Dict[str, Callable]

set_params(**kwargs)#

Set new parameters through the provided dictionary.

set_params_from_gui(change)#

Set new parameters through the provided dictionary.

supported_noise_channels()[source]#

Return a list of supported noise channels

Return type:

List[str]

sym_external_fluxes()[source]#

Method returns a dictionary of Human readable external fluxes with associated branches and loops (represented as lists of branches) for the current instance

Return type:

Dict[Expr, Tuple[Branch, List[Branch]]]

Returns:

A dictionary of Human readable external fluxes with their associated branches and loops

sym_hamiltonian(subsystem_index=None, float_round=6, print_latex=False, return_expr=False)#

Prints a user readable symbolic Hamiltonian for the current instance

Parameters:
  • subsystem_index (Optional[int]) – when set to an index, the Hamiltonian for the corresponding subsystem is returned.

  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sym_interaction(subsystem_indices, float_round=6, print_latex=False, return_expr=False)#

Print the interaction between any set of subsystems for the current instance. It would print the interaction terms having operators from all the subsystems mentioned in the tuple.

Parameters:
  • subsystem_indices (Tuple[int]) – Tuple of subsystem indices

  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sym_lagrangian(vars_type='node', print_latex=False, return_expr=False)[source]#

Method that gives a user readable symbolic Lagrangian for the current instance

Parameters:
  • vars_type (str) – “node” or “new”, fixes the kind of lagrangian requested, by default “node”

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sym_potential(float_round=6, print_latex=False, return_expr=False)#

Method prints a user readable symbolic potential for the current instance

Parameters:
  • float_round (int) – Number of digits after the decimal to which floats are rounded

  • print_latex (bool) – if set to True, the expression is additionally printed as LaTeX code

  • return_expr (bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression

Return type:

Optional[Expr]

sync_parameters_with_parent()#

Method syncs the parameters of the subsystem with the parent instance.

t1(i, j, noise_op, spectral_density, T=0.015, total=True, esys=None, get_rate=False)#

Calculate the transition time (or rate) using Fermi’s Golden Rule due to a noise channel with a spectral density spectral_density and system noise operator noise_op. Mathematically, it reads:

\[\frac{1}{T_1} = \frac{1}{\hbar^2} |\langle i| A_{\rm noise} | j \rangle|^2 S(\omega)\]

We assume that the qubit energies (or the passed in eigenspectrum) has units of frequency (and not angular frequency).

The spectral_density argument should be a callable object (typically a function) of one argument, which is assumed to be an angular frequency (in the units currently set as system units.

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • noise_op (Union[ndarray, csc_matrix]) – noise operator

  • T (float) – Temperature defined in Kelvin

  • spectral_density (Callable) – defines a spectral density, must take two arguments: omega and T (assumed to be in units of 2 pi * <system units>)

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, noise_op=None, branch_params=None)#

\(T_1\) due to dielectric dissipation in the Josephson junction capacitances.

References: Smith et al (2020), see also Nguyen et al (2019).

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • Q_cap (Union[float, Callable, None]) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

  • noise_op (ndarray | csc_matrix | Qobj | None) –

  • branch_params (dict | None) –

Returns:

time or rate

decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate

in inverse units.

Return type:

float

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, noise_op=None)#

Noise due to charge coupling to an impedance (such as a transmission line).

References: Schoelkopf et al (2003), Ithier et al (2005)

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • Z (Union[float, Callable]) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

  • noise_op (ndarray | csc_matrix | Qobj | None) –

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

t1_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)#

Calculate the effective \(T_1\) time (or rate).

The effective \(T_1\) is calculated by considering a variety of depolarizing noise channels, according to the formula:

\[\frac{1}{T_{1}^{\rm eff}} = \frac{1}{2} \sum_k \frac{1}{T_{1}^{k}}\]

where \(k\) runs over the channels that can contribute to the effective noise. By default all the depolarizing noise channels given by the method effective_noise_channels are included. Users can also provide specific noise channels, with selected options, to be included in the effective \(T_1\) calculation. For example, assuming qubit is a qubit object, can can execute:

tune_tmon.t1_effective(noise_channels=['t1_charge_impedance',
                        't1_flux_bias_line'],
                        common_noise_options=dict(T=0.050))
Parameters:
  • noise_channels (Union[str, List[str], List[Tuple[str, Dict]], None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are used

  • common_noise_options (Optional[Dict]) – common options used when calculating coherence times

  • esys (Optional[Tuple[ndarray, ndarray]]) – spectral data used during noise calculations

  • get_rate (bool) – get rate or time

Return type:

float

Returns:

decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate

in inverse units.

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, noise_op_method=None)#

Noise due to a bias flux line.

References: Koch et al (2007), Groszkowski et al (2018)

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • M (float) – Inductance in units of Phi_0 / Ampere

  • Z (Union[complex, float, Callable]) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

  • noise_op_method (Callable | None) –

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, noise_op=None, branch_params=None)#

\(T_1\) due to inductive dissipation in a superinductor.

References: Smith et al (2020), see also Nguyen et al (2019).

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • Q_ind (Union[float, Callable, None]) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

  • noise_op (ndarray | csc_matrix | Qobj | None) –

  • branch_params (dict | None) –

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

t1_quasiparticle_tunneling(i=1, j=0, Y_qp=None, x_qp=3e-06, T=0.015, Delta=0.00034, total=True, esys=None, get_rate=False, noise_op=None)#

Noise due to quasiparticle tunneling across a Josephson junction.

References: Smith et al (2020), Catelani et al (2011), Pop et al (2014).

Parameters:
  • i (int >=0) – state index that along with j defines a transition (i->j)

  • j (int >=0) – state index that along with i defines a transition (i->j)

  • Y_qp (Union[float, Callable, None]) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (float) – superconducting gap (in units of eV)

  • total (bool) – if False return a time/rate associated with a transition from state i to state j. if True return a time/rate associated with both i to j and j to i transitions

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

  • noise_op (ndarray | csc_matrix | Qobj | None) –

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False)#

Calculate the effective \(T_2\) time (or rate).

The effective \(T_2\) is calculated by considering a variety of pure dephasing and depolarizing noise channels, according to the formula:

\[\frac{1}{T_{2}^{\rm eff}} = \sum_k \frac{1}{T_{\phi}^{k}} + \frac{1}{2} \sum_j \frac{1}{T_{1}^{j}},\]

where \(k\) (\(j\)) run over the relevant pure dephasing ( depolarization) channels that can contribute to the effective noise. By default all the noise channels given by the method effective_noise_channels are included. Users can also provide specific noise channels, with selected options, to be included in the effective \(T_2\) calculation. For example, assuming qubit is a qubit object, can can execute:

qubit.t2_effective(noise_channels=['t1_flux_bias_line', 't1_capacitive',
                                   ('tphi_1_over_f_flux', dict(A_noise=3e-6))],
                   common_noise_options=dict(T=0.050))
Parameters:
  • noise_channels (None or str or list(str) or list(tuple(str, dict))) – channels to be plotted, if None then noise channels given by supported_noise_channels are used

  • common_noise_options (dict) – common options used when calculating coherence times

  • esys (tuple(evals, evecs)) – spectral data used during noise calculations

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

tphi_1_over_f(A_noise, i, j, noise_op, esys=None, get_rate=False, **kwargs)#

Calculate the 1/f dephasing time (or rate) due to arbitrary noise source.

We assume that the qubit energies (or the passed in eigenspectrum) has units of frequency (and not angular frequency).

Parameters:
  • A_noise (float) – noise strength

  • i (int >=0) – state index that along with j defines a qubit

  • j (int >=0) – state index that along with i defines a qubit

  • noise_op (Union[ndarray, csc_matrix]) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

tphi_1_over_f_cc(A_noise=1e-07, i=0, j=1, esys=None, get_rate=False, **kwargs)#

Calculate the 1/f dephasing time (or rate) due to critical current noise.

Parameters:
  • A_noise (float) – noise strength

  • i (int >=0) – state index that along with j defines a qubit

  • j (int >=0) – state index that along with i defines a qubit

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

tphi_1_over_f_flux(A_noise=1e-06, i=0, j=1, esys=None, get_rate=False, **kwargs)#

Calculate the 1/f dephasing time (or rate) due to flux noise.

Parameters:
  • A_noise (float) – noise strength

  • i (int >=0) – state index that along with j defines a qubit

  • j (int >=0) – state index that along with i defines a qubit

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

tphi_1_over_f_ng(A_noise=0.0001, i=0, j=1, esys=None, get_rate=False, **kwargs)#

Calculate the 1/f dephasing time (or rate) due to charge noise.

Parameters:
  • A_noise (float) – noise strength

  • i (int >=0) – state index that along with j defines a qubit

  • j (int >=0) – state index that along with i defines a qubit

  • esys (Optional[Tuple[ndarray, ndarray]]) – evals, evecs tuple

  • get_rate (bool) – get rate or time

Returns:

time or rate – decoherence time in units of \(2\pi ({\rm system\,\,units})\), or rate in inverse units.

Return type:

float

update(calculate_bare_esys=True)#

Syncs all the parameters of the subsystems with the current instance.

Parameters:

calculate_bare_esys (bool) –

update_interactions(recursive=False)#

Update interactions of the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.

Return type:

None

variable_transformation(new_vars_to_node_vars=True)[source]#

Prints the variable transformation used in this circuit

Return type:

None

widget(params=None)#

Use ipywidgets to modify parameters of class instance

Parameters:

params (Dict[str, Any] | None) –