Subsystem#
- class scqubits.core.circuit.Subsystem(parent, hamiltonian_symbolic, system_hierarchy=None, subsystem_trunc_dims=None, truncated_dim=10, evals_method=None, evals_method_options=None, esys_method=None, esys_method_options=None)[source]#
Defines a subsystem for a circuit, which can further be used recursively to define subsystems within subsystem.
- Parameters:
parent (Subsystem) – the instance under which the new subsystem is defined.
hamiltonian_symbolic (sm.Expr) – The symbolic expression which defines the Hamiltonian for the new subsystem
system_hierarchy (Optional[List], optional) – Defines the hierarchy of the new subsystem, is set to None when hierarchical diagonalization is not required. by default None
subsystem_trunc_dims (Optional[List], optional) – Defines the truncated dimensions for the subsystems inside the current subsystem, is set to None when hierarchical diagonalization is not required, by default None
truncated_dim (Optional[int], optional) – sets the truncated dimension for the current subsystem, set to 10 by default.
- Return type:
QuantumSystemType
Methods
Returns the qubit's fundamental energy splitting, E_1 - E_0.
Subsystem.__init__(parent, hamiltonian_symbolic)Returns the qubit's anharmonicity, (E_2 - E_1) - (E_1 - E_0).
Subsystem.broadcast(event, **kwargs)Request a broadcast from CENTRAL_DISPATCH reporting event.
Subsystem.build_hilbertspace([...])Builds the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.
Returns the set of operator functions to be turned into methods of the Circuit class.
Use ipywidgets to create a new class instance
Subsystem.create_from_file(filename)Read initdata and spectral data from file, and use those to create a new SpectrumData object.
Returns a dictionary, where each variable is associated with its respective cutoff.
Return dictionary with default parameter values for initialization of class instance
Subsystem.deserialize(io_data)Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.
Subsystem.eigensys([evals_count, filename, ...])Calculates eigenvalues and corresponding eigenvectors using scipy.linalg.eigh.
Subsystem.eigenvals([evals_count, filename, ...])Calculates eigenvalues using scipy.linalg.eigh, returns numpy array of eigenvalues.
Subsystem.exp_i_pos_operator(var_sym, prefactor)Returns the bare operator exp(i* heta*prefactor), without the kron product.
Returns all the time independent external flux set using the circuit attributes for each of the closure branches.
Subsystem.filewrite(filename)Convenience method bound to the class.
Generates a symbolic expression which is ready for numerical evaluation starting from the expression stored in the attribute hamiltonian_symbolic.
Generates the subsystems (child instances of Circuit) depending on the attribute self.system_hierarchy
Subsystem.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.
Method to get the cutoffs for each of the circuit's degree of freedom.
Subsystem.get_dispersion_vs_paramvals(...[, ...])Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values.
Returns the eigenstates for the SubSystem instance
Returns dict appropriate for creating/initializing a new Serializable object.
Calculates matrix elements for a varying system parameter, given an array of parameter values.
Subsystem.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.
Returns a list of all operator names for the quantum system.
Subsystem.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.
Method to get the circuit parameters set for all the branches.
Subsystem.get_spectrum_vs_paramvals(...[, ...])Calculates eigenvalues/eigenstates for a varying system parameter, given an array of parameter values.
Subsystem.get_subsystem_index(var_index)Returns the subsystem index for the subsystem to which the given var_index belongs.
Subsystem.grids_dict_for_discretized_extended_vars()Returns the Hamiltonian of the Circuit.
Returns the Hilbert dimension of the Circuit instance
Subsystem.identity_wrap_for_hd(operator, ...)Returns an identity wrapped operator whose size is equal to the self.hilbertdim().
Subsystem.matrixelement_table(operator[, ...])Returns table of matrix elements for operator with respect to the eigenstates of the qubit.
Returns all the offset charges set using the circuit attributes for each of the periodic degree of freedom.
Returns a list of the names (strings) of all operators occurring in the symbolic Hamiltonian.
Generates a simple plot of a set of curves representing the charge or flux dispersion of transition energies.
Subsystem.plot_evals_vs_paramvals(...[, ...])Generates a simple plot of a set of eigenvalues as a function of one parameter.
Subsystem.plot_matelem_vs_paramvals(...[, ...])Generates a simple plot of a set of eigenvalues as a function of one parameter.
Subsystem.plot_matrixelements(operator[, ...])Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix.
Subsystem.plot_potential(**kwargs)Returns the plot of the potential for the circuit instance.
Subsystem.plot_wavefunction([which, ...])Returns the plot of the probability density of the wave function in the requested variables for the current Circuit instance.
Subsystem.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.
Print a sympy expression or a list of equalities in LaTeX
Subsystem.process_hamiltonian(native_hamiltonian)Return qubit Hamiltonian in chosen basis: either return unchanged (i.e., in native basis) or transform into eigenenergy basis
Subsystem.process_op(native_op[, energy_esys])Processes the operator native_op: either hand back native_op unchanged, or transform it into the energy eigenbasis.
Subsystem.receive(event, sender, **kwargs)Receive a message from CENTRAL_DISPATCH and initiate action on it.
Convert the content of the current class instance into IOData format.
Subsystem.set_and_return(attr_name, value)Allows to set an attribute after which self is returned. This is useful for doing something like example::.
Creates the operator methods <name>_operator for the circuit.
Subsystem.set_params(**kwargs)Set new parameters through the provided dictionary.
Subsystem.set_params_from_gui(change)Set new parameters through the provided dictionary.
Returns a list of noise channels this QuantumSystem supports.
Subsystem.sym_hamiltonian([subsystem_index, ...])Prints a user readable symbolic Hamiltonian for the current instance
Subsystem.sym_interaction(subsystem_indices)Print the interaction between any set of subsystems for the current instance.
Subsystem.sym_potential([float_round, ...])Method prints a user readable symbolic potential for the current instance
Subsystem.widget([params])Use ipywidgets to modify parameters of class instance
Attributes
id_strtruncated_dimDescriptor 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
- build_hilbertspace(update_subsystem_indices=None)[source]#
Builds the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.
- Parameters:
update_subsystem_indices (
Optional[List[int]]) – List of subsystem indices which need to be updated. If set to None, all the are updated.- Return type:
None
- circuit_operator_functions()[source]#
Returns the set of operator functions to be turned into methods of the Circuit class.
- Return type:
Dict[str,Callable]
- classmethod create()#
Use ipywidgets to create a new class instance
- Return type:
- 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:
- Parameters:
filename (str) –
- cutoffs_dict()[source]#
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.
- Return type:
TypeVar(SerializableType, bound= 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 (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_pos_operator(var_sym, prefactor)[source]#
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) –
- external_flux_values()[source]#
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) –
- generate_hamiltonian_sym_for_numerics()[source]#
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()[source]#
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, grids_dict=None)[source]#
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 plotvar_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.
grids_dict (
Optional[Dict[int,Grid1d]]) – A dictionary which pairs var indices with the requested grids used to create the plot.
- get_cutoffs()[source]#
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 variedparam_vals (
ndarray) – parameter values to be plugged inref_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_paramtransitions (
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 givenpoint_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:
- 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 matrixparam_name (
str) – name of parameter to be variedparam_vals (
ndarray) – parameter values to be plugged inevals_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:
- get_operator_by_name(operator_name)[source]#
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 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')[source]#
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 fetchedwhich_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()[source]#
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 variedparam_vals (
ndarray) – parameter values to be plugged inevals_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 wantednum_cpus (
Optional[int]) – number of cores to be used for computation (default value: settings.NUM_CPUS)
- Return type:
- get_subsystem_index(var_index)[source]#
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()[source]#
Returns the Hamiltonian of the Circuit.
- Return type:
Union[csc_matrix,ndarray]
- identity_wrap_for_hd(operator, var_index)[source]#
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, ndarrayvar_index (
int) – integer which represents which variable index the given operator belongs to
- Return type:
Qobj- Returns:
identity wrapped operator.
- 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 flyevals_count (
int) – number of desired matrix elements, starting with ground state (default value = 6)filename (
Optional[str]) – output file namereturn_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_values()[source]#
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()[source]#
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 variedparam_vals (
ndarray) – parameter values to be plugged inref_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_paramtransitions (
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 givenpoint_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 variedparam_vals (
ndarray) – parameter values to be plugged inevals_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 matrixparam_name (
str) – name of parameter to be variedparam_vals (
ndarray) – parameter values to be plugged inselect_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 matrixevecs (
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)[source]#
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_wavefunction(which=0, var_indices=(1,), esys=None, change_discrete_charge_to_phi=True, zero_calibrate=True, grids_dict={}, **kwargs)[source]#
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
grids_dict (
Dict[int,Grid1d]) – A dictionary which pairs var indices with the requested grids used to create the plot.**kwargs – plotting parameters
- Return type:
Tuple[Figure,Axes]- Returns:
Returns a axes and figure for further editing.
- potential_energy(**kwargs)[source]#
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)[source]#
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 basisenergy_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 basisenergy_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
- receive(event, sender, **kwargs)#
Receive a message from CENTRAL_DISPATCH and initiate action on it.
- Parameters:
event (
str) – event name from EVENTSsender (
DispatchClient) – original sender reporting the event**kwargs –
- Return type:
None
- serialize()#
Convert the content of the current class instance into IOData format.
- Return type:
- 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 formvalue (
Any) – value that the attribute is to be set to
- Return type:
- Returns:
self
- set_operators()[source]#
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()#
Returns a list of noise channels this QuantumSystem supports. If none, return an empty list.
- Return type:
List
- sym_hamiltonian(subsystem_index=None, float_round=6, print_latex=False, return_expr=False)[source]#
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 roundedprint_latex (
bool) – if set to True, the expression is additionally printed as LaTeX codereturn_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)[source]#
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 indicesfloat_round (
int) – Number of digits after the decimal to which floats are roundedprint_latex (
bool) – if set to True, the expression is additionally printed as LaTeX codereturn_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)[source]#
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 roundedprint_latex (
bool) – if set to True, the expression is additionally printed as LaTeX codereturn_expr (
bool) – if set to True, all printing is suppressed and the function will silently return the sympy expression
- Return type:
Optional[Expr]
- widget(params=None)#
Use ipywidgets to modify parameters of class instance
- Parameters:
params (Dict[str, Any] | None) –