예제 #1
0
 def create(cls) -> "FullZeroPi":
     phi_grid = discretization.Grid1d(-25.0, 25.0, 360)
     init_params = cls.default_params()
     init_params["grid"] = phi_grid
     zeropi = cls(**init_params)
     zeropi.widget()
     return zeropi
예제 #2
0
파일: zeropi.py 프로젝트: loganbvh/scqubits
 def create(cls) -> 'ZeroPi':
     phi_grid = discretization.Grid1d(-19.0, 19.0, 200)
     init_params = cls.default_params()
     init_params['grid'] = phi_grid
     zeropi = cls(**init_params)
     zeropi.widget()
     return zeropi
예제 #3
0
 def __init__(self,
              EJ1: float,
              EJ2: float,
              EJ3: float,
              ECJ1: float,
              ECJ2: float,
              ECJ3: float,
              ECg1: float,
              ECg2: float,
              ng1: float,
              ng2: float,
              flux: float,
              ncut: int,
              truncated_dim: int = 6) -> None:
     self.EJ1 = EJ1
     self.EJ2 = EJ2
     self.EJ3 = EJ3
     self.ECJ1 = ECJ1
     self.ECJ2 = ECJ2
     self.ECJ3 = ECJ3
     self.ECg1 = ECg1
     self.ECg2 = ECg2
     self.ng1 = ng1
     self.ng2 = ng2
     self.flux = flux
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.complex_
     self._default_grid = discretization.Grid1d(
         -np.pi / 2, 3 * np.pi / 2, 100)  # for plotting in phi_j basis
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_img/flux-qubit.jpg')
예제 #4
0
 def __init__(self,
              EJ1,
              EJ2,
              EJ3,
              ECJ1,
              ECJ2,
              ECJ3,
              ECg1,
              ECg2,
              ng1,
              ng2,
              flux,
              ncut,
              truncated_dim=None):
     self.EJ1 = EJ1
     self.EJ2 = EJ2
     self.EJ3 = EJ3
     self.ECJ1 = ECJ1
     self.ECJ2 = ECJ2
     self.ECJ3 = ECJ3
     self.ECg1 = ECg1
     self.ECg2 = ECg2
     self.ng1 = ng1
     self.ng2 = ng2
     self.flux = flux
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.complex_
     self._default_grid = discretization.Grid1d(
         -np.pi / 2, 3 * np.pi / 2, 100)  # for plotting in phi_j basis
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_pngs/fluxqubit.png')
예제 #5
0
 def set_params(self, **kwargs):
     phi_grid = discretization.Grid1d(kwargs.pop('grid_min_val'),
                                      kwargs.pop('grid_max_val'),
                                      kwargs.pop('grid_pt_count'))
     self.grid = phi_grid
     for param_name, param_val in kwargs.items():
         setattr(self, param_name, param_val)
예제 #6
0
    def __init__(
        self,
        EJ: float,
        EL: float,
        EC: float,
        ECL: float,
        ng: float,
        flux: float,
        grid: Grid1d,
        ncut: int,
        dEJ: float = 0.0,
        truncated_dim: int = 6,
    ) -> None:
        self.EJ = EJ
        self.EL = EL
        self.EC = EC
        self.ECL = ECL
        self.dEJ = dEJ
        self.ng = ng
        self.flux = flux
        self.grid = grid
        self.ncut = ncut
        self.truncated_dim = truncated_dim
        self._sys_type = type(self).__name__
        self._evec_dtype = np.complex_

        # _default_grid is for *theta*, needed for plotting wavefunction
        self._default_grid = discretization.Grid1d(-np.pi / 2, 3 * np.pi / 2,
                                                   200)

        self._image_filename = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            "qubit_img/bifluxon.jpg")
        dispatch.CENTRAL_DISPATCH.register("GRID_UPDATE", self)
예제 #7
0
 def create(cls) -> "Bifluxon":
     phi_grid = discretization.Grid1d(-19.0, 19.0, 200)
     init_params = cls.default_params()
     init_params["grid"] = phi_grid
     bifluxon = cls(**init_params)
     bifluxon.widget()
     return bifluxon
