Exemple #1
0
    def plot_spectral_error(self, axes, **kwargs):
        spectral_error_kwargs=dict(color='red',alpha=0.5,zorder=1.8)
        spectral_error_kwargs.update(kwargs)

        sp=SpectrumPlotter(axes=axes)
        sp.plot_error(self.results['spectrum'], self.results['spectrum']['covariance_matrix'],
                      autoscale=False, **spectral_error_kwargs)
Exemple #2
0
    def plot_spectral_error(self, axes, **kwargs):
        spectral_error_kwargs = dict(color='red', alpha=0.5, zorder=1.8)
        spectral_error_kwargs.update(kwargs)

        sp = SpectrumPlotter(axes=axes)
        sp.plot_error(self.results['spectrum'],
                      self.results['spectrum']['covariance_matrix'],
                      autoscale=False,
                      **spectral_error_kwargs)
Exemple #3
0
    def plot(
            self,
            filename=None,
            axes=None,
            fignum=None,
            figsize=(5.5, 4.5),
            spectral_kwargs=dict(color='red', zorder=1.9),
            cutoff_kwargs=dict(color='blue', zorder=1.9),
    ):

        if axes is None:
            fig = P.figure(fignum, figsize)
            axes = SpectralAxes(fig=fig,
                                rect=(0.22, 0.15, 0.75, 0.8),
                                flux_units=self.flux_units,
                                energy_units=self.energy_units)
            fig.add_axes(axes)

            axes.set_xlim_units(100 * units.MeV, 10**5.5 * units.MeV)

        # plot sed
        sed = SED(self.sed_4bpd)
        sed.plot_points(axes=axes)

        if self.hypothesis == 'at_pulsar':
            # plot power-law limits
            ul = UpperLimit(self.powerlaw_limit)
            ul.plot(axes=axes, color='orange', zorder=1.9)

        axes.autoscale(False)

        # plot spectral model
        sp = SpectrumPlotter(axes=axes)
        sp.plot(self.spectral_model, **spectral_kwargs)
        sp.plot_error(self.spectral_model, alpha=0.25, **spectral_kwargs)

        if self.hypothesis != 'extended':
            # plot cutoff model
            sp.plot(self.cutoff_model, **cutoff_kwargs)
            sp.plot_error(self.cutoff_model, alpha=0.25, **cutoff_kwargs)

        if self.hypothesis == 'at_pulsar':
            ul = UpperLimit(self.cutoff_limit)
            ul.plot(axes=axes, color='purple', zorder=1.9)

        #if self.code == 'gtlike':
        #    bf = BandFitter(self.bandfits)
        #    bf.plot(axes=axes,
        #            spectral_kwargs=dict(color='green',zorder=1.9),
        #            spectral_error_kwargs=dict(color='green', alpha=0.25))

        if filename is not None:
            P.savefig(expandvars(filename))
        return axes
    def plot(self, filename=None, axes=None,
            fignum=None, figsize=(5.5,4.5),
            spectral_kwargs=dict(color='red', zorder=1.9),
            cutoff_kwargs=dict(color='blue', zorder=1.9),
            ):

        if axes is None:
            fig = P.figure(fignum,figsize)
            axes = SpectralAxes(fig=fig,
                                rect=(0.22,0.15,0.75,0.8),
                                flux_units=self.flux_units,
                                energy_units=self.energy_units)
            fig.add_axes(axes)

            axes.set_xlim_units(100*units.MeV, 10**5.5*units.MeV)
    
        # plot sed
        sed = SED(self.sed_4bpd)
        sed.plot_points(axes=axes)

        if self.hypothesis == 'at_pulsar':
            # plot power-law limits
            ul=UpperLimit(self.powerlaw_limit)
            ul.plot(axes=axes, color='orange', zorder=1.9)

        axes.autoscale(False)

        # plot spectral model
        sp=SpectrumPlotter(axes=axes)
        sp.plot(self.spectral_model, **spectral_kwargs)
        sp.plot_error(self.spectral_model, alpha=0.25, **spectral_kwargs)

        if self.hypothesis != 'extended':
            # plot cutoff model
            sp.plot(self.cutoff_model, **cutoff_kwargs)
            sp.plot_error(self.cutoff_model, alpha=0.25, **cutoff_kwargs)

        if self.hypothesis == 'at_pulsar':
            ul=UpperLimit(self.cutoff_limit)
            ul.plot(axes=axes, color='purple', zorder=1.9)

        #if self.code == 'gtlike':
        #    bf = BandFitter(self.bandfits)
        #    bf.plot(axes=axes, 
        #            spectral_kwargs=dict(color='green',zorder=1.9), 
        #            spectral_error_kwargs=dict(color='green', alpha=0.25))

        if filename is not None:
            P.savefig(expandvars(filename))
        return axes