Exemplo n.º 1
0
    def plot_band_gaps(self, coefs):
        opts = self.app_options

        bg_keys = [
            key for key in coefs.to_dict() if key.startswith('band_gaps')
        ]

        plot_opts = opts.plot_options
        plot_rsc = opts.plot_rsc

        plt.rcParams.update(plot_rsc['params'])

        for ii, key in enumerate(bg_keys):
            bg = coefs.get(key)

            plot_labels = opts.plot_labels.get(key, opts.plot_labels)

            plot_range, teigs = transform_plot_data(bg.logs.eigs,
                                                    opts.plot_transform,
                                                    self.conf)
            fig = plot_gaps(ii,
                            plot_rsc,
                            bg.gaps,
                            bg.kinds,
                            bg.gap_ranges,
                            bg.freq_range_margins,
                            plot_range,
                            clear=True)
            fig = plot_logs(ii,
                            plot_rsc,
                            plot_labels,
                            bg.logs.freqs,
                            teigs,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            if opts.fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir,
                                         opts.fig_name, key, 'band_gaps',
                                         opts.fig_suffix)
                fig.savefig(fig_name)

        if plot_opts['show']:
            plt.show()
Exemplo n.º 2
0
    def plot_band_gaps(self, coefs):
        opts = self.app_options

        bg_keys = [key for key in coefs.to_dict()
                   if key.startswith('band_gaps')]

        plot_opts =  opts.plot_options
        plot_rsc = opts.plot_rsc

        plt.rcParams.update(plot_rsc['params'])

        for ii, key in enumerate(bg_keys):
            bg = coefs.get(key)

            plot_labels =  opts.plot_labels.get(key, opts.plot_labels)

            plot_range, teigs = transform_plot_data(bg.logs.eigs,
                                                    opts.plot_transform,
                                                    self.conf)
            fig = plot_gaps(ii, plot_rsc, bg.gaps, bg.kinds, bg.gap_ranges,
                            bg.freq_range_margins, plot_range,
                            clear=True)
            fig = plot_logs(ii, plot_rsc, plot_labels, bg.logs.freqs, teigs,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            if opts.fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir, opts.fig_name,
                                         key, 'band_gaps', opts.fig_suffix)
                fig.savefig(fig_name)

        if plot_opts['show']:
            plt.show()
Exemplo n.º 3
0
    def plot_dispersion(self, coefs):
        opts = self.app_options

        bg_keys = [
            key for key in coefs.to_dict() if key.startswith('dispersion')
        ]

        plot_rsc = opts.plot_rsc
        plot_opts = opts.plot_options
        plt.rcParams.update(plot_rsc['params'])

        plot_labels = opts.plot_labels_angle

        for ii, key in enumerate(bg_keys):
            pas_key = key.replace('dispersion', 'polarization_angles')
            pas = coefs.get(pas_key)

            aux = transform_plot_data(pas, opts.plot_transform_angle,
                                      self.conf)
            plot_range, pas = aux

            bg = coefs.get(key)

            fig = plot_gaps(1,
                            plot_rsc,
                            bg.gaps,
                            bg.kinds,
                            bg.gap_ranges,
                            bg.freq_range_margins,
                            plot_range,
                            clear=True)
            fig = plot_logs(1,
                            plot_rsc,
                            plot_labels,
                            bg.logs.freqs,
                            pas,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            fig_name = opts.fig_name_angle
            if fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir, fig_name,
                                         key, 'dispersion', opts.fig_suffix)
                fig.savefig(fig_name)

            aux = transform_plot_data(bg.logs.eigs, opts.plot_transform_wave,
                                      self.conf)
            plot_range, teigs = aux

            plot_labels = opts.plot_labels_wave

            fig = plot_gaps(2,
                            plot_rsc,
                            bg.gaps,
                            bg.kinds,
                            bg.gap_ranges,
                            bg.freq_range_margins,
                            plot_range,
                            clear=True)
            fig = plot_logs(2,
                            plot_rsc,
                            plot_labels,
                            bg.logs.freqs,
                            teigs,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            fig_name = opts.fig_name_wave
            if fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir, fig_name,
                                         key, 'dispersion', opts.fig_suffix)
                fig.savefig(fig_name)

        if plot_opts['show']:
            plt.show()
Exemplo n.º 4
0
    def plot_dispersion(self, coefs):
        opts = self.app_options

        bg_keys = [key for key in coefs.to_dict()
                   if key.startswith('dispersion')]

        plot_rsc = opts.plot_rsc
        plot_opts =  opts.plot_options
        plt.rcParams.update(plot_rsc['params'])

        plot_labels =  opts.plot_labels_angle

        for ii, key in enumerate(bg_keys):
            pas_key = key.replace('dispersion', 'polarization_angles')
            pas = coefs.get(pas_key)

            aux = transform_plot_data(pas,
                                      opts.plot_transform_angle,
                                      self.conf)
            plot_range, pas = aux


            bg = coefs.get(key)

            fig = plot_gaps(1, plot_rsc, bg.gaps, bg.kinds, bg.gap_ranges,
                            bg.freq_range_margins, plot_range,
                            clear=True)
            fig = plot_logs(1, plot_rsc, plot_labels, bg.logs.freqs, pas,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            fig_name = opts.fig_name_angle
            if fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir, fig_name,
                                         key, 'dispersion', opts.fig_suffix)
                fig.savefig(fig_name)

            aux = transform_plot_data(bg.logs.eigs,
                                      opts.plot_transform_wave,
                                      self.conf)
            plot_range, teigs = aux

            plot_labels =  opts.plot_labels_wave

            fig = plot_gaps(2, plot_rsc, bg.gaps, bg.kinds, bg.gap_ranges,
                            bg.freq_range_margins, plot_range,
                            clear=True)
            fig = plot_logs(2, plot_rsc, plot_labels, bg.logs.freqs, teigs,
                            bg.valid[bg.eig_range],
                            bg.freq_range_initial,
                            plot_range,
                            show_legend=plot_opts['legend'],
                            new_axes=True)
            plt.tight_layout()

            fig_name = opts.fig_name_wave
            if fig_name is not None:
                fig_name = _get_fig_name(self.problem.output_dir, fig_name,
                                         key, 'dispersion', opts.fig_suffix)
                fig.savefig(fig_name)

        if plot_opts['show']:
            plt.show()