Circuit#

class scqubits.core.circuit.Circuit(symbolic_circuit, ext_basis='discretized', initiate_sym_calc=True, system_hierarchy=None, subsystem_trunc_dims=None, truncated_dim=None)[source]#

Class for analysis of custom superconducting circuits.

Parameters
  • symbolic_circuit (SymbolicCircuit) – an instance of the class SymbolicCircuit

  • 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

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

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

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

Returns

An instance of class Circuit

Return type

Circuit

Methods

Circuit.__init__(symbolic_circuit[, ...])

Circuit.broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Circuit.build_hilbertspace()

Builds the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.

Circuit.circuit_operator_functions()

Returns the set of operator functions to be turned into methods of the Circuit class.

Circuit.clear_unnecessary_attribs()

Clear all the attributes which are not part of the circuit description

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.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.external_flux_values()

Returns all the time independent external flux set using the circuit attributes for each of the closure branches.

Circuit.filewrite(filename)

Convenience method bound to the class.

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

Create a Circuit class instance from a circuit graph described in an input string in YAML format.

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_subsystems()

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

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

Returns the plot of the probability density of the wave function in the requested variables for the current Circuit instance.

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_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.hilbertdim()

Returns the Hilbert dimension of the Circuit instance

Circuit.matrix_power_sparse(x, n)

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

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

Circuit.offset_charge_transformation()

Returns the variable transformation between offset charges of periodic variables and the offset node charges

Circuit.offset_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.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_wavefunction([which, ...])

Returns the plot of the probability density of the wave function in the requested variables for the current Circuit instance.

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.receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

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_operators()

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

Circuit.set_params(**kwargs)

Set new parameters through the provided dictionary.

Circuit.supported_noise_channels()

Returns a list of noise channels this QuantumSystem supports.

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, ...])

Method returns a user readable symbolic Hamiltonian for the current instance

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

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

Circuit.sym_lagrangian([vars_type, print_latex])

Method returns a user readable symbolic Lagrangian for the current instance

Circuit.sym_potential([float_round, print_latex])

Method returns a user readable symbolic Lagrangian for the current instance

Circuit.variable_transformation()

Returns the variable transformation used in this circuit

Circuit.widget([params])

Use ipywidgets to modify parameters of class instance

Attributes

id_str

truncated_dim

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

broadcast(event, **kwargs)#

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

Return type

None

build_hilbertspace()#

Builds the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.

circuit_operator_functions()#

Returns the set of operator functions to be turned into methods of the Circuit class.

Return type

Dict[str, Callable]

clear_unnecessary_attribs()[source]#

Clear all the attributes which are not part of the circuit description

configure(transformation_matrix=None, system_hierarchy=None, subsystem_trunc_dims=None, closure_branches=None)[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.

Raises

Exception – when system_hierarchy is set and subsystem_trunc_dims is not set.

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.

Returns

Cutoffs dictionary; {var_index: cutoff}

Return type

Dict[int, int]

static default_params()#

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.

Return type

Serializable

Parameters

io_data (IOData) –

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 (bool) – 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

external_flux_values()#

Returns all the time independent external flux set using the circuit attributes for each of the closure branches.

Return type

List[float]

filewrite(filename)#

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

Return type

None

Parameters

filename (str) –

classmethod from_yaml(input_string, from_file=True, ext_basis='discretized', basis_completion='heuristic', initiate_sym_calc=True, system_hierarchy=None, subsystem_trunc_dims=None, truncated_dim=None)[source]#

Create a Circuit class instance from a circuit graph described in an input string in YAML format.

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.

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

  • 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”

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

  • 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]) – a dict object which can be generated for a specific system_hierarchy using the method truncation_template, by default None

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

Returns

An instance of class 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. Stores the result in the attribute _hamiltonian_sym_for_numerics.

generate_subsystems()#

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

generate_wf_plot_data(which=0, var_indices=(1,), eigensys=None, change_discrete_charge_to_phi=True)#

Returns the plot of the probability density of the wave function in the requested variables for the current Circuit instance.

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

  • 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]) – The object returned by the method instance. eigensys is used to avoid the re-evaluation of the eigensystems if already evaluated.

  • change_discrete_charge_to_phi (bool) – boolean to choose if the discrete charge basis for the periodic variable needs to be changed to phi basis.

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_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)#

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

Return type

Qobj

Returns

operator

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.

hilbertdim()#

Returns the Hilbert dimension of the Circuit instance

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()[source]#

Returns the variable transformation between offset charges of periodic variables and the offset node charges

Returns

Human readable form of expressions of offset charges in terms of node offset charges

Return type

sm.Expr

offset_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]

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> (Union[ndarray, float]) – value(s) for the variable \(\theta_i\) occurring in the potential.

plot_wavefunction(which=0, var_indices=(1,), esys=None, change_discrete_charge_to_phi=True, zero_calibrate=True, **kwargs)#

Returns the plot of the probability density of the wave function in the requested variables for the current Circuit instance.

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

  • 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.

  • 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) – chooses if the discrete charge basis for the periodic variable needs to be changed to phi basis.

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

  • **kwargs – plotting parameters

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

receive(event, sender, **kwargs)#

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

Return type

None

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_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.

supported_noise_channels()#

Returns a list of noise channels this QuantumSystem supports. If none, return an empty list.

Return type

List

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=3, print_latex=False)#

Method returns 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

Returns

Sympy expression which is simplified to make it human readable.

Return type

hamiltonian

sym_interaction(subsystem_indices, float_round=3, print_latex=False)#

Returns the interaction between any set of subsystems for the current instance. It would return 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

Returns

Sympy Expr object having interaction terms which have operators from all the mentioned subsystems.

Return type

interaction

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

Method returns 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 type

Human readable form of the Lagrangian

sym_potential(float_round=3, print_latex=False)#

Method returns a user readable symbolic Lagrangian 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 type

Human readable form of the Lagrangian

variable_transformation()[source]#

Returns the variable transformation used in this circuit

Returns

_description_

Return type

sm.Expr

widget(params=None)#

Use ipywidgets to modify parameters of class instance

Parameters

params (Optional[Dict[str, Any]]) –