Example #1
0
 def __init__(self, sys, colors=None):
     error_handling.sys(sys)
     self.sys = sys
     if colors is None:
         self.colors = ['b', 'r', 'g', 'y', 'm', 'k']
     else:
         self.colors = colors
Example #2
0
File: plot.py Project: cpoli/tbee
 def __init__(self, sys, colors=None):
     error_handling.sys(sys)
     self.sys = sys
     if colors is None:
         self.colors = ['b', 'r', 'g', 'y', 'm', 'k']
     else:
         self.colors = colors
Example #3
0
    def polarization(self,
                     fig=None,
                     ax1=None,
                     ms=10.,
                     fs=20.,
                     lims=None,
                     tag_pola=None,
                     ind=None):
        '''
        Plot sublattice polarization.

        :param fig: Figure. Default value None. (used by the method spectrum).
        :param ax1: Axis. Default value None. (used by the method spectrum).
        :param ms: Positive Float. Default value 10. Markersize.
        :param fs: Positive Float. Default value 20. Fontsize.
        :param lims: List, lims[0] energy min, lims[1] energy max.
        :param tag_pola: Binary char. Default value None. Tag of the sublattice.
        :param ind: List. Default value None. List of indices. (used in the method spectrum).

        :returns:
            * **fig** -- Figure.
        '''
        if fig is None:
            error_handling.sys(self.sys)
            error_handling.empty_ndarray(self.sys.en, 'sys.get_eig')
            error_handling.positive_real(ms, 'ms')
            error_handling.positive_real(fs, 'fs')
            error_handling.lims(lims)
            fig, ax2 = plt.subplots()
            ax2 = plt.gca()
            if lims is None:
                ax2.set_ylim([-0.1, 1.1])
                ind = np.ones(self.sys.lat.sites, bool)
            else:
                ind = (self.sys.en > lims[0]) & (self.sys.en < lims[1])
                ax2.set_ylim([lims[0] - 0.1, lims[1] + 0.1])
        else:
            ax2 = plt.twinx()
        error_handling.empty_ndarray(self.sys.pola, 'sys.get_pola')
        error_handling.tag(tag_pola, self.sys.lat.tags)
        x = np.arange(self.sys.lat.sites)
        i_tag = self.sys.lat.tags == tag_pola
        ax2.plot(x[ind],
                 np.ravel(self.sys.pola[ind, i_tag]),
                 'or',
                 markersize=(4 * ms) // 5)
        str_tag = tag_pola.decode('ascii')
        ylabel = '$<' + str_tag.upper() + '|' + str_tag.upper() + '>$'
        ax2.set_ylabel(ylabel, fontsize=fs, color='red')
        ax2.set_ylim([-0.1, 1.1])
        ax2.set_xlim(-0.5, x[ind][-1] + 0.5)
        for tick in ax2.xaxis.get_major_ticks():
            tick.label.set_fontsize(fs)
        for label in ax2.get_yticklabels():
            label.set_color('r')
        return fig, ax2
Example #4
0
File: plot.py Project: cpoli/tbee
    def polarization(self, fig=None, ax1=None, ms=10., fs=20., lims=None,
                              tag_pola=None, ind=None):
        '''
        Plot sublattice polarization.

        :param fig: Figure. Default value None. (used by the method spectrum).
        :param ax1: Axis. Default value None. (used by the method spectrum).
        :param ms: Positive Float. Default value 10. Markersize.
        :param fs: Positive Float. Default value 20. Fontsize.
        :param lims: List, lims[0] energy min, lims[1] energy max.
        :param tag_pola: Binary char. Default value None. Tag of the sublattice.
        :param ind: List. Default value None. List of indices. (used in the method spectrum).

        :returns:
            * **fig** -- Figure.
        '''
        if fig is None:
            error_handling.sys(self.sys)
            error_handling.empty_ndarray(self.sys.en, 'sys.get_eig')
            error_handling.positive_real(ms, 'ms')
            error_handling.positive_real(fs, 'fs')
            error_handling.lims(lims)
            fig, ax2 = plt.subplots()
            ax2 = plt.gca()
            if lims is None:
                ax2.set_ylim([-0.1, 1.1])
                ind = np.ones(self.sys.lat.sites, bool)
            else:
                ind = (self.sys.en > lims[0]) & (self.sys.en < lims[1])
                ax2.set_ylim([lims[0]-0.1, lims[1]+0.1])
        else:
            ax2 = plt.twinx()
        error_handling.empty_ndarray(self.sys.pola, 'sys.get_pola')
        error_handling.tag(tag_pola, self.sys.lat.tags)
        x = np.arange(self.sys.lat.sites)
        i_tag = self.sys.lat.tags == tag_pola
        ax2.plot(x[ind], np.ravel(self.sys.pola[ind, i_tag]), 'or', markersize=(4*ms)//5)
        str_tag = tag_pola.decode('ascii')
        ylabel = '$<' + str_tag.upper() + '|' + str_tag.upper() + '>$'
        ax2.set_ylabel(ylabel, fontsize=fs, color='red')
        ax2.set_ylim([-0.1, 1.1])
        ax2.set_xlim(-0.5, x[ind][-1]+0.5)
        for tick in ax2.xaxis.get_major_ticks():
            tick.label.set_fontsize(fs)
        for label in ax2.get_yticklabels():
            label.set_color('r')
        return fig, ax2
Example #5
0
    def petermann(self, fig=None, ax1=None, ms=10, fs=20, lims=None, ind=None):
        '''
        Plot Peterman factor.

        :param fig: Figure. Default value None. (used by the method spectrum).
        :param ax1: Axis. Default value None. (used by the method spectrum).
        :param ms: Positive Float. Default value 10. Markersize.
        :param fs: Positive Float. Default value 20. Fontsize.
        :param lims: List. lims[0] energy min, lims[1] energy max.
        :param ind: List. Default value None. List of indices. (used in the method spectrum).

        :returns:
            * **fig** -- Figure.
        '''
        if fig is None:
            error_handling.sys(self.sys)
            error_handling.empty_ndarray(self.sys.ipr, 'sys.get_petermann')
            error_handling.positive_real(ms, 'ms')
            error_handling.positive_real(fs, 'fs')
            error_handling.lims(lims)
            fig, ax2 = plt.subplots()
            ax2 = plt.gca()
            if lims is None:
                ind = np.ones(self.sys.lat.sites, bool)
            else:
                ind = (self.sys.en > lims[0]) & (self.sys.en < lims[1])
        else:
            ax2 = plt.twinx()
        error_handling.empty_ndarray(self.sys.ipr, 'sys.get_ipr')
        x = np.arange(self.sys.lat.sites)
        ax2.plot(x[ind],
                 self.sys.petermann[ind],
                 'or',
                 markersize=(4 * ms) // 5)
        ax2.set_ylabel('K', fontsize=fs, color='red')
        ax2.set_xlim(-0.5, x[ind][-1] + 0.5)
        for tick in ax2.xaxis.get_major_ticks():
            tick.label.set_fontsize(fs)
        for label in ax2.get_yticklabels():
            label.set_color('r')
        return fig, ax2
Example #6
0
File: plot.py Project: cpoli/tbee
    def petermann(self, fig=None, ax1=None, ms=10, fs=20, lims=None, ind=None):
        '''
        Plot Peterman factor.

        :param fig: Figure. Default value None. (used by the method spectrum).
        :param ax1: Axis. Default value None. (used by the method spectrum).
        :param ms: Positive Float. Default value 10. Markersize.
        :param fs: Positive Float. Default value 20. Fontsize.
        :param lims: List. lims[0] energy min, lims[1] energy max.
        :param ind: List. Default value None. List of indices. (used in the method spectrum).

        :returns:
            * **fig** -- Figure.
        '''
        if fig is None:
            error_handling.sys(self.sys)
            error_handling.empty_ndarray(self.sys.ipr, 'sys.get_petermann')
            error_handling.positive_real(ms, 'ms')
            error_handling.positive_real(fs, 'fs')
            error_handling.lims(lims)
            fig, ax2 = plt.subplots()
            ax2 = plt.gca()
            if lims is None:
                ind = np.ones(self.sys.lat.sites, bool)
            else:
                ind = (self.sys.en > lims[0]) & (self.sys.en < lims[1])
        else:
            ax2 = plt.twinx()
        error_handling.empty_ndarray(self.sys.ipr, 'sys.get_ipr')
        x = np.arange(self.sys.lat.sites)
        ax2.plot(x[ind], self.sys.petermann[ind], 'or', markersize=(4*ms)//5)
        ax2.set_ylabel( 'K' , fontsize=fs, color='red')
        ax2.set_xlim(-0.5, x[ind][-1]+0.5)
        for tick in ax2.xaxis.get_major_ticks():
            tick.label.set_fontsize(fs)
        for label in ax2.get_yticklabels():
            label.set_color('r')
        return fig, ax2