Subsystem¶
- class scqubits.core.circuit.Subsystem(parent, hamiltonian_symbolic, ext_basis, 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.
ext_basis (str) – The basis that should be used for extended variables
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.
evals_method (Callable | str | None)
evals_method_options (dict | None)
esys_method (Callable | str | None)
esys_method_options (dict | None)
Methods
Returns the qubit's fundamental energy splitting, E_1 - E_0.
Subsystem.Q_from_branch
(branch)Extracts the Quality Factor 'Q' from a Given Branch
Subsystem.__init__
(parent, ...[, ...])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.
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.discretized_grids_dict_for_vars
()Return a list of noise channels that are used when calculating the effective noise (i.e. via t1_effective and t2_effective.
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_operator
(var_sym, prefactor)Returns the bare operator exp(i* heta*prefactor), without the kron product.
Method to fetch the symbolic hamiltonian of an instance.
Subsystem.filewrite
(filename)Convenience method bound to the class.
Subsystem.generate_bare_eigensys
()Generates a symbolic expression which is ready for numerical evaluation starting from the expression stored in the attribute hamiltonian_symbolic.
Derivative of the Hamiltonian Generator
Noise Method Generation for Quantum Circuit
T1 Coherence Time Calculator due to Capacitive Noise
T1 Coherence Time Calculation Due to Charge Impedance Noise :2: (WARNING/2) Title underline too short. T1 Coherence Time Calculation Due to Charge Impedance Noise ----------------------------------------------------------
T1 Coherence Time Calculation Due to Flux Bias Line Noise :2: (WARNING/2) Title underline too short. T1 Coherence Time Calculation Due to Flux Bias Line Noise --------------------------------------------------------
T1 Coherence Time Calculator due to Inductive Noise
T1 Coherence Time Calculator due to Quasiparticle Tunneling
Overall Dephasing Time (Tphi) Calculator due to 1/f Critical Current (cc) Noise
Overall Dephasing Time (Tphi) Calculator due to 1/f Flux Noise
Overall Dephasing Time (Tphi) Calculator due to 1/f Flux Noise
Generates the subsystems (child instances of Circuit) depending on the attribute self.system_hierarchy
Subsystem.generate_sym_potential
()T1 Coherence Time Calculator due to Flux Bias Line Noise
Generates methods for calculating the T1 coherence times due to capacitive, inductive, and charge impedance noise for each branch in the circuit.
Generate Methods for 1/f Dephasing Time (or Rate) Calculations
Subsystem.generate_wf_plot_data
([which, ...])Returns treated wave function of the current Circuit instance for the specified variables.
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
Get the ext_basis object for the Circuit instance, according to the setting in self.hierarchical_diagonalization
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.
Returns the Hamiltonian of the Circuit.
Returns the Hamiltonian in a format amenable to be forwarded to mesolve in Qutip.
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.is_subsystem
(instance)Returns true if the instance is a subsystem of self (regardless of the hierarchy)
Subsystem.junction_related_evaluation
(...[, ...])Junction-Related Quantity Evaluator
Subsystem.matrixelement_table
(operator[, ...])Returns table of matrix elements for operator with respect to the eigenstates of the qubit.
Prints the variable transformation between offset charges of transformed variables and the node charges.
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.
Subsystem.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.
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.
Plot effective \(T_1\) coherence time (rate) as a function of changing parameter.
Plot effective \(T_2\) coherence time (rate) as a function of changing parameter.
Subsystem.plot_wavefunction
([which, mode, ...])Returns the plot of the wavefunction in the requested variables.
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)Method to help the CentralDispatch keep track of the sync status in Circuit and SubSystem modules
Returns the parent Circuit instance.
Subsystem.return_root_child
(var_index)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::.
Subsystem.set_bare_eigensys
(eigensys)Sets the flux range for discretized phi basis or for plotting
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
Method syncs the parameters of the subsystem with the parent instance.
Subsystem.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.
Subsystem.t1_capacitive
([i, j, Q_cap, T, ...])\(T_1\) due to dielectric dissipation in the Josephson junction capacitances.
Subsystem.t1_charge_impedance
([i, j, Z, T, ...])Noise due to charge coupling to an impedance (such as a transmission line).
Subsystem.t1_effective
([noise_channels, ...])Calculate the effective \(T_1\) time (or rate).
Subsystem.t1_flux_bias_line
([i, j, M, Z, T, ...])Noise due to a bias flux line.
Subsystem.t1_inductive
([i, j, Q_ind, T, ...])\(T_1\) due to inductive dissipation in a superinductor.
Subsystem.t1_quasiparticle_tunneling
([i, j, ...])Noise due to quasiparticle tunneling across a Josephson junction.
Subsystem.t2_effective
([noise_channels, ...])Calculate the effective \(T_2\) time (or rate).
Subsystem.tphi_1_over_f
(A_noise, i, j, noise_op)Calculate the 1/f dephasing time (or rate) due to arbitrary noise source.
Subsystem.tphi_1_over_f_cc
([A_noise, i, j, ...])Calculate the 1/f dephasing time (or rate) due to critical current noise.
Subsystem.tphi_1_over_f_flux
([A_noise, i, ...])Calculate the 1/f dephasing time (or rate) due to flux noise.
Subsystem.tphi_1_over_f_ng
([A_noise, i, j, ...])Calculate the 1/f dephasing time (or rate) due to charge noise.
Returns the first order and second order derivative of the nth eigenenergy
Subsystem.update
([calculate_bare_esys])Syncs all the parameters of the subsystems with the current instance.
Subsystem.update_interactions
([recursive])Update interactions of the HilbertSpace object for the Circuit instance if hierarchical_diagonalization is set to true.
Subsystem.widget
([params])Use ipywidgets to modify parameters of class instance
Subsystem.wrapper_t1_charge_impedance
(branch)T1 Coherence Time Calculator due to Inductive or Capacitive Noise
Subsystem.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
- static Q_from_branch(branch)¶
Extracts the Quality Factor ‘Q’ from a Given Branch¶
This method performs the following steps:
Determines the type of the branch (‘L’ for inductor or ‘C’ for capacitor) and constructs a key for the quality factor (‘Q_ind’ for inductor or ‘Q_cap’ for capacitor).
Checks if the key is in the auxiliary parameters of the branch. If not, the method returns None.
If the key is in the auxiliary parameters, it retrieves the value of the quality factor, which is a string.
Checks if the string can be evaluated as a float using the ‘is_string_float’ helper function. If it can, it converts the string to a float and returns it.
If the string cannot be evaluated as a float, it assumes that the string represents a function of frequency ‘omega’ and temperature ‘T’. It defines a new function ‘Q_func’ that takes ‘omega’ and ‘T’ as parameters and evaluates the string using Python’s ‘eval’ function. It returns ‘Q_func’.
Parameters:¶
branch (Branch): The branch from which to extract the quality factor. The branch should be an instance of the ‘Branch’ class. It should have a ‘type’ attribute that is either ‘L’ or ‘C’, and an ‘aux_params’ dictionary that contains a key ‘Q_ind’ or ‘Q_cap’ with the quality factor as the value.
Returns:¶
: float or function: The quality factor as a float, or a function that calculates the quality factor given frequency and temperature. If the branch does not have a quality factor, None is returned.
Raises:¶
AttributeError: If the branch does not have a ‘type’ attribute or an ‘aux_params’ dictionary. ValueError: If the branch’s type is not ‘L’ or ‘C’, or if the quality factor string cannot be evaluated as a float or a function of ‘omega’ and ‘T’.
- 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
- 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()¶
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()¶
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)
- classmethod effective_noise_channels()¶
Return a list of noise channels that are used when calculating the effective noise (i.e. via t1_effective and t2_effective.
- Return type:
List
[str
]
- 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)
- 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()¶
Derivative of the Hamiltonian Generator¶
This method generates methods that return the derivative of the Hamiltonian with respect to offset charges, external fluxes, and junction energies.
Steps:¶
Initializes three dictionaries to store the generated methods: ext_flux_1_over_f_methods for methods related to external fluxes, ng_1_over_f_methods for methods related to offset charges, and cc_1_over_f_methods for methods related to junction energies.
Iterates over the external fluxes (self.external_fluxes) and offset charges (self.offset_charges) of the current instance. For each parameter, it defines a new method param_derivative that calculates the derivative of the Hamiltonian with respect to that parameter. This is done by first fetching the symbolic Hamiltonian of the parent circuit, differentiating it with respect to the parameter using sympy’s diff function, substituting all symbolic parameters with their actual values, and finally evaluating the expression. The new method is then stored in the corresponding dictionary with a key that is based on the parameter’s name.
Iterates over the branches (self.branches) of the current instance. For each branch that is a junction (i.e., its type contains ‘JJ’), it defines a new method param_derivative that calculates the derivative of the Hamiltonian with respect to the junction energy. This is done by calling the junction_related_evaluation method with the branch and the calculation type ‘dhdEJ’. The new method is then stored in the corresponding dictionary with a key that is based on the branch’s ID.
Combines the dictionaries of methods into a single dictionary (noise_helper_methods) and stores this dictionary in the ‘noise_helper_methods’ attribute of the current instance.
Adds each method to the current instance as an attribute with the same name as the key in the dictionary using setattr.
The generated methods use the ‘return_parent_circuit’ method to get a parent circuit with a symbolic Hamiltonian and symbolic parameters, the ‘fetch_symbolic_hamiltonian’ method to get the symbolic Hamiltonian, the ‘_evaluate_symbolic_expr’ method to evaluate a symbolic expression, and the ‘junction_related_evaluation’ method to calculate a quantity related to a junction.
Raises:¶
AttributeError: If the current instance does not have the required methods or attributes.
Note:¶
This method modifies the current instance by adding new attributes and updating the ‘noise_helper_methods’ attribute.
- generate_noise_methods()¶
Noise Method Generation for Quantum Circuit¶
This function is responsible for dynamically generating all the methods that calculate the different types of noise in the quantum circuit.
- type self:
- param self:
The instance of the class where this method is being added.
- type self:
object
- rtype:
None
Notes
This function performs the following steps:
Unfreezes the circuit to allow changes.
Generates methods for calculating the derivatives of the Hamiltonian with respect to the different circuit parameters.
Generates methods for calculating the Tphi times due to 1/f noise for each branch in the circuit.
Generates methods for calculating the T1 times due to flux bias line noise for each branch in the circuit.
Generates methods for calculating the T1 times due to various noise sources for each branch in the circuit.
Generates methods for calculating the overall Tphi times due to charge coupling, flux, and ng noise for the entire circuit.
Generates methods for calculating the overall T1 times due to capacitive, charge impedance, inductive, flux bias line, and quasiparticle tunneling noise for the entire circuit.
Sets the _noise_methods_generated attribute to True.
Freezes the circuit again to prevent further changes.
The methods generated by this function are:
generate_methods_d_hamiltonian_d
generate_tphi_1_over_f_methods
generate_t1_flux_bias_line_methods
generate_t1_methods
generate_overall_tphi_cc
generate_overall_tphi_flux
generate_overall_tphi_ng
generate_overall_t1_capacitive
generate_overall_t1_charge_impedance
generate_overall_t1_inductive
generate_overall_t1_flux_bias_line
generate_overall_t1_quasiparticle_tunneling
This function does not return anything; it modifies the current instance by adding the noise calculation methods as attributes.
- generate_overall_t1_capacitive()¶
T1 Coherence Time Calculator due to Capacitive Noise¶
This function generates an overall method for calculating the T1 coherence time due to capacitive noise for the entire circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Returns:¶
: None
Description:¶
Checks if there are any existing methods for calculating T1 due to capacitive noise for any of the branches in the circuit. If not, it returns None.
If the checks pass, it defines a new method t1_method that calculates the overall T1 time due to capacitive noise.
This method iterates over all the branches in the circuit that are not inductors (indicated by “L” in the branch type), and for each branch, it calls the corresponding branch-specific T1 calculation method.
It then calculates the total rate of decoherence as the sum of the reciprocals of the T1 times for all the branches, and returns the reciprocal of the total rate (or the total rate itself if get_rate is True).
Finally, the function adds the t1_method method as an attribute of the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the T1 calculation methods as attributes.
- generate_overall_t1_charge_impedance()¶
T1 Coherence Time Calculation Due to Charge Impedance Noise¶
This function dynamically generates a method for calculating the T1 coherence time due to charge impedance noise for the entire quantum circuit.
- type self:
- param self:
The instance of the class where this method is being added.
- type self:
object
- rtype:
None
Notes
This function performs the following steps:
Checks if there are any existing methods for calculating T1 due to charge impedance noise for any of the branches in the circuit. If not, it returns None.
- Defines a new method t1_method that calculates the overall T1 time due to charge impedance noise. This method:
Iterates over all the branches in the circuit that are not inductors (indicated by “L” in the branch type).
For each branch, it calls the corresponding branch-specific T1 calculation method.
Calculates the total rate of decoherence as the sum of the reciprocals of the T1 times for all the branches.
Returns the reciprocal of the total rate (or the total rate itself if get_rate is True).
Adds the t1_method method as an attribute of the current instance.
This function does not return anything; it modifies the current instance by adding the T1 calculation method as an attribute.
- generate_overall_t1_flux_bias_line()¶
T1 Coherence Time Calculation Due to Flux Bias Line Noise¶
This function dynamically generates a method for calculating the T1 coherence time due to flux bias line noise for the entire quantum circuit.
- type self:
- param self:
The instance of the class where this method is being added.
- type self:
object
- rtype:
None
Notes
This function performs the following steps:
Checks if there are any existing methods for calculating T1 due to flux bias line noise for any of the branches in the circuit. If not, it returns None.
- Defines a new method t1_flux_bias_line that calculates the overall T1 time due to flux bias line noise. This method:
Iterates over all the external fluxes in the circuit.
For each flux, it calls the corresponding branch-specific T1 calculation method.
Calculates the total rate of decoherence as the sum of the reciprocals of the T1 times for all the fluxes.
Returns the reciprocal of the total rate (or the total rate itself if get_rate is True).
Adds the t1_flux_bias_line method as an attribute of the current instance.
This function does not return anything; it modifies the current instance by adding the T1 calculation method as an attribute.
- generate_overall_t1_inductive()¶
T1 Coherence Time Calculator due to Inductive Noise¶
This function generates an overall method for calculating the T1 coherence time due to inductive noise for the entire circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Returns:¶
: None
Description:¶
Checks if there are any existing methods for calculating T1 due to inductive noise for any of the branches in the circuit. If not, it returns None.
If the checks pass, it defines a new method t1_method that calculates the overall T1 time due to inductive noise.
This method iterates over all the branches in the circuit that are inductors (indicated by “L” in the branch type), and for each branch, it calls the corresponding branch-specific T1 calculation method.
It then calculates the total rate of decoherence as the sum of the reciprocals of the T1 times for all the branches, and returns the reciprocal of the total rate (or the total rate itself if get_rate is True).
Finally, the function adds the t1_method method as an attribute of the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the T1 calculation methods as attributes.
- generate_overall_t1_quasiparticle_tunneling()¶
T1 Coherence Time Calculator due to Quasiparticle Tunneling¶
This function generates an overall method for calculating the T1 coherence time due to quasiparticle tunneling for the entire circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Returns:¶
: None
Description:¶
Checks if there are any existing methods for calculating T1 due to quasiparticle tunneling for any of the branches in the circuit. If not, it returns None.
Checks if the circuit is purely harmonic, in which case it also returns None.
If the checks pass, it defines a new method t1_quasiparticle_tunneling that calculates the overall T1 time due to quasiparticle tunneling.
This method iterates over all the branches in the circuit that are Josephson junctions (indicated by “JJ” in the branch type), and for each branch, it calls the corresponding branch-specific T1 calculation method.
It then calculates the total rate of decoherence as the sum of the reciprocals of the T1 times for all the branches, and returns the reciprocal of the total rate (or the total rate itself if get_rate is True).
Finally, the function adds the t1_quasiparticle_tunneling method as an attribute of the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the T1 calculation methods as attributes.
- generate_overall_tphi_cc()¶
Overall Dephasing Time (Tphi) Calculator due to 1/f Critical Current (cc) Noise¶
This function calculates the overall dephasing time (Tphi) due to 1/f critical current (cc) noise in the quantum circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Steps:¶
Checks if there are any existing methods for calculating Tphi due to 1/f cc noise. This is done by searching the methods of the current instance for method names that match the pattern “tphi_1_over_f_ccd+$”. If such methods exist, the function returns None and does not generate a new method.
Defines a new method tphi_1_over_f_cc for calculating the overall Tphi due to 1/f cc noise. This method performs the following steps:
Initializes an empty list tphi_times to store the Tphi times for each junction branch in the circuit.
Iterates over the junction branches in the circuit. A junction branch is a branch that represents a Josephson junction (JJ).
Calls the method for calculating Tphi due to 1/f cc noise for the current junction branch. The method is an attribute of the current instance that is named “tphi_1_over_f_cc” followed by the ID string of the branch.
Appends the calculated Tphi time to the tphi_times list.
Calculates the total rate of dephasing by summing the reciprocals of the Tphi times.
If the get_rate parameter is True, returns the total rate of dephasing. Otherwise, returns the reciprocal of the total rate (the overall Tphi time), or infinity if the total rate is zero.
Adds the tphi_1_over_f_cc method as an attribute of the current instance. This is done using the setattr function and the MethodType class to bind the method to the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the tphi_1_over_f_cc method as an attribute.
- generate_overall_tphi_flux()¶
Overall Dephasing Time (Tphi) Calculator due to 1/f Flux Noise¶
This function calculates the overall dephasing time (Tphi) due to 1/f flux noise in the quantum circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Steps:¶
Checks if there are any existing methods for calculating Tphi due to 1/f flux noise. This is done by searching the methods of the current instance for method names that match the pattern “tphi_1_over_f_fluxd+$”. If such methods exist, the function returns None and does not generate a new method.
Defines a new method tphi_1_over_f_flux for calculating the overall Tphi due to 1/f flux noise. This method performs the following steps:
Initializes an empty list tphi_times to store the Tphi times for each external flux in the circuit.
Iterates over the external fluxes in the circuit.
Calls the method for calculating Tphi due to 1/f flux noise for the current external flux. The method is an attribute of the current instance that is named “tphi_1_over_f_flux” followed by the trailing number in the name of the flux.
Appends the calculated Tphi time to the tphi_times list.
Calculates the total rate of dephasing by summing the reciprocals of the Tphi times.
If the get_rate parameter is True, returns the total rate of dephasing. Otherwise, returns the reciprocal of the total rate (the overall Tphi time), or infinity if the total rate is zero.
Adds the tphi_1_over_f_flux method as an attribute of the current instance. This is done using the setattr function and the MethodType class to bind the method to the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the tphi_1_over_f_flux method as an attribute.
- generate_overall_tphi_ng()¶
Overall Dephasing Time (Tphi) Calculator due to 1/f Flux Noise¶
This function calculates the overall dephasing time (Tphi) due to 1/f flux noise in the quantum circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Steps:¶
Checks if there are any existing methods for calculating Tphi due to 1/f flux noise. This is done by searching the methods of the current instance for method names that match the pattern “tphi_1_over_f_fluxd+$”. If such methods exist, the function returns None and does not generate a new method.
Defines a new method tphi_1_over_f_flux for calculating the overall Tphi due to 1/f flux noise. This method performs the following steps:
Initializes an empty list tphi_times to store the Tphi times for each external flux in the circuit.
Iterates over the external fluxes in the circuit.
Calls the method for calculating Tphi due to 1/f flux noise for the current external flux. The method is an attribute of the current instance that is named “tphi_1_over_f_flux” followed by the trailing number in the name of the flux.
Appends the calculated Tphi time to the tphi_times list.
Calculates the total rate of dephasing by summing the reciprocals of the Tphi times.
If the get_rate parameter is True, returns the total rate of dephasing. Otherwise, returns the reciprocal of the total rate (the overall Tphi time), or infinity if the total rate is zero.
Adds the tphi_1_over_f_flux method as an attribute of the current instance. This is done using the setattr function and the MethodType class to bind the method to the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the tphi_1_over_f_flux method as an attribute.
- generate_subsystems(only_update_subsystems=False, subsys_dict=None)¶
Generates the subsystems (child instances of Circuit) depending on the attribute self.system_hierarchy
- Parameters:
only_update_subsystems (bool)
subsys_dict (Dict[str, Any] | None)
- generate_t1_flux_bias_line_methods()¶
T1 Coherence Time Calculator due to Flux Bias Line Noise¶
This function calculates the T1 coherence times due to flux bias line noise for each external flux in the quantum circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
Returns:¶
: None
Steps:¶
Initializes an empty dictionary flux_bias_line_methods to store the T1 calculation methods for each external flux.
Iterates over the external fluxes in the circuit.
Extracts the trailing number from the name of the current flux using the get_trailing_number function.
Retrieves the method for calculating the derivative of the Hamiltonian with respect to the current flux. This is done using the getattr function and the name of the method, which is “d_hamiltonian_d_flux” followed by the trailing number.
Defines a new method flux_bias_noise for calculating the T1 time due to flux bias line noise for the current flux. This method performs the following steps:
Calls the t1_flux_bias_line method of the NoisySystem class with the current instance, the state indices i and j, the noise parameters M, Z, and T, the total flag, the system eigenvalues and eigenvectors esys, the get_rate flag, and the noise operator method as arguments.
Returns the calculated T1 time.
Adds the flux_bias_noise method to the flux_bias_line_methods dictionary with a key that is “t1_flux_bias_line” followed by the trailing number.
Iterates over the keys in the flux_bias_line_methods dictionary.
Adds each method in the flux_bias_line_methods dictionary as an attribute of the current instance. This is done using the setattr function and the MethodType class to bind the method to the current instance.
Notes:¶
This function does not return anything; it modifies the current instance by adding the T1 calculation methods as attributes.
- generate_t1_methods()¶
Generates methods for calculating the T1 coherence times due to capacitive, inductive, and charge impedance noise for each branch in the circuit.
- Parameters:
self (object) – The instance of the class where this method is being added.
- Return type:
None
Notes
This function performs the following steps:
Initializes empty dictionaries t1_capacitive_methods, t1_inductive_methods, and t1_charge_impedance_methods to store the T1 calculation methods for each type of noise.
Iterates over the branches in the circuit.
Checks the type of the current branch.
If the branch type is “L”, adds a method for calculating the T1 time due to inductive noise to the t1_inductive_methods dictionary. The method is generated by calling the wrapper_t1_inductive_capacitive function with the current branch as an argument. The key for the method in the dictionary is “t1_inductive” followed by the ID string of the branch.
If the branch type is not “L”, adds a method for calculating the T1 time due to capacitive noise to the t1_capacitive_methods dictionary. The method is generated in the same way as for inductive noise.
Merges the t1_capacitive_methods, t1_inductive_methods, and t1_charge_impedance_methods dictionaries into a single noise_methods dictionary.
Iterates over the keys in the noise_methods dictionary.
Adds each method in the noise_methods dictionary as an attribute of the current instance. This is done using the setattr function and the MethodType class to bind the method to the current instance.
This function does not return anything; it modifies the current instance by adding the T1 calculation methods as attributes.
- generate_tphi_1_over_f_methods()¶
Generate Methods for 1/f Dephasing Time (or Rate) Calculations¶
This function is a dynamic method generator, crafting methods for calculating the 1/f dephasing time (or rate) due to different types of noise in the quantum circuit. The generated methods are named tphi_1_over_f_{noise_type}{index}, where noise_type can be ‘cc’, ‘ng’, or ‘flux’, and index differentiates individual noise sources.
- param None:
- external_fluxes¶
A collection of symbols representing external fluxes in the circuit.
- Type:
list
- offset_charges¶
A collection of symbols representing offset charges in the circuit.
- Type:
list
- branches¶
A collection of branches in the circuit.
- Type:
list
- rtype:
None
Notes
Identifies the branches in the circuit that are junctions (indicated by “JJ” in the branch type).
Initializes dictionaries to store the generated methods for each type of noise.
Iterates over the external fluxes, offset charges, and junction branches in the circuit.
Depending on the type of parameter (external flux, offset charge, or junction branch), it determines the type of noise and the function to differentiate the Hamiltonian with respect to the parameter.
If the parameter is an expression, it extracts the trailing number from the parameter name and uses it to get the appropriate differentiation function from the current instance.
If the parameter is a junction branch, it uses the branch’s ID string as the trailing number and gets the appropriate differentiation function from the current instance.
Defines a function tphi_1_over_f_func that calculates the 1/f dephasing time (or rate) for the current parameter. This function invokes the differentiation function to generate the noise operator, converts the noise operator to a sparse matrix if necessary, and then calls the tphi_1_over_f method of the current instance to calculate the 1/f dephasing time (or rate).
Adds the tphi_1_over_f_func function to the appropriate dictionary, depending on the type of parameter.
Merges the dictionaries into a single dictionary noise_methods.
Iterates over the noise_methods dictionary and adds each method as an attribute of the current instance.
This function does not return anything; it modifies the current instance by adding the 1/f dephasing time (or rate) calculation methods as attributes.
- 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 plotmode (
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 (
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 (
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 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_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 (
Union
[str
,ndarray
,Qobj
,spmatrix
]) – 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, 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 varspower (
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 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()¶
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 (
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)¶
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, ndarrayinstance – The subsystem to which the operator belongs
bare_esys (Dict[int, Tuple] | None)
- Return type:
Qobj
- Returns:
identity wrapped operator.
- is_subsystem(instance)¶
Returns true if the instance is a subsystem of self (regardless of the hierarchy)
Steps:¶
Retrieves the parent circuit and its symbolic Hamiltonian. The parent circuit is the circuit that contains the junction, and the symbolic Hamiltonian is a sympy expression that represents the Hamiltonian of the parent circuit in terms of symbolic variables.
Substitutes the offset charges and symbolic parameters of the parent circuit into the Hamiltonian. The offset charges and symbolic parameters are attributes of the parent circuit that represent physical quantities in the circuit.
Substitutes the imaginary unit ‘I’ with 1 in the Hamiltonian. This is done to simplify the Hamiltonian for the subsequent calculations.
Calculates an expression that represents the cosine of the phase difference across the junction. The phase difference is represented by the difference of the phases at the two nodes of the junction.
Transforms the cosine expression to new variables using the _transform_expr_to_new_variables method of the parent circuit. This method transforms the expression from the old variables (the phases at the nodes) to the new variables (the variables in the transformed Hamiltonian).
Finds the term in the Hamiltonian that matches the transformed cosine expression, ignoring any external fluxes. This is done by iterating over the terms in the Hamiltonian and comparing each term (with the external fluxes set to zero) to the transformed cosine expression.
Substitutes the external fluxes into the found term. The external fluxes are attributes of the parent circuit that represent physical quantities in the circuit.
If the ‘calc’ parameter is ‘sin_phi_qp’, replaces the cosine in the term with a sine and divides the argument of the sine by 2. This is done to calculate a different quantity that is related to the junction.
Evaluates the final term using the _evaluate_symbolic_expr method of the parent circuit. This method evaluates a sympy expression by substituting the actual values of the variables into the expression.
Parameters:¶
branch_junction (Branch): The junction for which to calculate the quantity. This should be a branch of the current instance’s circuit that represents a junction. calc (str, optional): The type of calculation to perform. If this is ‘sin_phi_qp’, the cosine in the term is replaced with a sine and the argument of the sine is divided by 2. This is used to calculate a different quantity that is related to the junction. Defaults to ‘dhdEJ’.
Returns:¶
: float: The evaluated quantity. This is a numerical value that represents the calculated quantity related to the junction.
Raises:¶
AttributeError: If the current instance or the parent circuit does not have the required methods or attributes.
- Parameters:
branch_junction (Branch)
- 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 (
Union
[str
,ndarray
,Qobj
,spmatrix
]) – name of class method in string form, returning operator matrix in qubit-internal basis.evecs (
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 (
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_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
]
- 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 variedparam_vals (
ndarray
) – parameter values to be plugged innoise_channels (
Union
[str
,List
[str
],List
[Tuple
[str
,Dict
]]]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Dict
) – common options used when calculating coherence timesspectrum_data (
SpectrumData
) – spectral data used during noise calculationsscale (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 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 (
Union
[str
,ndarray
,Qobj
,spmatrix
]) – 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 (
Union
[str
,ndarray
,Qobj
,spmatrix
]) – name of class method in string form, returning operator matrixevecs (
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 variedparam_vals (
ndarray
) – parameter values to be plugged innoise_channels (
Union
[str
,List
[str
],List
[Tuple
[str
,Dict
]]]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Dict
) – common options used when calculating coherence timesspectrum_data (
SpectrumData
) – spectral data used during noise calculationsget_rate (
bool
) – determines if rate or time should be plottedscale (
float
) – a number that all data is multiplied by before being plottednum_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 variedparam_vals (
ndarray
) – parameter values to be plugged innoise_channels (
Union
[str
,List
[str
],List
[Tuple
[str
,Dict
]]]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Dict
) – common options used when calculating coherence timesspectrum_data (
SpectrumData
) – spectral data used during noise calculationsget_rate (
bool
) – determines if rate or time should be plottedscale (
float
) – a number that all data is multiplied by before being plottednum_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 (
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 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)¶
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:
- 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_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 changedphi_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()¶
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)¶
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)¶
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)¶
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
]
- 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 operatorT (
float
) – Temperature defined in Kelvinspectral_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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_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
]) – capacitive quality factor; a fixed value or function of omegaT (
float
) – temperature in Kelvintotal (
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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_rate (
bool
) – get rate or timenoise_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 omegaT (
float
) – temperature in Kelvintotal (
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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_rate (
bool
) – get rate or timenoise_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
]]]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Dict
) – common options used when calculating coherence timesesys (
Tuple
[ndarray
,ndarray
]) – spectral data used during noise calculationsget_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 / AmpereZ (
Union
[complex
,float
,Callable
]) – A complex impedance; a fixed value or function of omegaT (
float
) – temperature in Kelvintotal (
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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_rate (
bool
) – get rate or timenoise_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
]) – inductive quality factor; a fixed value or function of omegaT (
float
) – temperature in Kelvintotal (
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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_rate (
bool
) – get rate or timenoise_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
]) – complex admittance; a fixed value or function of omegax_qp (
float
) – quasiparticle density (in units of eV)T (
float
) – temperature in KelvinDelta (
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 transitionsesys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_rate (
bool
) – get rate or timenoise_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 strengthi (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 parameteresys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_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 strengthi (int >=0) – state index that along with j defines a qubit
j (int >=0) – state index that along with i defines a qubit
esys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_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 strengthi (int >=0) – state index that along with j defines a qubit
j (int >=0) – state index that along with i defines a qubit
esys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_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 strengthi (int >=0) – state index that along with j defines a qubit
j (int >=0) – state index that along with i defines a qubit
esys (
Tuple
[ndarray
,ndarray
]) – evals, evecs tupleget_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
- transition_energy_derivative(ni, nf, esys, hamiltonian_derivative)¶
Returns the first order and second order derivative of the nth eigenenergy
- 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
- widget(params=None)¶
Use ipywidgets to modify parameters of class instance
- Parameters:
params (Dict[str, Any] | None)
- wrapper_t1_inductive_capacitive(branch)¶
T1 Coherence Time Calculator due to Inductive or Capacitive Noise¶
This function generates a method for calculating the T1 coherence time due to inductive or capacitive noise for a given branch in the quantum circuit.
Parameters:¶
- selfobject
The instance of the class where this method is being added.
- branchBranch
The branch of the circuit for which to calculate the T1 time.
Returns:¶
: function
The generated method for calculating the T1 time.
Steps:¶
Checks the type of the branch.
If the branch type is not “L”, generates a method for calculating the T1 time due to capacitive noise.
If the branch type is “L”, generates a method for calculating the T1 time due to inductive noise by calling the t1_inductive method.
Returns the generated method.
Notes:¶
This function does not modify the current instance; it returns a new method for calculating the T1 time.
- Parameters:
branch (Branch)