processing_components/image/operations.py
def show_image(im: Image, fig=None, title: str = '', pol=0, chan=0, cm='Greys', components=None,
               vmin=None, vmax=None, vscale=1.0):
    """ Show an Image with coordinates using matplotlib, optionally with components

    :param im: Image
    :param fig: Matplotlib figure
    :param title:
    :param pol: Polarisation
    :param chan: Channel
    :param components: Optional components
    :param vmin: Clip to this minimum
    :param vmax: Clip to this maximum
    :param vscale: scale max, min by this amount
    :return:
    """
    import matplotlib.pyplot as plt
    
    assert isinstance(im, Image), im

    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection=im.wcs.sub([1,2]))
    
    if len(im.data.shape) == 4:
        data_array = numpy.real(im.data[chan, pol, :, :])
    else:
        data_array = numpy.real(im.data)
        
    if vmax is None:
        vmax = vscale * numpy.max(data_array)
    if vmin is None:
        vmin = vscale * numpy.min(data_array)

    cm = ax.imshow(data_array, origin = 'lower', cmap = cm, vmax=vmax, vmin=vmin)

    ax.set_xlabel(im.wcs.wcs.ctype[0])
    ax.set_ylabel(im.wcs.wcs.ctype[1])
    ax.set_title(title)
    
    fig.colorbar(cm, orientation='vertical', shrink=0.7)
    
    if components is not None:
        for sc in components:
            x, y = skycoord_to_pixel(sc.direction, im.wcs, 0, 'wcs')
            ax.plot(x, y, marker='+', color='red')
            
    return fig
 Show an Image with coordinates using matplotlib, optionally with components

    :param im: Image
    :param fig: Matplotlib figure
    :param title:
    :param pol: Polarisation
    :param chan: Channel
    :param components: Optional components
    :param vmin: Clip to this minimum
    :param vmax: Clip to this maximum
    :param vscale: scale max, min by this amount
    :return:
    
Show an Image with coordinates using matplotlib, optionally with components
Show an Image with coordinates using matplotlib optionally with components
def show_image(im: Image, fig=None, title: str = '', pol=0, chan=0, cm='Greys', components=None,
               vmin=None, vmax=None, vscale=1.0):
    import matplotlib.pyplot as plt
    assert isinstance(im, Image), im
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection=im.wcs.sub([1,2]))
    if len(im.data.shape) == 4:
        data_array = numpy.real(im.data[chan, pol, :, :])
    else:
        data_array = numpy.real(im.data)
    if vmax is None:
        vmax = vscale * numpy.max(data_array)
    if vmin is None:
        vmin = vscale * numpy.min(data_array)
    cm = ax.imshow(data_array, origin = 'lower', cmap = cm, vmax=vmax, vmin=vmin)
    ax.set_xlabel(im.wcs.wcs.ctype[0])
    ax.set_ylabel(im.wcs.wcs.ctype[1])
    ax.set_title(title)
    fig.colorbar(cm, orientation='vertical', shrink=0.7)
    if components is not None:
        for sc in components:
            x, y = skycoord_to_pixel(sc.direction, im.wcs, 0, 'wcs')
            ax.plot(x, y, marker='+', color='red')
    return fig
def show_image ( im : Image , fig = None , title : str = '' , pol = 0 , chan = 0 , cm = 'Greys' , components = None , vmin = None , vmax = None , vscale = 1.0 ) : import matplotlib . pyplot as plt assert isinstance ( im , Image ) , im fig = plt . figure ( ) ax = fig . add_subplot ( 1 , 1 , 1 , projection = im . wcs . sub ( [ 1 , 2 ] ) ) if len ( im . data . shape ) == 4 : data_array = numpy . real ( im . data [ chan , pol , : , : ] ) else : data_array = numpy . real ( im . data ) if vmax is None : vmax = vscale * numpy . max ( data_array ) if vmin is None : vmin = vscale * numpy . min ( data_array ) cm = ax . imshow ( data_array , origin = 'lower' , cmap = cm , vmax = vmax , vmin = vmin ) ax . set_xlabel ( im . wcs . wcs . ctype [ 0 ] ) ax . set_ylabel ( im . wcs . wcs . ctype [ 1 ] ) ax . set_title ( title ) fig . colorbar ( cm , orientation = 'vertical' , shrink = 0.7 ) if components is not None : for sc in components : x , y = skycoord_to_pixel ( sc . direction , im . wcs , 0 , 'wcs' ) ax . plot ( x , y , marker = '+' , color = 'red' ) return fig
Show an Image with coordinates using matplotlib, optionally with components
Show an Image with coordinates using matplotlib optionally with components
""" Show an Image with coordinates using matplotlib, optionally with components

    :param im: Image
    :param fig: Matplotlib figure
    :param title:
    :param pol: Polarisation
    :param chan: Channel
    :param components: Optional components
    :param vmin: Clip to this minimum
    :param vmax: Clip to this maximum
    :param vscale: scale max, min by this amount
    :return:
    """
None
im
Image
None
fig
None
title
str
None
pol
None
chan
None
cm
components
None
vmin
Clip to this minimum
Clip to this minimum
vmax
Clip to this maximum
Clip to this maximum
vscale
scale max, min by this amount
scale max min by this amount