CircuitRoutines¶
- class scqubits.core.circuit_routines.CircuitRoutines[source]¶
Methods
CircuitRoutines.__init__()CircuitRoutines.create()Returns a dictionary, where each variable is associated with its respective cutoff.
CircuitRoutines.default_params()CircuitRoutines.deserialize(io_data)CircuitRoutines.discretized_grids_dict_for_vars()CircuitRoutines.exp_i_operator(var_sym, ...)Returns the bare operator exp(i* heta*prefactor), without the kron product.
Returns the eigensystem of the Circuit, and all the subsystems involved in the bare basis.
Method to get the cutoffs for each of the circuit's degree of freedom.
Get the ext_basis object for the Circuit instance, according to the setting in self.hierarchical_diagonalization.
CircuitRoutines.get_operator_by_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.
CircuitRoutines.get_osc_param(var_index[, ...])Returns the oscillator parameters based on the oscillator used to diagonalize the Hamiltonian in the harmonic oscillator basis.
CircuitRoutines.get_subsystem_index(var_index)Returns the subsystem index for the subsystem to which the given var_index belongs.
Returns the Hamiltonian of the Circuit.
Returns the Hilbert dimension of the Circuit instance.
CircuitRoutines.identity_wrap_for_hd(...[, ...])Returns an identity wrapped operator whose size is equal to the self.hilbertdim().
CircuitRoutines.is_subsystem(instance)Returns true if the instance is a subsystem of self (regardless of the hierarchy)
Returns all the offset charges set using the circuit attributes for each of the periodic degree of freedom.
CircuitRoutines.receive(event, sender, **kwargs)Method to help the CentralDispatch keep track of the sync status in Circuit and SubSystem modules.
Returns the parent Circuit instance.
CircuitRoutines.return_root_child(var_index)Returns the root child of the subsystem instance with var_index in its dynamic_var_indices.
CircuitRoutines.serialize()CircuitRoutines.set_and_return(attr_name, value)Allows to set an attribute after which self is returned. This is useful for doing something like example::.
CircuitRoutines.set_bare_eigensys(eigensys)Sets the bare eigensystem of the Circuit in the lookup table of
hilbert_spaceattribute, if hierarchical diagonalization is used.Sets the flux range for discretized phi basis or for plotting.
CircuitRoutines.update([calculate_bare_esys])Syncs all the parameters of the subsystems with the current instance.
- 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}
- exp_i_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)
- generate_bare_eigensys()[source]¶
Returns the eigensystem of the Circuit, and all the subsystems involved in the bare basis.
- get_cutoffs()[source]¶
Method to get the cutoffs for each of the circuit’s degree of freedom.
- Return type:
Dict[str,list]
- get_ext_basis()[source]¶
Get the ext_basis object for the Circuit instance, according to the setting in self.hierarchical_diagonalization.
- Return type:
Union[str,List[str]]
- get_operator_by_name(operator_name, power=None, bare_esys=None)[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 attributevarspower (
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
- 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_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, child_instance, bare_esys=None)[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, ndarrayinstance – The subsystem to which the operator belongs
bare_esys (
Optional[Dict[int,Tuple]]) – Dict containing subsystem indices starting from 0, paired with the bare esys for each of the subsystem
- Return type:
Qobj- Returns:
identity wrapped operator.
- is_subsystem(instance)[source]¶
Returns true if the instance is a subsystem of self (regardless of the hierarchy)
- offset_free_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]
- receive(event, sender, **kwargs)[source]¶
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_root_child(var_index)[source]¶
Returns the root child of the subsystem instance with var_index in its dynamic_var_indices.
- Parameters:
var_index (
int) – index of one of the dynamical degrees of freedom (fromdynamic_var_indices)- Returns:
Subsystem instance with var_index in its dynamic_var_indices.
- set_and_return(attr_name, value)[source]¶
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_bare_eigensys(eigensys)[source]¶
Sets the bare eigensystem of the Circuit in the lookup table of
hilbert_spaceattribute, if hierarchical diagonalization is used.
- set_discretized_phi_range(var_indices, phi_range)[source]¶
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 changedphi_range (
Tuple[float]) – The desired range for each of the discretized phi variables
- Return type:
None