Пример #1
0
    def wavefunction(self,
                     esys: Tuple[ndarray, ndarray],
                     which: int = 0,
                     phi_grid: 'Grid1d' = None) -> storage.WaveFunction:
        """Returns a fluxonium wave function in `phi` basis

        Parameters
        ----------
        esys:
            eigenvalues, eigenvectors
        which:
             index of desired wave function (default value = 0)
        phi_grid:
            used for setting a custom grid for phi; if None use self._default_grid
        """
        if esys is None:
            evals_count = max(which + 1, 3)
            evals, evecs = self.eigensys(evals_count)
        else:
            evals, evecs = esys
        dim = self.hilbertdim()

        phi_grid = phi_grid or self._default_grid

        phi_basis_labels = phi_grid.make_linspace()
        wavefunc_osc_basis_amplitudes = evecs[:, which]
        phi_wavefunc_amplitudes = np.zeros(phi_grid.pt_count,
                                           dtype=np.complex_)
        phi_osc = self.phi_osc()
        for n in range(dim):
            phi_wavefunc_amplitudes += wavefunc_osc_basis_amplitudes[n] \
                                       * osc.harm_osc_wavefunction(n, phi_basis_labels, phi_osc)
        return storage.WaveFunction(basis_labels=phi_basis_labels,
                                    amplitudes=phi_wavefunc_amplitudes,
                                    energy=evals[which])
Пример #2
0
    def wavefunction(self, esys, which=0, phi_range=None, phi_count=None):
        """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_range: tuple(float,float), optional
             custom boundaries of `phi` values range
        phi_count: int
             number of points in the specified `phi` interval

        Returns
        -------
        WaveFunction object
        """
        if esys is None:
            evals_count = max(which + 1, 3)
            evals, evecs = self.eigensys(evals_count)
        else:
            evals, evecs = esys
        dim = self.hilbertdim()

        phi_range, phi_count = self.try_defaults(phi_range, phi_count)

        phi_basis_labels = np.linspace(phi_range[0], phi_range[1], phi_count)
        wavefunc_osc_basis_amplitudes = evecs[:, which]
        phi_wavefunc_amplitudes = np.zeros(phi_count, dtype=np.complex_)
        phi_osc = self.phi_osc()
        for n in range(dim):
            phi_wavefunc_amplitudes += wavefunc_osc_basis_amplitudes[
                n] * harm_osc_wavefunction(n, phi_basis_labels, phi_osc)
        return WaveFunction(basis_labels=phi_basis_labels,
                            amplitudes=phi_wavefunc_amplitudes,
                            energy=evals[which])