NoisyCircuit¶
- class scqubits.core.circuit_noise.NoisyCircuit[source]¶
This class represents a noisy quantum circuit, extending the
NoisySystemclass. 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.- noise_helper_methods¶
- Type:
A dictionary that stores the noise helper methods generated by
generate_methods_d_hamiltonian_d.
Notes
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.
This function is responsible for dynamically generating all the methods that calculate the different types of noise in the quantum circuit.
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.
- 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 (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_noise_methods()[source]¶
This function is responsible for dynamically generating all the methods that calculate the different types of noise in the quantum circuit.
- Parameters:
self (object) – The instance of the class where this method is being added.
- Returns:
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.
- 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
fluxbeing one of its parameters, one can see how coherence due to various noise channels vary as thefluxchanges: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]],None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Optional[Dict]) – common options used when calculating coherence timesspectrum_data (
Optional[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
fluxbeing one of its parameters, one can see how the effective \(T_1\) varies as thefluxchanges: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
fluxbeing one of its parameters, one can see how the effective \(T_2\) varies as thefluxchanges: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 (
Optional[Tuple[ndarray,ndarray]]) – evals, evecs tupleget_rate (
bool) – get rate or time
- Returns:
time or rate – decoherence time in units of \(2\pi\) (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,None]) – 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 (
Optional[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\) (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 (
Optional[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\) (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]],None]) – channels to be plotted, if None then noise channels given by supported_noise_channels are usedcommon_noise_options (
Optional[Dict]) – common options used when calculating coherence timesesys (
Optional[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\) (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 (
Optional[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\) (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 (
Optional[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\) (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,None]) – 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 (
Optional[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\) (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\) (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 (
Optional[Tuple[ndarray,ndarray]]) – evals, evecs tupleget_rate (
bool) – get rate or time
- Returns:
time or rate – decoherence time in units of \(2\pi\) (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 (
Optional[Tuple[ndarray,ndarray]]) – evals, evecs tupleget_rate (
bool) – get rate or time
- Returns:
time or rate – decoherence time in units of \(2\pi\) (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 (
Optional[Tuple[ndarray,ndarray]]) – evals, evecs tupleget_rate (
bool) – get rate or time
- Returns:
time or rate – decoherence time in units of \(2\pi\) (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 (
Optional[Tuple[ndarray,ndarray]]) – evals, evecs tupleget_rate (
bool) – get rate or time
- Returns:
time or rate – decoherence time in units of \(2\pi\) (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.