def plot_ggparams(self, **kwargs): plotter = ArrayPlotter( *[("$\\tilde\omega_{G G'}$", self.omegatw), ("$\\tilde\Omega^2_{G, G'}$", self.bigomegatwsq)]) return plotter.plot(**kwargs)
def plot_eigvec_qp(self, spin, kpoint, band=None, **kwargs): title = kwargs.pop("title", None) if kpoint is None: from abipy.tools.plotting_utils import ArrayPlotter plotter = ArrayPlotter() for kpoint in self.kpoints: ksqp_arr = self.ncreader.read_eigvec_qp(spin, kpoint, band=band) plotter.add_array(str(kpoint), ksqp_arr) plotter.plot(title=title) else: from abipy.tools.plotting_utils import plot_array ksqp_arr = self.ncreader.read_eigvec_qp(spin, kpoint, band=band) plot_array(ksqp_arr)
def plot_eigvec_qp(self, spin, kpoint, band=None, **kwargs): if kpoint is None: from abipy.tools.plotting_utils import ArrayPlotter plotter = ArrayPlotter() for kpoint in self.ibz: ksqp_arr = self.reader.read_eigvec_qp(spin, kpoint, band=band) plotter.add_array(str(kpoint), ksqp_arr) fig = plotter.plot(**kwargs) else: from abipy.tools.plotting_utils import plot_array ksqp_arr = self.reader.read_eigvec_qp(spin, kpoint, band=band) fig = plot_array(ksqp_arr, **kwargs) return fig
def plot_eigvec_qp(self, spin, kpoint, band=None, **kwargs): if kpoint is None: from abipy.tools.plotting_utils import ArrayPlotter plotter = ArrayPlotter() for kpoint in self.ibz: ksqp_arr = self.reader.read_eigvec_qp(spin, kpoint, band=band) plotter.add_array(str(kpoint), ksqp_arr) fig = plotter.plot(**kwargs) else: from abipy.tools.plotting_utils import plot_array ksqp_arr = self.reader.read_eigvec_qp(spin, kpoint, band=band) fig = plot_array(ksqp_arr, **kwargs) return fig
def plot_ggmat(self, cplx_mode="abs", wpos=None, **kwargs): """ Use imshow for plotting W_GG'. Args: cplx_mode: wpos: List of frequency indices to plot. If None, the first frequency is used (usually w=0). if wpos == "all" all frequencies are shown (use it carefully) Other possible values: "real" if only real frequencies are wanted. "imag" for imaginary frequencies only. Returns: `matplotlib` figure. """ # Get wpos indices. choice_wpos = { None: [0], "all": range(self.nw), "real": range(self.nrew), "imag": range(self.nrew, self.nw) } if any(wpos == k for k in choice_wpos): wpos = choice_wpos[wpos] else: if isinstance(wpos, int): wpos = [wpos] wpos = np.array(wpos) # Build plotter. plotter = ArrayPlotter() for iw in wpos: label = cplx_mode + " $\omega = %s" % self.wpts[iw] data = data_from_cplx_mode(cplx_mode, self.wggmat[iw, :, :]) plotter.add_array(label, data) return plotter.plot(**kwargs)
def plot_ggmat(self, cplx_mode="abs", wpos=None, **kwargs): """ Use imshow for plotting W_GG'. Args: cplx_mode: wpos: List of frequency indices to plot. If None, the first frequency is used (usually w=0). if wpos == "all" all frequencies are shown (use it carefully) Other possible values: "real" if only real frequencies are wanted. "imag" for imaginary frequencies only. Returns: `matplotlib` figure. """ # Get wpos indices. choice_wpos = { None: [0], "all": range(self.nw), "real": range(self.nrew), "imag": range(self.nrew, self.nw)} if any(wpos == k for k in choice_wpos): wpos = choice_wpos[wpos] else: if isinstance(wpos, int): wpos = [wpos] wpos = np.array(wpos) # Build plotter. plotter = ArrayPlotter() for iw in wpos: label = cplx_mode + " $\omega = %s" % self.wpts[iw] data = data_from_cplx_mode(cplx_mode, self.wggmat[iw,:,:]) plotter.add_array(label, data) return plotter.plot(**kwargs)
def plot_ggparams(self, **kwargs): plotter = ArrayPlotter(*[ ("$\\tilde\omega_{G G'}$", self.omegatw), ("$\\tilde\Omega^2_{G, G'}$", self.bigomegatwsq)]) return plotter.plot(**kwargs)
def plot(self, qpoint=None, spin=None, kpoints=None, color_map=None, **kwargs): """ Plot the dipole matrix elements. Args: qpoint: The qpoint for the optical limit. if qpoint is None, we plot |<k|r|k>| else |<k|q.r|k>| spin: spin index. None if all spins are wanted kpoints: List of Kpoint objects, None if all k-points are wanted. ============== ============================================================== kwargs Meaning ============== ============================================================== title Title of the plot (Default: None). show True to show the figure (Default). savefig: 'abc.png' or 'abc.eps'* to save the figure to a file. colormap matplotlib colormap, see link below. ============== ============================================================== Returns: matplotlib figure. .. see: http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html """ title = kwargs.pop("title", None) show = kwargs.pop("show", True) savefig = kwargs.pop("savefig", None) color_map = kwargs.pop("color_map", None) if qpoint is not None: # Will compute scalar product with q qpoint = Kpoint.askpoint(qpoint, self.structure.reciprocal_lattice).versor() else: # Will plot |<psi|r|psi>|. qpoint = Kpoint((1, 1, 1), self.structure.reciprocal_lattice) if spin in None: spins = range(self.nsppol) else: spins = [spin] if kpoints is None: kpoints = self.ibz # Extract the matrix elements for the plot. from abipy.tools.plotting_utils import ArrayPlotter plotter = ArrayPlotter() for spin in spins: for kpoint in kpoints: ik = self.kpoint_index(kpoint) rme = self.dipme_scvk[spin, ik, :, :, :] #qrme = qpoint * rme label = "qpoint %s, spin %s, kpoint = %s" % (qpoint, spin, kpoint) plotter.add_array(label, rme) # Plot matrix elements and return matplotlib figure. return plotter.plot(title=title, color_map=color_map, show=show, savefig=savefig, **kwargs)