NoisyCircuit¶
- class scqubits.core.circuit_noise.NoisyCircuit[source]¶
Noisy Quantum Circuit Class¶
This class represents a noisy quantum circuit, extending the NoisySystem class. It provides a suite of methods for generating and evaluating expressions related to the Hamiltonian and its derivatives, as well as calculating the 1/f dephasing time or rate due to various noise sources.
Attributes:¶
noise_helper_methods (dict): A dictionary that stores the noise helper methods generated by generate_methods_d_hamiltonian_d().
Methods:¶
Q_from_branch(branch): A static method that retrieves the Q factor function or value associated with a given branch.
generate_methods_d_hamiltonian_d(): Generates methods for calculating the derivative of the Hamiltonian with respect to offset charges, external fluxes, and junction energies.
_transform_expr_to_new_variables(expr_node_vars, substitute_symbol=None): Transforms the given expression node variables to new variables using the transformation matrix.
junction_related_evaluation(branch_junction, calc=”dhdEJ”): Evaluates the expression related to a junction branch and returns the result.
generate_tphi_1_over_f_methods(): Generates methods for calculating the 1/f dephasing time or rate due to different noise sources.
Note:¶
This class is designed to be subclassed and extended with specific noise models for different types of quantum circuits.
Methods
NoisyCircuit.Q_from_branch(branch)Extracts the Quality Factor 'Q' from a Given Branch
NoisyCircuit.__init__()Return a list of noise channels that are used when calculating the effective noise (i.e. via t1_effective and t2_effective.
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
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
Junction-Related Quantity Evaluator
Show plots of coherence for various channels supported by the qubit as they vary as a function of a changing parameter.
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.
NoisyCircuit.set_and_return(attr_name, value)NoisyCircuit.supported_noise_channels()NoisyCircuit.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.
NoisyCircuit.t1_capacitive([i, j, Q_cap, T, ...])\(T_1\) due to dielectric dissipation in the Josephson junction capacitances.
NoisyCircuit.t1_charge_impedance([i, j, Z, ...])Noise due to charge coupling to an impedance (such as a transmission line).
NoisyCircuit.t1_effective([noise_channels, ...])Calculate the effective \(T_1\) time (or rate).
NoisyCircuit.t1_flux_bias_line([i, j, M, Z, ...])Noise due to a bias flux line.
NoisyCircuit.t1_inductive([i, j, Q_ind, T, ...])\(T_1\) due to inductive dissipation in a superinductor.
NoisyCircuit.t1_quasiparticle_tunneling([i, ...])Noise due to quasiparticle tunneling across a Josephson junction.
NoisyCircuit.t2_effective([noise_channels, ...])Calculate the effective \(T_2\) time (or rate).
NoisyCircuit.tphi_1_over_f(A_noise, i, j, ...)Calculate the 1/f dephasing time (or rate) due to arbitrary noise source.
NoisyCircuit.tphi_1_over_f_cc([A_noise, i, ...])Calculate the 1/f dephasing time (or rate) due to critical current noise.
NoisyCircuit.tphi_1_over_f_flux([A_noise, ...])Calculate the 1/f dephasing time (or rate) due to flux noise.
NoisyCircuit.tphi_1_over_f_ng([A_noise, i, ...])Calculate the 1/f dephasing time (or rate) due to charge noise.
Returns the first order and second order derivative of the nth eigenenergy
NoisyCircuit.wrapper_t1_charge_impedance(branch)T1 Coherence Time Calculator due to Inductive or Capacitive Noise
NoisyCircuit.wrapper_t1_quasiparticle_tunneling(branch)- static Q_from_branch(branch)[source]¶
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’.
- 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]
- generate_methods_d_hamiltonian_d()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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()[source]¶
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_t1_flux_bias_line_methods()[source]¶
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()[source]¶
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()[source]¶
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.
-
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)
- 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_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
- 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
- wrapper_t1_inductive_capacitive(branch)[source]¶
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)