示例#1
0
    def make_overview_plot(self, **kwargs):
        """
        Make a single figure with all plots. 
        
        INPUT:
        - kwargs:
            - sp, sm, de, du, sc (lists, ndarray): lists that limit the range of spectra to be plotted. By default all spectra will be plotted.
            - aspect (str, 'equal'): the aspect ratio of the axes. 
            - flip_spectrum (bool, False): by default (False) the x axis is w_3. If True, it will be w_1. Make sure the axes ranges are changed as well. 
        
        OUTPUT:
        - -
        
        DESCRIPTION:
        - - 
        
        CHANGELOG:
        2016014/RB: started function
        
        """
    
        pi, bish, sp, ds, sm, de, du, sc = self.multiplot_ranges(**kwargs)
    
        n_plots = len(sp) * len(sm) * len(de) * len(du) * len(sc)

        x, y = FU.find_subplots(n_plots, flag_verbose = self.flag_verbose)

        fig = plt.figure()
        ax = [0] * n_plots
        for ax_i in range(n_plots):
            ax[ax_i] = fig.add_subplot(y, x, ax_i + 1)  
            if "aspect" in kwargs:
                if kwargs["aspect"] != False:
                    ax[ax_i].set_aspect(kwargs["aspect"])
            else:
                ax[ax_i].set_aspect("equal")

        ax_i = 0
        for _sp in sp:
            for _sm in sm:
                for _de in de:
                    for _du in du:
                        for _sc in sc:
                            
                            title = "{name}\nsp {spx}, sm {smx}, de {dex} fs".format(name = self._basename, spx = self.s_axes[3][_sp], smx = "x",#self.s_axes[4][:,_sm], 
                            dex = self.s_axes[5][_de])
                            
                            if "flip_spectrum" in kwargs and kwargs["flip_spectrum"]:
                                PL.contourplot(self.s[:, :, 0, _sp, _sm, _de, _du, _sc], self.s_axes[1], self.s_axes[0], x_label = "w1 (cm-1)", y_label = "w3 (cm-1)", ax = ax[ax_i], title = title, **kwargs)
                     
                            else:
                                PL.contourplot(self.s[:, :, 0, _sp, _sm, _de, _du, _sc].T, self.s_axes[0], self.s_axes[1], x_label = "w3 (cm-1)", y_label = "w1 (cm-1)", ax = ax[ax_i], title = title, **kwargs)

                            ax_i += 1
                            
        return fig
示例#2
0
    def test(self):

        par = [
            [0,0,0],
            [1,1,1],
            [2,2,1],
            [3,2,2],
            [4,2,2],
            [5,3,2],
            [6,3,2],
            [7,3,3],
            [8,3,3],
            [9,3,3],
            [10,4,3],
            [11,4,3],
            [12,4,3],
            [13,4,4],
            [14,4,4],
            [15,4,4],
            [16,4,4],
            [17,5,4],
            [18,5,4],
            [19,5,4],
            [20,5,4],
            [21,5,5],
            [22,5,5],
            [23,5,5],
            [24,5,5],
            [25,5,5],
        ]
        
        for p in par:
            x, y = FU.find_subplots(p[0], flag_verbose = self.flag_verbose)
            print(p[0], x, y)
            self.assertEqual(x, p[1])
            self.assertEqual(y, p[2])