예제 #8
0
    def __init__(self, EJ, EL, ECJ, EC, ng, flux, grid, ncut, dEJ=0, dCJ=0, ECS=None, truncated_dim=None):
        self.EJ = EJ
        self.EL = EL
        self.ECJ = ECJ

        if EC is None and ECS is None:
            raise ValueError("Argument missing: must either provide EC or ECS")
        if EC and ECS:
            raise ValueError("Argument error: can only provide either EC or ECS")
        if EC:
            self.EC = EC
        else:
            self.EC = 1 / (1 / ECS - 1 / self.ECJ)
        self.dEJ = dEJ
        self.dCJ = dCJ
        self.ng = ng
        self.flux = flux
        self.grid = grid
        self.ncut = ncut
        self.truncated_dim = truncated_dim
        self._sys_type = type(self).__name__
        self._evec_dtype = np.complex_
        # for theta, needed for plotting wavefunction
        self._default_grid = discretization.Grid1d(-np.pi / 2, 3 * np.pi / 2, 100)
        self._init_params.remove('ECS')  # used in for file Serializable purposes; remove ECS as init parameter
        self._image_filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'qubit_pngs/zeropi.png')
        dispatch.CENTRAL_DISPATCH.register('GRID_UPDATE', self)
예제 #9
0
 def __init__(self,
              EJ1,
              EJ2,
              EJ3,
              ECJ1,
              ECJ2,
              ECJ3,
              ECg1,
              ECg2,
              ng1,
              ng2,
              flux,
              ncut,
              truncated_dim=None):
     self.EJ1 = EJ1
     self.EJ2 = EJ2
     self.EJ3 = EJ3
     self.ECJ1 = ECJ1
     self.ECJ2 = ECJ2
     self.ECJ3 = ECJ3
     self.ECg1 = ECg1
     self.ECg2 = ECg2
     self.ng1 = ng1
     self.ng2 = ng2
     self.flux = flux
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.complex_
     self._default_grid = discretization.Grid1d(
         -np.pi / 2, 3 * np.pi / 2, 100)  # for plotting in phi_j basis
예제 #10
0
    def plot_wavefunction(self,
                          esys=None,
                          which=0,
                          phi_grid=None,
                          theta_grid=None,
                          mode="abs",
                          zero_calibrate=True,
                          **kwargs) -> Tuple[Figure, Axes]:
        """
        Plots a 2D wave function in :math:`\\theta, \\phi` basis, at :math:`\\zeta = 0`

        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, option
            used for setting a custom grid for phi; if None use self._default_phi_grid
        theta_grid: Grid1d, option
            used for setting a custom grid for theta; if None use
            self._default_theta_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

        """
        phi_grid = phi_grid or self._default_phi_grid
        zeta_grid = discretization.Grid1d(0, 0, 1)
        theta_grid = theta_grid or self._default_theta_grid

        amplitude_modifier = constants.MODE_FUNC_DICT[mode]
        wavefunc = self.wavefunction(
            esys,
            phi_grid=phi_grid,
            zeta_grid=zeta_grid,
            theta_grid=theta_grid,
            which=which,
        )

        wavefunc.gridspec = discretization.GridSpec(
            np.asarray([
                [phi_grid.min_val, phi_grid.max_val, phi_grid.pt_count],
                [theta_grid.min_val, theta_grid.max_val, theta_grid.pt_count],
            ]))
        wavefunc.amplitudes = np.transpose(
            amplitude_modifier(
                spec_utils.standardize_phases(
                    wavefunc.amplitudes.reshape(phi_grid.pt_count,
                                                theta_grid.pt_count))))
        return plot.wavefunction2d(wavefunc,
                                   zero_calibrate=zero_calibrate,
                                   ylabel=r"$\theta$",
                                   xlabel=r"$\phi$",
                                   **kwargs)
예제 #11
0
 def __init__(self, EJ, EC, ng, ncut, truncated_dim=None):
     self.EJ = EJ
     self.EC = EC
     self.ng = ng
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-np.pi, np.pi, 151)
     self._default_n_range = (-5, 6)
