Qubit Classes

Transmon

class scqubits.Transmon(EJ, EC, ng, ncut, truncated_dim=None)[source]

Class for the Cooper-pair-box and transmon qubit. The Hamiltonian is represented in dense form in the number basis, \(H_\text{CPB}=4E_\text{C}(\hat{n}-n_g)^2+\frac{E_\text{J}}{2}(|n\rangle\langle n+1|+\text{h.c.})\). Initialize with, for example:

Transmon(EJ=1.0, EC=2.0, ng=0.2, ncut=30)
Parameters
  • EJ (float) – Josephson energy

  • EC (float) – charging energy

  • ng (float) – offset charge

  • ncut (int) – charge basis cutoff, n = -ncut, …, ncut

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

cos_phi_operator()[source]

Returns operator \(\cos \varphi\) in the charge basis

classmethod create()

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to EJ.

d_hamiltonian_d_ng()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to charge offset ng.

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

effective_noise_channels()[source]

Return a default list of channels used when calculating effective t1 and t2 nosie.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

exp_i_phi_operator()[source]

Returns operator \(e^{i\varphi}\) in the charge basis

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian()[source]

Returns Hamiltonian in charge basis

hilbertdim()[source]

Returns Hilbert space dimension

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_operator()[source]

Returns charge operator n in the charge basis

numberbasis_wavefunction(esys=None, which=0)[source]

Return the transmon wave function in number basis. The specific index of the wave function to be returned is which.

Parameters
  • esys (ndarray, ndarray, optional) – if None, the eigensystem is calculated on the fly; otherwise, the provided eigenvalue, eigenvector arrays as obtained from .eigensystem(), are used (default value = None)

  • which (int, optional) – eigenfunction index (default value = 0)

Returns

Return type

WaveFunction object

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_n_wavefunction(esys=None, mode='real', which=0, nrange=None, **kwargs)[source]

Plots transmon wave function in charge basis

Parameters
  • esys (tuple(ndarray, ndarray), optional) – eigenvalues, eigenvectors

  • mode (str from MODE_FUNC_DICT, optional) – ‘abs_sqr’, ‘abs’, ‘real’, ‘imag’

  • which (int or tuple of ints, optional) – index or indices of wave functions to plot (default value = 0)

  • nrange (tuple of two ints, optional) – range of n to be included on the x-axis (default value = (-5,6))

  • **kwargs – plotting parameters

Returns

Return type

Figure, Axes

plot_phi_wavefunction(esys=None, which=0, phi_grid=None, mode='abs_sqr', scaling=None, **kwargs)[source]

Alias for plot_wavefunction

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_wavefunction(which=0, mode='real', esys=None, phi_grid=None, scaling=None, **kwargs)

Plot 1d phase-basis wave function(s). Must be overwritten by higher-dimensional qubits like FluxQubits and ZeroPi.

Parameters
  • esys ((ndarray, ndarray), optional) – eigenvalues, eigenvectors

  • which (int or tuple or list, optional) – single index or tuple/list of integers indexing the wave function(s) to be plotted. If which is -1, all wavefunctions up to the truncation limit are plotted.

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

  • mode (str, optional) – choices as specified in constants.MODE_FUNC_DICT (default value = ‘abs_sqr’)

  • scaling (float or None, optional) – custom scaling of wave function amplitude/modulus

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

potential(phi)[source]

Transmon phase-basis potential evaluated at phi.

Parameters

phi (float) – phase variable value

Returns

Return type

float

receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

sin_phi_operator()[source]

Returns operator \(\sin \varphi\) in the charge basis

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

wavefunction(esys=None, which=0, phi_grid=None)[source]

Return the transmon wave function in phase basis. The specific index of the wavefunction is which. esys can be provided, but if set to None then it is calculated on the fly.

Parameters
  • esys (tuple(ndarray, ndarray), optional) – if None, the eigensystem is calculated on the fly; otherwise, the provided eigenvalue, eigenvector arrays as obtained from .eigensystem() are used

  • which (int, optional) – eigenfunction index (default value = 0)

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

Returns

Return type

WaveFunction object

wavefunction1d_defaults(mode, evals, wavefunc_count)[source]

Plot defaults for plotting.wavefunction1d.

Parameters
  • mode (str) – amplitude modifier, needed to give the correct default y label

  • evals (ndarray) – eigenvalues to include in plot

  • wavefunc_count (int) –

widget(params=None)

Use ipywidgets to modify parameters of class instance


TunableTransmon

class scqubits.TunableTransmon(EJmax, EC, d, flux, ng, ncut, truncated_dim=None)[source]

Class for the flux-tunable transmon qubit. The Hamiltonian is represented in dense form in the number basis, \(H_\text{CPB}=4E_\text{C}(\hat{n}-n_g)^2+\frac{\mathcal{E}_\text{J}(\Phi)}{2}(|n\rangle\langle n+1|+\text{h.c.})\), Here, the effective Josephson energy is flux-tunable: \(\mathcal{E}_J(\Phi) = E_{J,\text{max}} \sqrt{\cos^2(\pi\Phi/\Phi_0) + d^2 \sin^2(\pi\Phi/\Phi_0)}\) and \(d=(E_{J2}-E_{J1})(E_{J1}+E_{J2})\) parametrizes th junction asymmetry.

