hyperscreen/hypercore.py
def image(self, masked_x=None, masked_y=None, xlim=None, ylim=None, detcoords=False, title=None, cmap=None, show=True, rasterized=True, savepath=None, create_subplot=False, ax=None, nbins=(400, 400)):
        """Create a quicklook image, in detector or sky coordinates, of the
        observation. The image will be binned to 400x400 by default.

        Keyword Arguments:
            masked_x {[type]} -- [description] (default: {None})
            masked_y {[type]} -- [description] (default: {None})
            xlim {[type]} -- [description] (default: {None})
            ylim {[type]} -- [description] (default: {None})
            detcoords {bool} -- [description] (default: {False})
            title {[type]} -- [description] (default: {None})
            cmap {[type]} -- [description] (default: {None})
            show {bool} -- [description] (default: {True})
            rasterized {bool} -- [description] (default: {True})
            savepath {[type]} -- [description] (default: {None})
            create_subplot {bool} -- [description] (default: {False})
            ax {[type]} -- [description] (default: {None})
        """

        if masked_x is not None and masked_y is not None:
            x = masked_x
            y = masked_y
            img_data, yedges, xedges = np.histogram2d(y, x, nbins)
        else:
            if detcoords is False:
                x = self.data['x'][self.gtimask]
                y = self.data['y'][self.gtimask]
            elif detcoords is True:
                x = self.data['detx'][self.gtimask]
                y = self.data['dety'][self.gtimask]
            img_data, yedges, xedges = np.histogram2d(y, x, nbins)

        extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

        # Create the Figure
        styleplots()

        # You can plot the image on axes of a subplot by passing
        # that axis to this function. Here are some switches to enable that.
        if create_subplot is False:
            self.fig, self.ax = plt.subplots()
        elif create_subplot is True:
            if ax is None:
                self.ax = plt.gca()
            else:
                self.ax = ax

        self.ax.grid(False)

        if cmap is None:
            cmap = 'viridis'

        self.ax.imshow(img_data, extent=extent, norm=LogNorm(),
                       interpolation=None, rasterized=rasterized, cmap=cmap, origin='lower')

        if title is None:
            self.ax.set_title("ObsID {} | {} | {} | {:,} events".format(
                self.obsid, self.target, self.detector, self.goodtimeevents))
        else:
            self.ax.set_title("{}".format(title))
        if detcoords is False:
            self.ax.set_xlabel("Sky X")
            self.ax.set_ylabel("Sky Y")
        elif detcoords is True:
            self.ax.set_xlabel("Detector X")
            self.ax.set_ylabel("Detector Y")

        if xlim is not None:
            self.ax.set_xlim(xlim)
        if ylim is not None:
            self.ax.set_ylim(ylim)

        if show is True:
            plt.show(block=True)

        if savepath is not None:
            plt.savefig('{}'.format(savepath))
            print("Saved image to {}".format(savepath))

        plt.close()
Create a quicklook image, in detector or sky coordinates, of the
        observation. The image will be binned to 400x400 by default.

        Keyword Arguments:
            masked_x {[type]} -- [description] (default: {None})
            masked_y {[type]} -- [description] (default: {None})
            xlim {[type]} -- [description] (default: {None})
            ylim {[type]} -- [description] (default: {None})
            detcoords {bool} -- [description] (default: {False})
            title {[type]} -- [description] (default: {None})
            cmap {[type]} -- [description] (default: {None})
            show {bool} -- [description] (default: {True})
            rasterized {bool} -- [description] (default: {True})
            savepath {[type]} -- [description] (default: {None})
            create_subplot {bool} -- [description] (default: {False})
            ax {[type]} -- [description] (default: {None})
        
Create a quicklook image, in detector or sky coordinates, of the
observation. The image will be binned to 400x400 by default.


