scqubits
Advanced tools
+1
-3
| Metadata-Version: 2.1 | ||
| Name: scqubits | ||
| Version: 3.0.3 | ||
| Version: 3.1.0 | ||
| Summary: scqubits: superconducting qubits in Python | ||
@@ -48,3 +48,1 @@ Home-page: https://scqubits.readthedocs.io | ||
| Quantum 5, 583 (2021). https://quantum-journal.org/papers/q-2021-11-17-583/ | ||
| Metadata-Version: 2.1 | ||
| Name: scqubits | ||
| Version: 3.0.3 | ||
| Version: 3.1.0 | ||
| Summary: scqubits: superconducting qubits in Python | ||
@@ -48,3 +48,1 @@ Home-page: https://scqubits.readthedocs.io | ||
| Quantum 5, 583 (2021). https://quantum-journal.org/papers/q-2021-11-17-583/ | ||
@@ -205,6 +205,6 @@ # cos2phi_qubit.py | ||
| r""" | ||
| :math:`T_1` due to dielectric dissipation in Josephson junction | ||
| capacitors. | ||
| :math:`T_1` due to dielectric dissipation in the Josephson junction | ||
| capacitances. | ||
| References: nguyen et al (2019), Smith et al (2020) | ||
| References: Nguyen et al (2019), Smith et al (2020) | ||
@@ -231,4 +231,5 @@ Parameters | ||
| ------- | ||
| time or rate | ||
| decoherence time in units of :math:`2\pi ({\rm system\,\,units})`, or rate in inverse units. | ||
| time or rate: float | ||
| decoherence time in units of :math:`2\pi ({\rm system\,\,units})`, or rate | ||
| in inverse units. | ||
@@ -235,0 +236,0 @@ """ |
+39
-22
@@ -26,2 +26,3 @@ # noise.py | ||
| from matplotlib.figure import Figure | ||
| from matplotlib.offsetbox import AnchoredText | ||
| from numpy import ndarray | ||
@@ -131,3 +132,3 @@ from scipy.sparse import csc_matrix | ||
| **kwargs | ||
| ) -> Tuple[Figure, Axes]: | ||
| ) -> Tuple[Figure, Union[Axes, ndarray]]: | ||
| r""" | ||
@@ -240,3 +241,7 @@ Show plots of coherence for various channels supported by the qubit as they | ||
| plotting_options.update( | ||
| {k: v for (k, v) in kwargs.items() if k not in ["fig_ax", "figsize"]} | ||
| { | ||
| key: value | ||
| for (key, value) in kwargs.items() | ||
| if key not in ["fig_ax", "figsize"] | ||
| } | ||
| ) | ||
@@ -247,7 +252,6 @@ | ||
| for n, noise_channel in enumerate(noise_channels): # type:ignore | ||
| for channel_idx, noise_channel in enumerate(noise_channels): # type:ignore | ||
| # case 1: noise_channel is a string representing the noise method | ||
| if isinstance(noise_channel, str): | ||
| noise_channel_method = noise_channel | ||
@@ -260,11 +264,12 @@ | ||
| * getattr( | ||
| self.set_and_return(param_name, v), noise_channel_method | ||
| self.set_and_return(param_name, param_val), | ||
| noise_channel_method, | ||
| )( | ||
| esys=( | ||
| spectrum_data.energy_table[v_i, :], # type:ignore | ||
| spectrum_data.state_table[v_i], # type:ignore | ||
| spectrum_data.energy_table[param_idx, :], # type:ignore | ||
| spectrum_data.state_table[param_idx], # type:ignore | ||
| ), | ||
| **common_noise_options | ||
| ) | ||
| for v_i, v in enumerate(param_vals) | ||
| for param_idx, param_val in enumerate(param_vals) | ||
| ] | ||
@@ -276,3 +281,2 @@ ) | ||
| elif isinstance(noise_channel, tuple): | ||
| noise_channel_method = noise_channel[0] | ||
@@ -291,11 +295,12 @@ | ||
| * getattr( | ||
| self.set_and_return(param_name, v), noise_channel_method | ||
| self.set_and_return(param_name, param_val), | ||
| noise_channel_method, | ||
| )( | ||
| esys=( | ||
| spectrum_data.energy_table[v_i, :], # type:ignore | ||
| spectrum_data.state_table[v_i], # type:ignore | ||
| spectrum_data.energy_table[param_idx, :], # type:ignore | ||
| spectrum_data.state_table[param_idx], # type:ignore | ||
| ), | ||
| **options | ||
| ) | ||
| for v_i, v in enumerate(param_vals) | ||
| for param_idx, param_val in enumerate(param_vals) | ||
| ] | ||
@@ -310,3 +315,3 @@ ) | ||
| ax = axes.ravel()[n] if len(noise_channels) > 1 else axes | ||
| ax = axes.ravel()[channel_idx] if len(noise_channels) > 1 else axes | ||
| plotting_options["fig_ax"] = fig, ax | ||
@@ -317,2 +322,12 @@ plotting_options["title"] = noise_channel_method | ||
| ) | ||
| # check whether rate is essentially zero and decoherence time thus | ||
| # excessively large | ||
| if np.all(noise_vals / scale > 1e12): | ||
| ax.get_lines()[0].set_color("0.8") | ||
| at = AnchoredText( | ||
| "subdominant noise channel", | ||
| frameon=False, | ||
| loc="center", | ||
| ) | ||
| ax.add_artist(at) | ||
@@ -411,3 +426,2 @@ if len(noise_channels) > 1 and len(noise_channels) % 2: | ||
| if spectrum_data is None: | ||
| # We have to figure out the largest energy level involved in the | ||
@@ -442,11 +456,13 @@ # calculations, to know how many levels we need from the diagonalization. | ||
| scale | ||
| * self.set_and_return(param_name, v).t1_effective( # type: ignore | ||
| * self.set_and_return( | ||
| param_name, param_val | ||
| ).t1_effective( # type:ignore | ||
| noise_channels=noise_channels, | ||
| common_noise_options=common_noise_options, | ||
| esys=( | ||
| spectrum_data.energy_table[v_i, :], # type:ignore | ||
| spectrum_data.state_table[v_i], # type:ignore | ||
| spectrum_data.energy_table[param_idx, :], # type:ignore | ||
| spectrum_data.state_table[param_idx], # type:ignore | ||
| ), | ||
| ) | ||
| for v_i, v in enumerate(param_vals) | ||
| for param_idx, param_val in enumerate(param_vals) | ||
| ] | ||
@@ -459,3 +475,2 @@ ) | ||
| plotting_options = { | ||
| "fig_ax": plt.subplots(1), | ||
| "title": "t1_effective", | ||
@@ -466,2 +481,4 @@ "xlabel": param_name, | ||
| } | ||
| if "fig_ax" not in kwargs.keys(): | ||
| plotting_options["fig_ax"] = plt.subplots(1) | ||
@@ -612,3 +629,2 @@ # Add a ylabel if we are plotting coherence times | ||
| plotting_options = { | ||
| "fig_ax": plt.subplots(1), | ||
| "title": "t2_effective", | ||
@@ -623,3 +639,4 @@ "xlabel": param_name, | ||
| plotting_options["ylabel"] = units.get_units_time_label() | ||
| if "fig_ax" not in kwargs.keys(): | ||
| plotting_options["fig_ax"] = plt.subplots(1) | ||
| # Users can overwrite plotting options | ||
@@ -626,0 +643,0 @@ plotting_options.update(kwargs) |
@@ -19,2 +19,3 @@ # transmon.py | ||
| import numpy as np | ||
| import scipy as sp | ||
@@ -118,2 +119,36 @@ from matplotlib.axes import Axes | ||
| def _hamiltonian_diagonal(self) -> ndarray: | ||
| dimension = self.hilbertdim() | ||
| return 4.0 * self.EC * (np.arange(dimension) - self.ncut - self.ng) ** 2 | ||
| def _hamiltonian_offdiagonal(self) -> ndarray: | ||
| dimension = self.hilbertdim() | ||
| return np.full(shape=(dimension - 1,), fill_value=-self.EJ / 2.0) | ||
| def _evals_calc(self, evals_count: int) -> ndarray: | ||
| diagonal = self._hamiltonian_diagonal() | ||
| off_diagonal = self._hamiltonian_offdiagonal() | ||
| evals = sp.linalg.eigvalsh_tridiagonal( | ||
| diagonal, | ||
| off_diagonal, | ||
| select="i", | ||
| select_range=(0, evals_count - 1), | ||
| check_finite=False, | ||
| ) | ||
| return evals | ||
| def _esys_calc(self, evals_count: int) -> Tuple[ndarray, ndarray]: | ||
| diagonal = self._hamiltonian_diagonal() | ||
| off_diagonal = self._hamiltonian_offdiagonal() | ||
| evals, evecs = sp.linalg.eigh_tridiagonal( | ||
| diagonal, | ||
| off_diagonal, | ||
| select="i", | ||
| select_range=(0, evals_count - 1), | ||
| check_finite=False, | ||
| ) | ||
| return evals, evecs | ||
| def n_operator(self) -> ndarray: | ||
@@ -120,0 +155,0 @@ """Returns charge operator `n` in the charge basis""" |
@@ -233,3 +233,3 @@ # zeropi_full.py | ||
| "tphi_1_over_f_flux", | ||
| "t1_bias_flux_line", | ||
| "t1_flux_bias_line", | ||
| # 't1_capacitive', | ||
@@ -236,0 +236,0 @@ "t1_inductive", |
@@ -117,3 +117,2 @@ """ | ||
| mpl.rcParams["font.sans-serif"] = "Roboto, Arial, Helvetica, DejaVu Sans" | ||
| # mpl.rcParams["figure.dpi"] = 150 | ||
| mpl.rcParams["font.size"] = 11 | ||
@@ -147,4 +146,5 @@ mpl.rcParams["axes.labelsize"] = 11 | ||
| # settings for Circuit and SymbolicCircuit class | ||
| ## sets the threshold of the number of nodes above which the symbolic capacitance matrix inversion is skipped | ||
| # Settings for Circuit and SymbolicCircuit class. | ||
| # The following determines the threshold for the number of nodes above which the | ||
| # symbolic inversion of the capacitance matrix is skipped. | ||
| SYM_INVERSION_MAX_NODES = 3 |
@@ -28,3 +28,3 @@ # test_circuit.py | ||
| @staticmethod | ||
| def test_sym_hamiltonian(): | ||
| def test_sym_lagrangian(): | ||
| zp_yaml = """ | ||
@@ -41,12 +41,13 @@ # zero-pi circuit | ||
| REFERENCE = ( | ||
| "<bound method Printable.__str__ of 6.25625*\\dot{θ_1}**2 + " | ||
| "25.0*\\dot{θ_2}**2 + 0.00625*\\dot{θ_3}**2 + EJ*cos(θ1 - 1.0*θ3) + " | ||
| "EJ*cos(-(2πΦ_{1}) + θ1 + θ3) - 0.036*θ2**2 - 0.004*θ2*θ3 - 0.009*θ3**2>" | ||
| "<bound method Printable.__str__ of " | ||
| "EJ*cos(θ1 - 1.0*θ3) + EJ*cos(-(2πΦ_{1}) + θ1 + θ3) + " | ||
| "6.25625*\\dot{θ_1}**2 + 25.0*\\dot{θ_2}**2 + 0.00625*\\dot{θ_3}**2 - " | ||
| "0.036*θ2**2 - 0.004*θ2*θ3 - 0.009*θ3**2>" | ||
| ) | ||
| zero_pi = scq.Circuit(zp_yaml, from_file=False, ext_basis="discretized") | ||
| latex_code = str( | ||
| zero_pi.sym_lagrangian(vars_type="new", return_expr=True).__repr__ | ||
| expression_str = str( | ||
| zero_pi.sym_lagrangian(vars_type="new", return_expr=True).doit().__repr__ | ||
| ) | ||
| assert latex_code == REFERENCE | ||
| assert expression_str == REFERENCE | ||
@@ -53,0 +54,0 @@ @staticmethod |
@@ -71,4 +71,2 @@ # test_spectrumlookup.py | ||
| assert np.allclose(hilbertspace.bare_eigenvals(CPB), reference) | ||
| # [legacy support / deprecated] | ||
| assert np.allclose(hilbertspace.lookup.bare_eigenenergies(CPB), reference) | ||
@@ -80,4 +78,2 @@ def test_hilbertspace_lookup_bare_index(self): | ||
| assert hilbertspace.bare_index(8) == reference | ||
| # [legacy support / deprecated] | ||
| assert hilbertspace.lookup.bare_index(8) == reference | ||
@@ -89,4 +85,2 @@ def test_hilbertspace_lookup_dressed_index(self): | ||
| assert hilbertspace.dressed_index((1, 1, 0)) == reference | ||
| # [legacy support / deprecated] | ||
| assert hilbertspace.lookup.dressed_index((1, 1, 0)) == reference | ||
@@ -183,4 +177,2 @@ def test_hilbertspace_lookup_bare_eigenstates(self): | ||
| assert np.allclose(hilbertspace.bare_eigenstates(CPB), reference) | ||
| # [legacy support / deprecated] | ||
| assert np.allclose(hilbertspace.lookup.bare_eigenstates(CPB), reference) | ||
@@ -187,0 +179,0 @@ |
@@ -136,8 +136,2 @@ # gui_defaults.py | ||
| grid_defaults = { | ||
| "grid_min_val": -6 * np.pi, | ||
| "grid_max_val": 6 * np.pi, | ||
| "grid_pt_count": 50, | ||
| } | ||
| paramvals_from_papers = { | ||
@@ -238,2 +232,3 @@ "Transmon": { | ||
| "Matrix elements", | ||
| "Coherence times", | ||
| ] | ||
@@ -240,0 +235,0 @@ |
@@ -36,7 +36,2 @@ # cpu_switch.py | ||
| # num_cpus > 1 ----------------- | ||
| # windows may require special treatment if sys.platform == 'win32' and | ||
| # settings.POOL is None: warnings.warn("Windows users may explicitly need to | ||
| # provide scqubits.settings.POOL.") | ||
| # user is asking for more than 1 cpu; start pool from here | ||
@@ -43,0 +38,0 @@ if settings.MULTIPROC == "pathos": |
@@ -151,9 +151,11 @@ # misc.py | ||
| if self._out_of_sync: | ||
| warnings.warn( | ||
| "[scqubits] Some system parameters have been changed and" | ||
| " generated spectrum data could be outdated, potentially leading to" | ||
| " incorrect results. Spectral data can be refreshed via" | ||
| " <HilbertSpace>.generate_lookup() or <ParameterSweep>.run()", | ||
| Warning, | ||
| ) | ||
| with warnings.catch_warnings(): | ||
| warnings.simplefilter("always") | ||
| warnings.warn( | ||
| "[scqubits] Some system parameters have been changed and" | ||
| " generated spectrum data could be outdated, potentially leading to" | ||
| " incorrect results. Spectral data can be refreshed via" | ||
| " <HilbertSpace>.generate_lookup() or <ParameterSweep>.run()", | ||
| Warning, | ||
| ) | ||
| return func(self, *args, **kwargs) | ||
@@ -160,0 +162,0 @@ |
@@ -289,2 +289,3 @@ # plotting.py | ||
| fig, (ax1, ax2) = kwargs["fig_ax"] | ||
| del kwargs["fig_ax"] | ||
| else: | ||
@@ -291,0 +292,0 @@ fig = plt.figure() |
| # THIS FILE IS GENERATED FROM scqubits SETUP.PY | ||
| short_version = '3.0.3' | ||
| version = '3.0.3' | ||
| short_version = '3.1.0' | ||
| version = '3.1.0' | ||
| release = True |
+2
-2
@@ -55,4 +55,4 @@ """scqubits: superconducting qubits in Python | ||
| MAJOR = 3 | ||
| MINOR = 0 | ||
| MICRO = 3 | ||
| MINOR = 1 | ||
| MICRO = 0 | ||
| ISRELEASED = True | ||
@@ -59,0 +59,0 @@ |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
8613683
0.34%23990
2.89%