Initialize with, for example:

TunableTransmon(EJmax=1.0, d=0.1, EC=2.0, flux=0.3, ng=0.2, ncut=30)
Parameters
  • EJmax (float) – maximum effective Josephson energy (sum of the Josephson energies of the two junctions)

  • d (float) – junction asymmetry parameter

  • EC (float) – charging energy

  • flux (float) – flux threading the SQUID loop, in units of the flux quantum

  • ng (float) – offset charge

  • ncut (int) – charge basis cutoff, n = -ncut, …, ncut

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

property EJ

This is the effective, flux dependent Josephson energy, playing the role of EJ in the parent class Transmon

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

cos_phi_operator()

Returns operator \(\cos \varphi\) in the charge basis

classmethod create()

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ()

Returns operator representing a derivittive of the Hamiltonian with respect to EJ.

d_hamiltonian_d_flux()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to flux.

d_hamiltonian_d_ng()

Returns operator representing a derivittive of the Hamiltonian with respect to charge offset ng.

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

effective_noise_channels()

Return a default list of channels used when calculating effective t1 and t2 nosie.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

exp_i_phi_operator()

Returns operator \(e^{i\varphi}\) in the charge basis

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian()

Returns Hamiltonian in charge basis

hilbertdim()

Returns Hilbert space dimension

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_operator()

Returns charge operator n in the charge basis

numberbasis_wavefunction(esys=None, which=0)

Return the transmon wave function in number basis. The specific index of the wave function to be returned is which.

Parameters
  • esys (ndarray, ndarray, optional) – if None, the eigensystem is calculated on the fly; otherwise, the provided eigenvalue, eigenvector arrays as obtained from .eigensystem(), are used (default value = None)

  • which (int, optional) – eigenfunction index (default value = 0)

Returns

Return type

WaveFunction object

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_n_wavefunction(esys=None, mode='real', which=0, nrange=None, **kwargs)

Plots transmon wave function in charge basis

Parameters
  • esys (tuple(ndarray, ndarray), optional) – eigenvalues, eigenvectors

  • mode (str from MODE_FUNC_DICT, optional) – ‘abs_sqr’, ‘abs’, ‘real’, ‘imag’

  • which (int or tuple of ints, optional) – index or indices of wave functions to plot (default value = 0)

  • nrange (tuple of two ints, optional) – range of n to be included on the x-axis (default value = (-5,6))

  • **kwargs – plotting parameters

Returns

Return type

Figure, Axes

plot_phi_wavefunction(esys=None, which=0, phi_grid=None, mode='abs_sqr', scaling=None, **kwargs)

Alias for plot_wavefunction

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_wavefunction(which=0, mode='real', esys=None, phi_grid=None, scaling=None, **kwargs)

Plot 1d phase-basis wave function(s). Must be overwritten by higher-dimensional qubits like FluxQubits and ZeroPi.

Parameters
  • esys ((ndarray, ndarray), optional) – eigenvalues, eigenvectors

  • which (int or tuple or list, optional) – single index or tuple/list of integers indexing the wave function(s) to be plotted. If which is -1, all wavefunctions up to the truncation limit are plotted.

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

  • mode (str, optional) – choices as specified in constants.MODE_FUNC_DICT (default value = ‘abs_sqr’)

  • scaling (float or None, optional) – custom scaling of wave function amplitude/modulus

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

potential(phi)

Transmon phase-basis potential evaluated at phi.

Parameters

phi (float) – phase variable value

Returns

Return type

float

receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

sin_phi_operator()

Returns operator \(\sin \varphi\) in the charge basis

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

wavefunction(esys=None, which=0, phi_grid=None)

Return the transmon wave function in phase basis. The specific index of the wavefunction is which. esys can be provided, but if set to None then it is calculated on the fly.

Parameters
  • esys (tuple(ndarray, ndarray), optional) – if None, the eigensystem is calculated on the fly; otherwise, the provided eigenvalue, eigenvector arrays as obtained from .eigensystem() are used

  • which (int, optional) – eigenfunction index (default value = 0)

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

Returns

Return type

WaveFunction object

wavefunction1d_defaults(mode, evals, wavefunc_count)

Plot defaults for plotting.wavefunction1d.

Parameters
  • mode (str) – amplitude modifier, needed to give the correct default y label

  • evals (ndarray) – eigenvalues to include in plot

  • wavefunc_count (int) –

widget(params=None)

Use ipywidgets to modify parameters of class instance


Fluxonium

class scqubits.Fluxonium(EJ, EC, EL, flux, cutoff, truncated_dim=None)[source]

Class for the fluxonium qubit. Hamiltonian \(H_\text{fl}=-4E_\text{C}\partial_\phi^2-E_\text{J}\cos(\phi+\varphi_\text{ext}) +\frac{1}{2}E_L\phi^2\) is represented in dense form. The employed basis is the EC-EL harmonic oscillator basis. The cosine term in the potential is handled via matrix exponentiation. Initialize with, for example:

qubit = Fluxonium(EJ=1.0, EC=2.0, EL=0.3, flux=0.2, cutoff=120)
Parameters
  • EJ (float) – Josephson energy

  • EC (float) – charging energy

  • EL (float) – inductive energy

  • flux (float) – external magnetic flux in angular units, 2pi corresponds to one flux quantum

  • cutoff (int) – number of harm. osc. basis states used in diagonalization

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

E_plasma()[source]
Returns

Returns the plasma oscillation frequency.

Return type

float

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

cos_phi_operator(alpha=1, beta=0)[source]
Returns

Returns the \(\cos (\alpha \phi + \beta)\) operator in the LC harmonic oscillator basis, with \(\alpha\) and \(\beta\) being numbers

Return type

ndarray

classmethod create()

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to EJ.

The flux is grouped as in the Hamiltonian.

d_hamiltonian_d_flux()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to flux.

Flux is grouped as in the Hamiltonian.

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

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.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

exp_i_phi_operator(alpha=1, beta=0)[source]
Returns

Returns the \(e^{i (\alpha \phi + eta) }\) operator in the LC harmonic oscillator basis, with \(\alpha\) and \(\beta\) being numbers

Return type

ndarray

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian()[source]

Construct Hamiltonian matrix in harmonic-oscillator basis, following Zhu et al., PRB 87, 024510 (2013)

Returns

Return type

ndarray

hilbertdim()[source]
Returns

Returns the Hilbert space dimension.

Return type

int

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_operator()[source]
Returns

Returns the \(n = - i d/d\phi\) operator in the LC harmonic oscillator basis

Return type

ndarray

phi_operator()[source]
Returns

Returns the phi operator in the LC harmonic oscillator basis

Return type

ndarray

phi_osc()[source]
Returns

Returns oscillator length for the LC oscillator composed of the fluxonium inductance and capacitance.

Return type

float

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_wavefunction(which=0, mode='real', esys=None, phi_grid=None, scaling=None, **kwargs)

Plot 1d phase-basis wave function(s). Must be overwritten by higher-dimensional qubits like FluxQubits and ZeroPi.

Parameters
  • esys ((ndarray, ndarray), optional) – eigenvalues, eigenvectors

  • which (int or tuple or list, optional) – single index or tuple/list of integers indexing the wave function(s) to be plotted. If which is -1, all wavefunctions up to the truncation limit are plotted.

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

  • mode (str, optional) – choices as specified in constants.MODE_FUNC_DICT (default value = ‘abs_sqr’)

  • scaling (float or None, optional) – custom scaling of wave function amplitude/modulus

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

potential(phi)[source]

Fluxonium potential evaluated at phi.

Parameters

phi (float or ndarray) – float value of the phase variable phi

Returns

Return type

float or ndarray

receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

sin_phi_operator(alpha=1, beta=0)[source]
Returns

Returns the \(\sin (\alpha \phi + \beta)\) operator in the LC harmonic oscillator basis with \(\alpha\) and \(\beta\) being numbers

Return type

ndarray

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

wavefunction(esys, which=0, phi_grid=None)[source]

Returns a fluxonium wave function in phi basis

Parameters
  • esys (ndarray, ndarray) – eigenvalues, eigenvectors

  • which (int, optional) – index of desired wave function (default value = 0)

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

Returns

Return type

WaveFunction object

wavefunction1d_defaults(mode, evals, wavefunc_count)[source]

Plot defaults for plotting.wavefunction1d.

Parameters
  • mode (str) – amplitude modifier, needed to give the correct default y label

  • evals (ndarray) – eigenvalues to include in plot

  • wavefunc_count (int) – number of wave functions to be plotted

widget(params=None)

Use ipywidgets to modify parameters of class instance


FluxQubit

class scqubits.FluxQubit(EJ1, EJ2, EJ3, ECJ1, ECJ2, ECJ3, ECg1, ECg2, ng1, ng2, flux, ncut, truncated_dim=None)[source]

Flux Qubit

[1] Orlando et al., Physical Review B, 60, 15398 (1999). https://link.aps.org/doi/10.1103/PhysRevB.60.15398

The original flux qubit as defined in [1], where the junctions are allowed to have varying junction energies and capacitances to allow for junction asymmetry. Typically, one takes \(E_{J1}=E_{J2}=E_J\), and \(E_{J3}=\alpha E_J\) where \(0\le \alpha \le 1\). The same relations typically hold for the junction capacitances. The Hamiltonian is given by

\[\begin{split}H_\text{flux}=&(n_{i}-n_{gi})4(E_\text{C})_{ij}(n_{j}-n_{gj}) \\ -&E_{J}\cos\phi_{1}-E_{J}\cos\phi_{2}-\alpha E_{J}\cos(2\pi f + \phi_{1} - \phi_{2}),\end{split}\]

where \(i,j\in\{1,2\}\) is represented in the charge basis for both degrees of freedom. Initialize with, for example:

EJ = 35.0
alpha = 0.6
flux_qubit = scq.FluxQubit(EJ1 = EJ, EJ2 = EJ, EJ3 = alpha*EJ,
                             ECJ1 = 1.0, ECJ2 = 1.0, ECJ3 = 1.0/alpha,
                             ECg1 = 50.0, ECg2 = 50.0, ng1 = 0.0, ng2 = 0.0,
                             flux = 0.5, ncut = 10)
Parameters
  • EJ2, EJ3 (EJ1,) – Josephson energy of the ith junction EJ1 = EJ2, with EJ3 = alpha * EJ1 and alpha <= 1

  • ECJ2, ECJ3 (ECJ1,) – charging energy associated with the ith junction

  • ECg2 (ECg1,) – charging energy associated with the capacitive coupling to ground for the two islands

  • ng2 (ng1,) – offset charge associated with island i

  • flux (float) – magnetic flux through the circuit loop, measured in units of the flux quantum

  • ncut (int) – charge number cutoff for the charge on both islands n, n = -ncut, …, ncut

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

EC_matrix()[source]

Return the charging energy matrix

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

cos_phi_1_operator()[source]

Return operator \(\cos \phi_1\) in the charge basis

cos_phi_2_operator()[source]

Return operator \(\cos \phi_2\) in the charge basis

classmethod create()

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ1()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to EJ1.

d_hamiltonian_d_EJ2()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to EJ2.

d_hamiltonian_d_EJ3()[source]

Returns operator representing a derivittive of the Hamiltonian with respect to EJ3.

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

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.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

exp_i_phi_1_operator()[source]

Return operator \(e^{i\phi_1}\) in the charge basis.

exp_i_phi_2_operator()[source]

Return operator \(e^{i\phi_2}\) in the charge basis.

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian()[source]

Return Hamiltonian in basis obtained by employing charge basis for both degrees of freedom

hilbertdim()[source]

Return Hilbert space dimension.

kineticmat()[source]

Return the kinetic energy matrix.

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_1_operator()[source]

Return charge number operator conjugate to \(\phi_1\)

n_2_operator()[source]

Return charge number operator conjugate to \(\phi_2\)

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_potential(phi_grid=None, contour_vals=None, **kwargs)[source]

Draw contour plot of the potential energy.

Parameters
  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

  • contour_vals (list of float, optional) – specific contours to draw

  • **kwargs – plot options

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_wavefunction(esys=None, which=0, phi_grid=None, mode='abs', zero_calibrate=True, **kwargs)[source]

Plots 2d phase-basis wave function.