예제 #12
0
 def __init__(self, EJ, EC, EL, flux, cutoff, truncated_dim=None):
     self.EJ = EJ
     self.EC = EC
     self.EL = EL
     self.flux = flux
     self.cutoff = cutoff
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-4.5 * np.pi, 4.5 * np.pi,
                                                151)
예제 #13
0
 def __init__(
     self,
     EJ: float,
     ECJ: float,
     EL: float,
     EC: float,
     dL: float,
     dCJ: float,
     dEJ: float,
     flux: float,
     ng: float,
     ncut: int,
     zeta_cut: int,
     phi_cut: int,
     truncated_dim: int = 6,
 ) -> None:
     self.EJ = EJ
     self.ECJ = ECJ
     self.EL = EL
     self.EC = EC
     self.dL = dL
     self.dCJ = dCJ
     self.dEJ = dEJ
     self.flux = flux
     self.ng = ng
     self.ncut = ncut
     self.zeta_cut = zeta_cut
     self.phi_cut = phi_cut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_phi_grid = discretization.Grid1d(-4 * np.pi, 4 * np.pi,
                                                    100)
     self._default_zeta_grid = discretization.Grid1d(
         -4 * np.pi, 4 * np.pi, 100)
     self._default_theta_grid = discretization.Grid1d(
         -0.5 * np.pi, 1.5 * np.pi, 100)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "qubit_img/cos2phi-qubit.jpg",
     )
예제 #14
0
 def __init__(self, EJ, EC, ng, ncut, truncated_dim=None):
     self.EJ = EJ
     self.EC = EC
     self.ng = ng
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-np.pi, np.pi, 151)
     self._default_n_range = (-5, 6)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_img/fixed-transmon.jpg')
예제 #15
0
 def __init__(self, EJ, EC, EL, flux, cutoff, truncated_dim=None):
     self.EJ = EJ
     self.EC = EC
     self.EL = EL
     self.flux = flux
     self.cutoff = cutoff
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-4.5 * np.pi, 4.5 * np.pi,
                                                151)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_pngs/fluxonium.png')
예제 #16
0
 def __init__(self, EJmax, EC, d, flux, ng, ncut, truncated_dim=None):
     self.EJmax = EJmax
     self.EC = EC
     self.d = d
     self.flux = flux
     self.ng = ng
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-np.pi, np.pi, 151)
     self._default_n_range = (-5, 6)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_pngs/tunable_transmon.png')
예제 #17
0
    def __init__(
        self,
        EJ: float,
        EL: float,
        ECJ: float,
        EC: Optional[float],
        ng: float,
        flux: float,
        grid: Grid1d,
        ncut: int,
        dEJ: float = 0.0,
        dCJ: float = 0.0,
        ECS: float = None,
        truncated_dim: int = 6,
    ) -> None:
        self.EJ = EJ
        self.EL = EL
        self.ECJ = ECJ

        if EC is None and ECS is None:
            raise ValueError("Argument missing: must either provide EC or ECS")
        if EC and ECS:
            raise ValueError(
                "Argument error: can only provide either EC or ECS")
        if EC:
            self.EC = EC
        elif ECS:
            self.EC = 1 / (1 / ECS - 1 / self.ECJ)
        self.dEJ = dEJ
        self.dCJ = dCJ
        self.ng = ng
        self.flux = flux
        self.grid = grid
        self.ncut = ncut
        self.truncated_dim = truncated_dim
        self._sys_type = type(self).__name__
        self._evec_dtype = np.complex_

        # _default_grid is for *theta*, needed for plotting wavefunction
        self._default_grid = discretization.Grid1d(-np.pi / 2, 3 * np.pi / 2,
                                                   200)

        self._init_params.remove(
            "ECS"
        )  # used in for file Serializable purposes; remove ECS as init parameter
        self._image_filename = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "qubit_img/zeropi.jpg")
        dispatch.CENTRAL_DISPATCH.register("GRID_UPDATE", self)