Create a quicklook image in detector or sky coordinates of the observation . The image will be binned to 400x400 by default .
def image(self, masked_x=None, masked_y=None, xlim=None, ylim=None, detcoords=False, title=None, cmap=None, show=True, rasterized=True, savepath=None, create_subplot=False, ax=None, nbins=(400, 400)):
        if masked_x is not None and masked_y is not None:
            x = masked_x
            y = masked_y
            img_data, yedges, xedges = np.histogram2d(y, x, nbins)
        else:
            if detcoords is False:
                x = self.data['x'][self.gtimask]
                y = self.data['y'][self.gtimask]
            elif detcoords is True:
                x = self.data['detx'][self.gtimask]
                y = self.data['dety'][self.gtimask]
            img_data, yedges, xedges = np.histogram2d(y, x, nbins)
        extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
        styleplots()
        if create_subplot is False:
            self.fig, self.ax = plt.subplots()
        elif create_subplot is True:
            if ax is None:
                self.ax = plt.gca()
            else:
                self.ax = ax
        self.ax.grid(False)
        if cmap is None:
            cmap = 'viridis'
        self.ax.imshow(img_data, extent=extent, norm=LogNorm(),
                       interpolation=None, rasterized=rasterized, cmap=cmap, origin='lower')
        if title is None:
            self.ax.set_title("ObsID {} | {} | {} | {:,} events".format(
                self.obsid, self.target, self.detector, self.goodtimeevents))
        else:
            self.ax.set_title("{}".format(title))
        if detcoords is False:
            self.ax.set_xlabel("Sky X")
            self.ax.set_ylabel("Sky Y")
        elif detcoords is True:
            self.ax.set_xlabel("Detector X")
            self.ax.set_ylabel("Detector Y")
        if xlim is not None:
            self.ax.set_xlim(xlim)
        if ylim is not None:
            self.ax.set_ylim(ylim)
        if show is True:
            plt.show(block=True)
        if savepath is not None:
            plt.savefig('{}'.format(savepath))
            print("Saved image to {}".format(savepath))
        plt.close()
def image ( self , masked_x = None , masked_y = None , xlim = None , ylim = None , detcoords = False , title = None , cmap = None , show = True , rasterized = True , savepath = None , create_subplot = False , ax = None , nbins = ( 400 , 400 ) ) : if masked_x is not None and masked_y is not None : x = masked_x y = masked_y img_data , yedges , xedges = np . histogram2d ( y , x , nbins ) else : if detcoords is False : x = self . data [ 'x' ] [ self . gtimask ] y = self . data [ 'y' ] [ self . gtimask ] elif detcoords is True : x = self . data [ 'detx' ] [ self . gtimask ] y = self . data [ 'dety' ] [ self . gtimask ] img_data , yedges , xedges = np . histogram2d ( y , x , nbins ) extent = [ xedges [ 0 ] , xedges [ - 1 ] , yedges [ 0 ] , yedges [ - 1 ] ] styleplots ( ) if create_subplot is False : self . fig , self . ax = plt . subplots ( ) elif create_subplot is True : if ax is None : self . ax = plt . gca ( ) else : self . ax = ax self . ax . grid ( False ) if cmap is None : cmap = 'viridis' self . ax . imshow ( img_data , extent = extent , norm = LogNorm ( ) , interpolation = None , rasterized = rasterized , cmap = cmap , origin = 'lower' ) if title is None : self . ax . set_title ( "ObsID {} | {} | {} | {:,} events" . format ( self . obsid , self . target , self . detector , self . goodtimeevents ) ) else : self . ax . set_title ( "{}" . format ( title ) ) if detcoords is False : self . ax . set_xlabel ( "Sky X" ) self . ax . set_ylabel ( "Sky Y" ) elif detcoords is True : self . ax . set_xlabel ( "Detector X" ) self . ax . set_ylabel ( "Detector Y" ) if xlim is not None : self . ax . set_xlim ( xlim ) if ylim is not None : self . ax . set_ylim ( ylim ) if show is True : plt . show ( block = True ) if savepath is not None : plt . savefig ( '{}' . format ( savepath ) ) print ( "Saved image to {}" . format ( savepath ) ) plt . close ( )
Create a quicklook image, in detector or sky coordinates, of the
observation.
Create a quicklook image in detector or sky coordinates of the observation .
"""Create a quicklook image, in detector or sky coordinates, of the
        observation. The image will be binned to 400x400 by default.

        Keyword Arguments:
            masked_x {[type]} -- [description] (default: {None})
            masked_y {[type]} -- [description] (default: {None})
            xlim {[type]} -- [description] (default: {None})
            ylim {[type]} -- [description] (default: {None})
            detcoords {bool} -- [description] (default: {False})
            title {[type]} -- [description] (default: {None})
            cmap {[type]} -- [description] (default: {None})
            show {bool} -- [description] (default: {True})
            rasterized {bool} -- [description] (default: {True})
            savepath {[type]} -- [description] (default: {None})
            create_subplot {bool} -- [description] (default: {False})
            ax {[type]} -- [description] (default: {None})
        """ # Create the Figure # You can plot the image on axes of a subplot by passing # that axis to this function. Here are some switches to enable that.
self
masked_x
masked_y
xlim
ylim
detcoords
title
cmap
show
rasterized
savepath
create_subplot
ax
nbins