Parameters
  • esys (ndarray, ndarray) – eigenvalues, eigenvectors as obtained from .eigensystem()

  • which (int, optional) – index of wave function to be plotted (default value = (0)

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

  • mode (str, optional) – choices as specified in constants.MODE_FUNC_DICT (default value = ‘abs_sqr’)

  • zero_calibrate (bool, optional) – if True, colors are adjusted to use zero wavefunction amplitude as the neutral color in the palette

  • **kwargs – plot options

Returns

Return type

Figure, Axes

potential(phi1, phi2)[source]

Return value of the potential energy at phi1 and phi2, disregarding constants.

potentialmat()[source]

Return the potential energy matrix for the potential.

receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

sin_phi_1_operator()[source]

Return operator \(\sin \phi_1\) in the charge basis

sin_phi_2_operator()[source]

Return operator \(\sin \phi_2\) in the charge basis

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 from all three Josephson junctions \(EJ1\), \(EJ2\) and \(EJ3\). The combined noise is calculated by summing the rates from the individual contributions.

Parameters
  • A_noise (float) – noise strength

  • i (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 tuple

  • 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_cc1(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 of junction associated with Josephson energy \(EJ1\).

Parameters
  • A_noise (float) – noise strength

  • i (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 tuple

  • 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_cc2(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 of junction associated with Josephson energy \(EJ2\).

Parameters
  • A_noise (float) – noise strength

  • i (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 tuple

  • get_rate (bool) – get rate or time

Returns

:math:`T_{phi}` 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_cc3(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 of junction associated with Josephson energy \(EJ3\).

Parameters
  • A_noise (float) – noise strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

wavefunction(esys=None, which=0, phi_grid=None)[source]

Return a flux qubit wave function in phi1, phi2 basis

Parameters
  • esys (ndarray, ndarray) – eigenvalues, eigenvectors

  • which (int, optional) – index of desired wave function (default value = 0)

  • phi_grid (Grid1d, optional) – used for setting a custom grid for phi; if None use self._default_grid

Returns

Return type

WaveFunctionOnGrid object

widget(params=None)

Use ipywidgets to modify parameters of class instance


ZeroPi

class scqubits.ZeroPi(EJ, EL, ECJ, EC, ng, flux, grid, ncut, dEJ=0, dCJ=0, ECS=None, truncated_dim=None)[source]

Zero-Pi Qubit

[1] Brooks et al., Physical Review A, 87(5), 052306 (2013). http://doi.org/10.1103/PhysRevA.87.052306
[2] Dempster et al., Phys. Rev. B, 90, 094518 (2014). http://doi.org/10.1103/PhysRevB.90.094518
[3] Groszkowski et al., New J. Phys. 20, 043053 (2018). https://doi.org/10.1088/1367-2630/aab7cd

Zero-Pi qubit without coupling to the zeta mode, i.e., no disorder in EC and EL, see Eq. (4) in Groszkowski et al., New J. Phys. 20, 043053 (2018),

\[\begin{split}H &= -2E_\text{CJ}\partial_\phi^2+2E_{\text{C}\Sigma}(i\partial_\theta-n_g)^2 +2E_{C\Sigma}dC_J\,\partial_\phi\partial_\theta -2E_\text{J}\cos\theta\cos(\phi-\varphi_\text{ext}/2)+E_L\phi^2\\ &\qquad +2E_\text{J} + E_J dE_J \sin\theta\sin(\phi-\phi_\text{ext}/2).\end{split}\]

Formulation of the Hamiltonian matrix proceeds by discretization of the phi variable, and using charge basis for the theta variable.

Parameters
  • EJ (float) – mean Josephson energy of the two junctions

  • EL (float) – inductive energy of the two (super-)inductors

  • ECJ (float) – charging energy associated with the two junctions

  • EC (float or None) – charging energy of the large shunting capacitances; set to None if ECS is provided instead

  • dEJ (float) – relative disorder in EJ, i.e., (EJ1-EJ2)/EJavg

  • dCJ (float) – relative disorder of the junction capacitances, i.e., (CJ1-CJ2)/CJavg

  • ng (float) – offset charge associated with theta

  • flux (float) – magnetic flux through the circuit loop, measured in units of flux quanta (h/2e)

  • grid (Grid1d object) – specifies the range and spacing of the discretization lattice

  • ncut (int) – charge number cutoff for n_theta, n_theta = -ncut, …, ncut

  • ECS (float, optional) – total charging energy including large shunting capacitances and junction capacitances; may be provided instead of EC

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

cos_theta_operator()[source]

Operator \(\cos(\theta)\).

Returns

Return type

scipy.sparse.csc_matrix

classmethod create()[source]

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ()[source]

Calculates a derivative of the Hamiltonian w.r.t EJ. for calcu

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

d_hamiltonian_d_flux()[source]

Calculates a derivative of the Hamiltonian w.r.t flux, at the current value of flux, as stored in the object.

The flux is assumed to be given in the units of the ratio Phi_{ext}/Phi_0. So if frac{partial H}{ partial Phi_{rm ext}}, is needed, the expression returned by this function, needs to be multiplied by 1/Phi_0.

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

d_hamiltonian_d_ng()[source]

Calculates a derivative of the Hamiltonian w.r.t ng. as stored in the object.

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

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.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian()[source]

Calculates Hamiltonian in basis obtained by discretizing phi and employing charge basis for theta.

Returns

matrix representing the potential energy operator

Return type

scipy.sparse.csc_matrix

hilbertdim()[source]

Returns Hilbert space dimension

i_d_dphi_operator()[source]

Operator \(i d/d\phi\).

Returns

Return type

scipy.sparse.csc_matrix

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_theta_operator()[source]

Operator \(n_\theta\).

Returns

Return type

scipy.sparse.csc_matrix

phi_operator()[source]

Operator \(\phi\).

Returns

Return type

scipy.sparse.csc_matrix

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_potential(theta_grid=None, contour_vals=None, **kwargs)[source]

Draw contour plot of the potential energy.

Parameters
  • theta_grid (Grid1d, optional) – used for setting a custom grid for theta; if None use self._default_grid

  • contour_vals (list, optional) –

  • **kwargs – plotting parameters

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_wavefunction(esys=None, which=0, theta_grid=None, mode='abs', zero_calibrate=True, **kwargs)[source]

Plots 2d phase-basis wave function.

Parameters
  • esys (ndarray, ndarray) – eigenvalues, eigenvectors as obtained from .eigensystem()

  • which (int, optional) – index of wave function to be plotted (default value = (0)

  • theta_grid (Grid1d, optional) – used for setting a custom grid for theta; if None use self._default_grid

  • mode (str, optional) – choices as specified in constants.MODE_FUNC_DICT (default value = ‘abs_sqr’)

  • zero_calibrate (bool, optional) – if True, colors are adjusted to use zero wavefunction amplitude as the neutral color in the palette

  • **kwargs – plot options

Returns

Return type

Figure, Axes

potential(phi, theta)[source]
Parameters
  • phi (float) –

  • theta (float) –

Returns

value of the potential energy evaluated at phi, theta

Return type

float

receive(event, sender, **kwargs)[source]

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

set_EC_via_ECS(ECS)[source]

Helper function to set EC by providing ECS, keeping ECJ constant.

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)[source]

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

sin_theta_operator()[source]

Operator \(\sin(\theta)\).

Returns

Return type

scipy.sparse.csc_matrix

sparse_d_potential_d_EJ_mat()[source]

Calculates a of the potential energy w.r.t EJ.

Returns

matrix representing the derivative of the potential energy

Return type

scipy.sparse.csc_matrix

sparse_d_potential_d_flux_mat()[source]

Calculates a of the potential energy w.r.t flux, at the current value of flux, as stored in the object.

The flux is assumed to be given in the units of the ratio Phi_{ext}/Phi_0. So if frac{partial U}{ partial Phi_{rm ext}}, is needed, the expression returned by this function, needs to be multiplied by 1/Phi_0.

Returns

matrix representing the derivative of the potential energy

Return type

scipy.sparse.csc_matrix

sparse_kinetic_mat()[source]

Kinetic energy portion of the Hamiltonian.

Returns

matrix representing the kinetic energy operator

Return type

scipy.sparse.csc_matrix

sparse_potential_mat()[source]

Potential energy portion of the Hamiltonian.

Returns

matrix representing the potential energy operator

Return type

scipy.sparse.csc_matrix

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

wavefunction(esys=None, which=0, theta_grid=None)[source]

Returns a zero-pi wave function in phi, theta basis

Parameters
  • esys (ndarray, ndarray) – eigenvalues, eigenvectors

  • which (int, optional) – index of desired wave function (default value = 0)

  • theta_grid (Grid1d, optional) – used for setting a custom grid for theta; if None use self._default_grid

Returns

Return type

WaveFunctionOnGrid object

widget(params=None)[source]

Use ipywidgets to modify parameters of class instance


FullZeroPi

class scqubits.FullZeroPi(EJ, EL, ECJ, EC, dEJ, dCJ, dC, dEL, flux, ng, zeropi_cutoff, zeta_cutoff, grid, ncut, ECS=None, truncated_dim=None)[source]

Zero-Pi qubit [Brooks2013] [Dempster2014] including coupling to the zeta mode. The circuit is described by the Hamiltonian \(H = H_{0-\pi} + H_\text{int} + H_\zeta\), where

\[\begin{split}&H_{0-\pi} = -2E_\text{CJ}\partial_\phi^2+2E_{\text{C}\Sigma}(i\partial_\theta-n_g)^2 +2E_{C\Sigma}dC_J\,\partial_\phi\partial_\theta\\ &\qquad\qquad\qquad+2E_{C\Sigma}(\delta C_J/C_J)\partial_\phi\partial_\theta +2\,\delta E_J \sin\theta\sin(\phi-\varphi_\text{ext}/2)\\ &H_\text{int} = 2E_{C\Sigma}dC\,\partial_\theta\partial_\zeta + E_L dE_L \phi\,\zeta\\ &H_\zeta = E_{\zeta} a^\dagger a\end{split}\]

expressed in phase basis. The definition of the relevant charging energies \(E_\text{CJ}\), \(E_{\text{C}\Sigma}\), Josephson energies \(E_\text{J}\), inductive energies \(E_\text{L}\), and relative amounts of disorder \(dC_\text{J}\), \(dE_\text{J}\), \(dC\), \(dE_\text{L}\) follows [Groszkowski2018]. Internally, the FullZeroPi class formulates the Hamiltonian matrix via the product basis of the decoupled Zero-Pi qubit (see ZeroPi) on one hand, and the zeta LC oscillator on the other hand.

Parameters
  • EJ (float) – mean Josephson energy of the two junctions

  • EL (float) – inductive energy of the two (super-)inductors

  • ECJ (float) – charging energy associated with the two junctions

  • EC (float or None) – charging energy of the large shunting capacitances; set to None if ECS is provided instead

  • dEJ (float) – relative disorder in EJ, i.e., (EJ1-EJ2)/EJavg

  • dEL (float) – relative disorder in EL, i.e., (EL1-EL2)/ELavg

  • dCJ (float) – relative disorder of the junction capacitances, i.e., (CJ1-CJ2)/CJavg

  • dC (float) – relative disorder in large capacitances, i.e., (C1-C2)/Cavg

  • ng (float) – offset charge associated with theta

  • zeropi_cutoff (int) – cutoff in the number of states of the disordered zero-pi qubit

  • zeta_cutoff (int) – cutoff in the zeta oscillator basis (Fock state basis)

  • flux (float) – magnetic flux through the circuit loop, measured in units of flux quanta (h/2e)

  • grid (Grid1d object) – specifies the range and spacing of the discretization lattice

  • ncut (int) – charge number cutoff for n_theta, n_theta = -ncut, …, ncut

  • ECS (float, optional) – total charging energy including large shunting capacitances and junction capacitances; may be provided instead of EC

  • truncated_dim (int, optional) – desired dimension of the truncated quantum system; expected: truncated_dim > 1

property E_zeta

Returns energy quantum of the zeta mode

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

classmethod create()[source]

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

d_hamiltonian_d_EJ(zeropi_evecs=None)[source]

Calculates a derivative of the Hamiltonian w.r.t EJ.

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

d_hamiltonian_d_flux(zeropi_evecs=None)[source]

Calculates a derivative of the Hamiltonian w.r.t flux, at the current value of flux, as stored in the object. The returned operator is in the product basis

The flux is assumed to be given in the units of the ratio Phi_{ext}/Phi_0. So if frac{partial H}{ partial Phi_{rm ext}}, is needed, the expression returned by this function, needs to be multiplied by 1/Phi_0.

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

d_hamiltonian_d_ng()[source]

Calculates a derivative of the Hamiltonian w.r.t ng. as stored in the object.

Returns

matrix representing the derivative of the Hamiltonian

Return type

scipy.sparse.csc_matrix

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

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.

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, optional) – number of desired eigenvalues/eigenstates (default value = 6)

  • filename (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues, eigenvectors as numpy arrays or in form of a SpectrumData object

Return type

tuple(ndarray, ndarray) or SpectrumData

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 (str, optional) – path and filename without suffix, if file output desired (default value = None)

  • return_spectrumdata (bool, optional) – if set to true, the returned data is provided as a SpectrumData object (default value = False)

Returns

eigenvalues as ndarray or in form of a SpectrumData object

Return type

ndarray or SpectrumData

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

g_coupling_matrix(zeropi_states=None, evals_count=None)[source]

Returns a matrix of coupling strengths g_{ll’} [cmp. Dempster et al., text above Eq. (17)], using the states from ‘zeropi_states’. If zeropi_states==None, then a set of self.zeropi eigenstates is calculated. Only in that case is which used for the eigenstate number (and hence the coupling matrix size).

g_phi_coupling_matrix(zeropi_states)[source]

Returns a matrix of coupling strengths g^phi_{ll’} [cmp. Dempster et al., Eq. (18)], using the states from the list zeropi_states. Most commonly, zeropi_states will contain eigenvectors of the DisorderedZeroPi type.

g_theta_coupling_matrix(zeropi_states)[source]

Returns a matrix of coupling strengths i*g^theta_{ll’} [cmp. Dempster et al., Eq. (17)], using the states from the list ‘zeropi_states’.

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

get_matelements_vs_paramvals(operator, param_name, param_vals, evals_count=6, num_cpus=1)

Calculates matrix elements for a varying system parameter, given an array of parameter values. Returns a SpectrumData object containing matrix element data, eigenvalue data, and eigenstate data..

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_spectrum_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=False, get_eigenstates=False, filename=None, num_cpus=1)

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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – if True, eigenvalues are returned relative to the ground state eigenvalue (default value = False)

  • get_eigenstates (bool, optional) – return eigenstates along with eigenvalues (default value = False)

  • filename (str, optional) – file name if direct output to disk is wanted

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

hamiltonian(return_parts=False)[source]

Returns Hamiltonian in basis obtained by discretizing phi, employing charge basis for theta, and Fock basis for zeta.

Parameters

return_parts (bool, optional) – If set to true, hamiltonian returns [hamiltonian, evals, evecs, g_coupling_matrix]

Returns

Return type

scipy.sparse.csc_matrix or list

hilbertdim()[source]

Returns Hilbert space dimension

Returns

Return type

int

i_d_dphi_operator(zeropi_evecs=None)[source]

Operator \(i d/d\phi\).

Returns

Return type

scipy.sparse.csc_matrix

matrixelement_table(operator, evecs=None, evals_count=6, filename=None, return_datastore=False)

Returns table of matrix elements for operator with respect to the eigenstates of the qubit. The operator is given as a string matching a class method returning an operator matrix. E.g., for an instance trm of Transmon, the matrix element table for the charge operator is given by trm.op_matrixelement_table(‘n_operator’). When esys is set to None, the eigensystem is calculated on-the-fly.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix in qubit-internal basis.

  • evecs (ndarray, optional) – if not provided, then the necessary eigenstates are calculated on the fly

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • filename (str, optional) – output file name

  • return_datastore (bool, optional) – if set to true, the returned data is provided as a DataStore object (default value = False)

Returns

Return type

ndarray

n_theta_operator(zeropi_evecs=None)[source]

Operator \(n_\theta\).

Returns

Return type

scipy.sparse.csc_matrix

phi_operator(zeropi_evecs=None)[source]

Operator \(\phi\).

Returns

Return type

scipy.sparse.csc_matrix

plot_coherence_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_evals_vs_paramvals(param_name, param_vals, evals_count=6, subtract_ground=None, num_cpus=1, **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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • evals_count (int, optional) – number of desired eigenvalues (sorted from smallest to largest) (default value = 6)

  • subtract_ground (bool, optional) – whether to subtract ground state energy from all eigenvalues (default value = False)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matelem_vs_paramvals(operator, param_name, param_vals, select_elems=4, mode='abs', num_cpus=1, **kwargs)

Generates a simple plot of a set of eigenvalues as a function of one parameter. The individual points correspond to the a provided array of parameter values.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • param_name (str) – name of parameter to be varied

  • param_vals (ndarray) – parameter values to be plugged in

  • select_elems (int or list, optional) – 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, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default value = ‘abs’)

  • num_cpus (int, optional) – number of cores to be used for computation (default value = 1)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_matrixelements(operator, evecs=None, evals_count=6, mode='abs', show_numbers=False, show3d=True, **kwargs)

Plots matrix elements for operator, given as a string referring to a class method that returns an operator matrix. E.g., for instance trm of Transmon, the matrix element plot for the charge operator n is obtained by trm.plot_matrixelements(‘n’). When esys is set to None, the eigensystem with which eigenvectors is calculated.

Parameters
  • operator (str) – name of class method in string form, returning operator matrix

  • evecs (ndarray, optional) – eigensystem data of evals, evecs; eigensystem will be calculated if set to None (default value = None)

  • evals_count (int, optional) – number of desired matrix elements, starting with ground state (default value = 6)

  • mode (str, optional) – entry from MODE_FUNC_DICTIONARY, e.g., ‘abs’ for absolute value (default)

  • show_numbers (bool, optional) – determines whether matrix element values are printed on top of the plot (default: False)

  • show3d (bool, optional) – whether to show a 3d skyscraper plot of the matrix alongside the 2d plot (default: True)

  • **kwargs (dict) – standard plotting option (see separate documentation)

Returns

Return type

Figure, Axes

plot_t1_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_1\) coherence as it varies 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

plot_t2_effective_vs_paramvals(param_name, param_vals, noise_channels=None, common_noise_options=None, spectrum_data=None, scale=1, num_cpus=1, **kwargs)

Plot effective \(T_2\) coherence as it varies 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 (depolariztion) 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 varied

  • param_vals (ndarray) – parameter values to be plugged in

  • 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

  • spectrum_data (SpectrumData) – spectral data used during noise calculations

  • scale (float) – a number that all data is multiplied by before being plotted

  • num_cpus (int) – number of cores to be used for computation

Returns

Return type

Figure, Axes

receive(event, sender, **kwargs)[source]

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

set_EC_via_ECS(ECS)[source]

Helper function to set EC by providing ECS, keeping ECJ constant.

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 form

  • value (any) – value that the attribute is to be set to

Returns

Return type

self

set_params(**kwargs)[source]

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

supported_noise_channels()[source]

Return a list of supported noise channels

t1(i, j, noise_op, spectral_density, total=True, esys=None, get_rate=False, **kwargs)

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 (operator (ndarray)) – noise operator

  • spectral_density (callable object) – defines a spectral density, must take one argument: omega (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_capacitive(i=1, j=0, Q_cap=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to dielectric dissipation in the Jesephson junction capacitances.

References: Nguyen et al (2019), Smith et al (2020)

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 (numeric or callable) – capacitive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_charge_impedance(i=1, j=0, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 (float or callable) – impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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 (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

t1_flux_bias_line(i=1, j=0, M=400, Z=50, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

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 / Ampere

  • Z (complex, float or callable) – A complex impedance; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t1_inductive(i=1, j=0, Q_ind=None, T=0.015, total=True, esys=None, get_rate=False, **kwargs)

\(T_1\) due to inductive dissipation in a superinductor.

References: Nguyen et al (2019), Smith et al (2020)

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 (float or callable) – inductive quality factor; a fixed value or function of omega

  • T (float) – temperature in Kelvin

  • 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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

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, **kwargs)

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)

  • float or callable (Y_qp) – complex admittance; a fixed value or function of omega

  • x_qp (float) – quasiparticle density (in units of eV)

  • T (float) – temperature in Kelvin

  • Delta (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 transitions

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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

t2_effective(noise_channels=None, common_noise_options=None, esys=None, get_rate=False, **kwargs)

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 (depolariztion) 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 strength

  • i (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 (operator (ndarray)) – noise operator, typically Hamiltonian derivative w.r.t. noisy parameter

  • esys (tuple(ndarray, ndarray)) – evals, evecs tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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_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 strength

  • i (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 tuple

  • 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

widget(params=None)[source]

Use ipywidgets to modify parameters of class instance


Oscillator

class scqubits.Oscillator(E_osc=None, omega=None, truncated_dim=None)[source]

General class for mode of an oscillator/resonator.

annihilation_operator()[source]

Returns the creation operator

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

classmethod create()

Use ipywidgets to create a new class instance

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

creation_operator()[source]

Returns the creation operator

static default_params()[source]

Return dictionary with default parameter values for initialization of class instance

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 (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

eigensys(evals_count=6)[source]

Returns array of eigenvalues and eigenvectors

Parameters

evals_count (int, optional) – number of desired eigenvalues (default value = 6)

Returns

Return type

ndarray, ndarray

eigenvals(evals_count=6)[source]

Returns array of eigenvalues.

Parameters

evals_count (int, optional) – number of desired eigenvalues (default value = 6)

Returns

Return type

ndarray

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

hilbertdim()[source]

Returns Hilbert space dimension

Returns

Return type

int

receive(event, sender, **kwargs)

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

set_params(**kwargs)

Set new parameters through the provided dictionary.

Parameters

kwargs (dict (str: Number)) –

supported_noise_channels()

Returns a list of noise channels this QuantumSystem supports. If none, return an empty list.

widget(params=None)

Use ipywidgets to modify parameters of class instance