예제 #18
0
 def __init__(self,
              EJ: float,
              EC: float,
              EL: float,
              flux: float,
              cutoff: int,
              truncated_dim: int = 6) -> None:
     self.EJ = EJ
     self.EC = EC
     self.EL = EL
     self.flux = flux
     self.cutoff = cutoff
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-4.5 * np.pi, 4.5 * np.pi,
                                                151)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_img/fluxonium.jpg')
예제 #19
0
 def __init__(self,
              EJmax: float,
              EC: float,
              d: float,
              flux: float,
              ng: float,
              ncut: int,
              truncated_dim: int = 6) -> None:
     self.EJmax = EJmax
     self.EC = EC
     self.d = d
     self.flux = flux
     self.ng = ng
     self.ncut = ncut
     self.truncated_dim = truncated_dim
     self._sys_type = type(self).__name__
     self._evec_dtype = np.float_
     self._default_grid = discretization.Grid1d(-np.pi, np.pi, 151)
     self._default_n_range = (-5, 6)
     self._image_filename = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         'qubit_img/tunable-transmon.jpg')
예제 #20
0
    def __init__(self,
                 EJ1,
                 EJ2,
                 EJ3,
                 ECJ1,
                 ECJ2,
                 ECJ3,
                 ECg1,
                 ECg2,
                 ng1,
                 ng2,
                 flux,
                 ncut,
                 truncated_dim=None):
        self.EJ1 = EJ1
        self.EJ2 = EJ2
        self.EJ3 = EJ3
        self.ECJ1 = ECJ1
        self.ECJ2 = ECJ2
        self.ECJ3 = ECJ3
        self.ECg1 = ECg1
        self.ECg2 = ECg2
        self.ng1 = ng1
        self.ng2 = ng2
        self.flux = flux
        self.ncut = ncut
        self.truncated_dim = truncated_dim
        self._sys_type = type(self).__name__
        self._evec_dtype = np.complex_
        self._default_grid = discretization.Grid1d(
            -np.pi / 2, 3 * np.pi / 2, 100)  # for plotting in phi_j basis
        self._image_filename = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            'qubit_pngs/fluxqubit.png')

        super().__init__()

        self.add_element(circuit.Capacitance('Cg1'), ['g1', '1'])
        self.add_element(circuit.Capacitance('Cg2'), ['g2', '2'])
        self.add_element(circuit.Capacitance('CJ1'), ['GND', '1'])
        self.add_element(circuit.Capacitance('CJ2'), ['GND', '2'])
        self.add_element(circuit.Capacitance('CJ3'), ['1', '3'])
        self.add_element(circuit.JosephsonJunction('J1', use_offset=False),
                         ['GND', '1'])
        self.add_element(circuit.JosephsonJunction('J2', use_offset=False),
                         ['GND', '2'])
        self.add_element(circuit.JosephsonJunction('J3', use_offset=False),
                         ['1', '3'])

        self.phi1 = circuit.Variable('\\phi_1')
        self.phi2 = circuit.Variable('\\phi_2')
        self.f = circuit.Variable('f')
        self.g1 = circuit.Variable('g_1')
        self.g2 = circuit.Variable('g_2')

        self.add_variable(self.phi1)
        self.add_variable(self.phi2)
        self.add_variable(self.f)
        self.add_variable(self.g1)
        self.add_variable(self.g2)

        self.map_nodes_linear(['GND', '1', '2', '3', 'g1', 'g2'],
                              ['\\phi_1', '\\phi_2', 'f', 'g_1', 'g_2'],
                              np.asarray([[0, 0, 0, 0, 0], [1, 0, 0, 0, 0],
                                          [0, 1, 0, 0, 0], [0, 1, -1, 0, 0],
                                          [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]]))

        self.set_parameters()
예제 #21
0
 def create(cls):
     phi_grid = discretization.Grid1d(-19.0, 19.0, 200)
     init_params = cls.default_params()
     zeropi = cls(**init_params, grid=phi_grid)
     zeropi.widget()
     return zeropi