def __init__(self, fig):
            """
            Initialize all propagators and frame
            :param fig: matplotlib figure object
            """
            #  Initialize systems
            self.set_quantum_sys()

            #################################################################
            #
            # Initialize plotting facility
            #
            #################################################################

            self.fig = fig

            # import utility to visualize the wigner function
            from wigner_normalize import WignerNormalize

            # bundle plotting settings
            imshow_settings = dict(origin='lower',
                                   cmap='seismic',
                                   norm=WignerNormalize(vmin=-0.1, vmax=0.1),
                                   extent=[
                                       self.molecule.X.min(),
                                       self.molecule.X.max(),
                                       self.molecule.P.min(),
                                       self.molecule.P.max()
                                   ])

            # generate plots
            ax = fig.add_subplot(221)
            ax.set_title('$W_{g}(x,p)$')
            self.wigner_g_img = ax.imshow([[]], **imshow_settings)
            ax.set_ylabel('$p$ (a.u.)')

            ax = fig.add_subplot(222)
            ax.set_title('$\\Re W_{ge}(x,p)$')
            self.re_wigner_ge_img = ax.imshow([[]], **imshow_settings)
            ax.set_ylabel('$p$ (a.u.)')

            ax = fig.add_subplot(223)
            ax.set_title('$\\Im W_{eg}(x,p)$')
            self.im_wigner_ge_img = ax.imshow([[]], **imshow_settings)
            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')

            ax = fig.add_subplot(224)
            ax.set_title('$W_{e}(x,p)$')
            self.wigner_e_img = ax.imshow([[]], **imshow_settings)
            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')
Esempio n. 2
0
        def __init__(self, fig):
            """
            Initialize all propagators and frame
            :param fig: matplotlib figure object
            """
            #  Initialize systems
            self.set_quantum_sys()

            #################################################################
            #
            # Initialize plotting facility
            #
            #################################################################

            self.fig = fig

            # import utility to visualize the wigner function
            from wigner_normalize import WignerNormalize  #WignerSymLogNorm

            # imshow parameters
            plot_params = dict(extent=[
                self.quant_sys.X.min(),
                self.quant_sys.X.max(),
                self.quant_sys.P.min(),
                self.quant_sys.P.max()
            ],
                               origin='lower',
                               cmap='seismic',
                               interpolation='nearest',
                               norm=WignerNormalize(vmin=-0.005, vmax=0.1))

            ax = fig.add_subplot(121)
            ax.set_title(
                'Gibbs state Wigner function ($W_0(x,p)$)\nwith $kT = $ %.2f (a.u.)'
                % self.quant_sys.kT)

            self.gibbs_state_img = ax.imshow(self.quant_sys.gibbs_state,
                                             **plot_params)
            self.fig.colorbar(self.gibbs_state_img)
            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')

            ax = fig.add_subplot(122)
            ax.set_title(
                'Wigner function evolution $W(x,p,t)$\nwith $\\gamma^{-1} = $ %.2f (a.u.)'
                % (1. / self.quant_sys.gamma))

            self.img = ax.imshow([[]], **plot_params)
            self.fig.colorbar(self.img)
            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')
Esempio n. 3
0
    def __init__(self, fig):
        """
        Initialize all propagators and frame
        :param fig: matplotlib figure object
        """
        #  Initialize the system
        self.set_sys()

        #################################################################
        #
        # Initialize plotting facility
        #
        #################################################################

        self.fig = fig

        # import utility to visualize the wigner function
        from wigner_normalize import WignerNormalize, WignerSymLogNorm

        img_params = dict(
            origin='lower',
            cmap='seismic',
            norm=WignerNormalize(vmin=-0.01, vmax=0.05),
            # norm=WignerSymLogNorm(linthresh=1e-5, vmin=-0.01, vmax=0.1),
        )

        ax = fig.add_subplot(121)
        ax.set_title('Classical density, $\\rho(x,p,t)$')

        # generate empty plots
        self.img_clasical_rho = ax.imshow(
            [[]],
            **img_params,
            extent=[
                self.quant_sys.X.min(),
                self.quant_sys.X.max(),
                self.quant_sys.P.min(),
                self.quant_sys.P.max()
            ],
        )

        ax.set_xlabel('$x$ (a.u.)')
        ax.set_ylabel('$p$ (a.u.)')

        ax = fig.add_subplot(122)
        ax.set_title('Real part quantum density matrix, $\Re\hat{\\rho}$')

        # generate empty plots
        self.img_Upsilon2 = ax.imshow([[]], **img_params, extent=[1, 2, 1, 2])
