Пример #1
0
    def plot(self, show=True, zlabel='Counts/pixel', subplot=(1, 1, 1)):
        """Plot the image.

        This is using aplpy to render the image.

        Warning
        -------
        We have to figure out the subplot issue, here. I put in a horrible
        hack to recover the previous behavior when there's only one
        subplot.
        """
        import aplpy
        with context_no_grids():
            if subplot == (1, 1, 1):
                fig = aplpy.FITSFigure(self.hdu_list[0], figure=plt.figure())
            else:
                fig = aplpy.FITSFigure(self.hdu_list[0],
                                       figure=plt.figure(
                                           0,
                                           figsize=(10 * subplot[1],
                                                    10 * subplot[0])),
                                       subplot=subplot)
        fig.add_grid()
        fig.show_colorscale(cmap='afmhot', vmin=self.vmin, vmax=self.vmax)
        fig.add_colorbar()
        fig.colorbar.set_axis_label_text(zlabel)
        if show:
            plt.show()
        return fig
Пример #2
0
    def plot_polarization_degree(self, show=True):
        """
        """
        import aplpy

        if self.x_img is None:
            self.x_img = xFITSImage(self.xmap_file_path, build_cdf=False)
        if self.y_img is None:
            self.y_img = xFITSImage(self.ymap_file_path, build_cdf=False)
        _data = numpy.sqrt(self.x_data ** 2 + self.y_data ** 2)
        hdu_list = [self.x_img.hdu_list[0].copy()]
        hdu_list[0].data = _data
        with context_no_grids():
            fig = aplpy.FITSFigure(hdu_list[0], figure=plt.figure())
            fig.add_grid()
            fig.show_colorscale(cmap="afmhot", vmin=None, vmax=None)
            fig.add_colorbar()
            fig.colorbar.set_axis_label_text("Polarization degree")
        if show:
            plt.show()
        return fig
Пример #3
0
    def plot(self, show=True, zlabel='Counts/pixel', subplot=(1, 1, 1)):
        """Plot the image.

        This is using aplpy to render the image.

        Warning
        -------
        We have to figure out the subplot issue, here. I put in a horrible
        hack to recover the previous behavior when there's only one
        subplot.
        """
        import aplpy
        with context_no_grids():
            if subplot == (1, 1, 1):
                fig = aplpy.FITSFigure(self.hdu_list[0], figure=plt.figure())
            else:
                fig = aplpy.FITSFigure(self.hdu_list[0], figure=plt.figure(0,figsize=(10*subplot[1], 10*subplot[0])), subplot=subplot)
        fig.add_grid()
        fig.show_colorscale(cmap = 'afmhot', vmin=self.vmin, vmax=self.vmax)
        fig.add_colorbar()
        fig.colorbar.set_axis_label_text(zlabel)
        if show:
            plt.show()
        return fig