Esempio n. 4
0
        def __init__(self, fig):
            """
            Initialize all propagators and frame
            :param fig: matplotlib figure object
            """
            #  Initialize the system
            self.set_sys()

            #################################################################
            #
            # Initialize plotting facility
            #
            #################################################################

            self.fig = fig

            # import utility to visualize the wigner function
            from wigner_normalize import WignerNormalize, WignerSymLogNorm

            img_params = dict(
                extent=[
                    self.quant_sys.X.min(),
                    self.quant_sys.X.max(),
                    self.quant_sys.P.min(),
                    self.quant_sys.P.max()
                ],
                origin='lower',
                cmap='seismic',
                norm=WignerNormalize(vmin=-0.01, vmax=0.1)
                #norm=WignerSymLogNorm(linthresh=1e-16, vmin=-0.01, vmax=0.1)
            )

            ax = fig.add_subplot(121)
            ax.set_title('Quantum classical hybrid, $\\Upsilon_1(x,p,t)$')

            # generate empty plots
            self.img_Upsilon1 = ax.imshow([[]], **img_params)

            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')

            ax = fig.add_subplot(122)
            ax.set_title('Quantum classical hybrid, $\\Upsilon_2(x,p,t)$')

            # generate empty plots
            self.img_Upsilon2 = ax.imshow([[]], **img_params)

            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')
        def __init__(self, fig):
            """
            Initialize all propagators and frame
            :param fig: matplotlib figure object
            """
            #  Initialize systems
            self.set_quantum_sys()

            #################################################################
            #
            # Initialize plotting facility
            #
            #################################################################

            self.fig = fig

            ax = fig.add_subplot(111)

            ax.set_title('Wigner function, $W(x,p,t)$')
            extent = [
                self.quant_sys.X.min(),
                self.quant_sys.X.max(),
                self.quant_sys.P.min(),
                self.quant_sys.P.max()
            ]

            # import utility to visualize the wigner function
            from wigner_normalize import WignerNormalize

            # generate empty plot
            self.img = ax.imshow([[]],
                                 extent=extent,
                                 origin='lower',
                                 cmap='seismic',
                                 norm=WignerNormalize(vmin=-0.01, vmax=0.1))

            self.fig.colorbar(self.img)

            ax.set_xlabel('$x$ (a.u.)')
            ax.set_ylabel('$p$ (a.u.)')
Esempio n. 6
0
    def __init__(self, fig):
        """
        Initialize all propagators and frame
        :param fig: matplotlib figure object
        """
        #  Initialize the system
        self.set_sys()

        #################################################################
        #
        # Initialize plotting facility
        #
        #################################################################

        self.fig = fig

        # import utility to visualize the wigner function
        from wigner_normalize import WignerNormalize, WignerSymLogNorm

        img_params = dict(
            origin='lower',
            cmap='seismic',
            norm=WignerNormalize(vmin=-0.1, vmax=0.1)
            #norm=WignerSymLogNorm(linthresh=1e-4, vmin=-0.01, vmax=0.1)
        )

        ax = fig.add_subplot(221)
        ax.set_title('Numerical classical density')

        # generate empty plots
        self.numeric_classical_density = ax.imshow([[]],
                                                   extent=[
                                                       self.quant_sys.X.min(),
                                                       self.quant_sys.X.max(),
                                                       self.quant_sys.P.min(),
                                                       self.quant_sys.P.max()
                                                   ],
                                                   **img_params)

        ax.set_xlabel('$x$ (a.u.)')
        ax.set_ylabel('$p$ (a.u.)')

        ax = fig.add_subplot(222)
        ax.set_title('Analytical classical density')

        # generate empty plots
        self.analytic_density = ax.imshow(
            [[]],
            **img_params,
            extent=[self.q.min(),
                    self.q.max(),
                    self.p.min(),
                    self.p.max()])

        ax.set_xlabel('$x$ (a.u.)')
        ax.set_ylabel('$p$ (a.u.)')

        ax = fig.add_subplot(223)
        ax.set_title('Coordinate marginal')

        self.analytic_coordinate_dist, = ax.semilogy(
            [self.q.min(), self.q.max()], [1e-6, 1e1], label="analytic")
        self.numeric_coordinate_dist, = ax.semilogy(
            [self.q.min(), self.q.max()], [1e-6, 1e1], label="numeric")

        ax.legend()

        ax.set_xlabel('$q$ (a.u.)')
        ax.set_ylabel('Probability density')

        ax = fig.add_subplot(224)
        ax.set_title('Momentum marginal')

        self.analytic_momentum_dist, = ax.semilogy(
            [self.p.min(), self.p.max()], [1e-6, 1e1], label="analytic")
        self.numeric_momentum_dist, = ax.semilogy(
            [self.p.min(), self.p.max()], [1e-6, 1e1], label="numeric")

        ax.legend()

        ax.set_xlabel('$p$ (a.u.)')
        ax.set_ylabel('Probability density')
Esempio n. 7
0
    prop = CHybridProp(
        n_basis_vect=100,
        h="0.5 * (p ** 2 + q ** 2)",
        diff_p_h="p",
        diff_q_h="q",
    )

    # prop.set_upsilon(func_upsilon2 = Upsilon)
    prop.set_upsilon("exp(-100. * (p ** 2 + q ** 2))")

    img_param = dict(
        extent=[q.min(), q.max(), p.min(), p.max()],
        origin='lower',
        cmap='seismic',
        # norm=WignerSymLogNorm(linthresh=1e-10)
        norm=WignerNormalize())

    rho = prop.get_classical_density(q, p).copy()

    Y_before = prop._flatten_upsilon.copy()

    plt.subplot(121)
    plt.title("Fitted function")

    plt.imshow(rho, **img_param)
    plt.xlabel("$q$ (a.u.)")
    plt.ylabel("$p$ (a.u.)")
    plt.colorbar()

    plt.subplot(122)
    plt.title("Error")