(
    map=None,
    fig=None,
    rot=None,
    zat=None,
    coord=None,
    unit="",
    xsize=800,
    ysize=None,
    reso=1.5,
    lamb=False,
    half_sky=False,
    title=None,
    nest=False,
    remove_dip=False,
    remove_mono=False,
    gal_cut=0,
    min=None,
    max=None,
    flip="astro",
    format="%.3g",
    cbar=True,
    cmap=None,
    badcolor="gray",
    bgcolor="white",
    norm=None,
    aspect=None,
    hold=False,
    sub=None,
    reuse_axes=False,
    margins=None,
    notext=False,
    return_projected_map=False,
    alpha=None,
)
Plot a healpix map (given as an array) in Azimuthal equidistant projection
    or Lambert azimuthal equal-area projection.

    Parameters
    ----------
    map : float, array-like or None
      An array containing the map,
      supports masked maps, see the `ma` function.
      If None, will display a blank map, useful for overplotting.
    fig : int or None, optional
      The figure number to use. Default: create a new figure
    rot : scalar or sequence, optional
      Describe the rotation to apply.
      In the form (lon, lat, psi) (unit: degrees) : the point at
      longitude *lon* and latitude *lat* will be at the center. An additional rotation
      of angle *psi* around this direction is applied.
    coord : sequence of character, optional
      Either one of 'G', 'E' or 'C' to describe the coordinate
      system of the map, or a sequence of 2 of these to rotate
      the map from the first to the second coordinate system.
    unit : str, optional
      A text describing the unit of the data. Default: ''
    xsize : int, optional
      The size of the image. Default: 800
    ysize : None or int, optional
      The size of the image. Default: None= xsize
    reso : float, optional
      Resolution (in arcmin). Default: 1.5 arcmin
    lamb : bool, optional
      If True, plot Lambert azimuthal equal area instead of azimuthal
      equidistant. Default: False (az equidistant)
    half_sky : bool, optional
      Plot only one side of the sphere. Default: False
    title : str, optional
      The title of the plot. Default: 'Azimuthal equidistant view'
      or 'Lambert azimuthal equal-area view' (if lamb is True)
    nest : bool, optional
      If True, ordering scheme is NESTED. Default: False (RING)
    min : float, optional
      The minimum range value
    max : float, optional
      The maximum range value
    flip : {'astro', 'geo'}, optional
      Defines the convention of projection : 'astro' (default, east towards left, west towards right)
      or 'geo' (east towards roght, west towards left)
    remove_dip : bool, optional
      If :const:`True`, remove the dipole+monopole
    remove_mono : bool, optional
      If :const:`True`, remove the monopole
    gal_cut : float, scalar, optional
      Symmetric galactic cut for the dipole/monopole fit.
      Removes points in latitude range [-gal_cut, +gal_cut]
    format : str, optional
      The format of the scale label. Default: '%g'
    cbar : bool, optional
      Display the colorbar. Default: True
    notext : bool, optional
      If True, no text is printed around the map
    norm : {'hist', 'log', None}
      Color normalization, hist= histogram equalized color mapping,
      log= logarithmic color mapping, default: None (linear color mapping)
    cmap : a color map
       The colormap to use (see matplotlib.cm)
    badcolor : str
      Color to use to plot bad values
    bgcolor : str
      Color to use for background
    hold : bool, optional
      If True, replace the current Axes by an Equidistant AzimuthalAxes.
      use this if you want to have multiple maps on the same
      figure. Default: False
    sub : int, scalar or sequence, optional
      Use only a zone of the current figure (same syntax as subplot).
      Default: None
    reuse_axes : bool, optional
      If True, reuse the current Axes (should be a AzimuthalAxes). This is
      useful if you want to overplot with a partially transparent colormap,
      such as for plotting a line integral convolution. Default: False
    margins : None or sequence, optional
      Either None, or a sequence (left,bottom,right,top)
      giving the margins on left,bottom,right and top
      of the axes. Values are relative to figure (0-1).
      Default: None
    return_projected_map : bool
      if True returns the projected map in a 2d numpy array
    alpha : float, array-like or None
      An array containing the alpha channel, supports masked maps, see the `ma` function.
      If None, no transparency will be applied.

    See Also
    --------
    mollview, gnomview, cartview, orthview
Plot a healpix map (given as an array) in Azimuthal equidistant projection
    or Lambert azimuthal equal-area projection.
Plot a healpix map ( given as an array ) in Azimuthal equidistant projection or Lambert azimuthal equal - area projection .
def azeqview(
    map=None,
    fig=None,
    rot=None,
    zat=None,
    coord=None,
    unit="",
    xsize=800,
    ysize=None,
    reso=1.5,
    lamb=False,
    half_sky=False,
    title=None,
    nest=False,
    remove_dip=False,
    remove_mono=False,
    gal_cut=0,
    min=None,
    max=None,
    flip="astro",
    format="%.3g",
    cbar=True,
    cmap=None,
    badcolor="gray",
    bgcolor="white",
    norm=None,
    aspect=None,
    hold=False,
    sub=None,
    reuse_axes=False,
    margins=None,
    notext=False,
    return_projected_map=False,
    alpha=None,
):
    """Plot a healpix map (given as an array) in Azimuthal equidistant projection
    or Lambert azimuthal equal-area projection.

    Parameters
    ----------
    map : float, array-like or None
      An array containing the map,
      supports masked maps, see the `ma` function.
      If None, will display a blank map, useful for overplotting.
    fig : int or None, optional
      The figure number to use. Default: create a new figure
    rot : scalar or sequence, optional
      Describe the rotation to apply.
      In the form (lon, lat, psi) (unit: degrees) : the point at
      longitude *lon* and latitude *lat* will be at the center. An additional rotation
      of angle *psi* around this direction is applied.
    coord : sequence of character, optional
      Either one of 'G', 'E' or 'C' to describe the coordinate
      system of the map, or a sequence of 2 of these to rotate
      the map from the first to the second coordinate system.
    unit : str, optional
      A text describing the unit of the data. Default: ''
    xsize : int, optional
      The size of the image. Default: 800
    ysize : None or int, optional
      The size of the image. Default: None= xsize
    reso : float, optional
      Resolution (in arcmin). Default: 1.5 arcmin
    lamb : bool, optional
      If True, plot Lambert azimuthal equal area instead of azimuthal
      equidistant. Default: False (az equidistant)
    half_sky : bool, optional
      Plot only one side of the sphere. Default: False
    title : str, optional
      The title of the plot. Default: 'Azimuthal equidistant view'
      or 'Lambert azimuthal equal-area view' (if lamb is True)
    nest : bool, optional
      If True, ordering scheme is NESTED. Default: False (RING)
    min : float, optional
      The minimum range value
    max : float, optional
      The maximum range value
    flip : {'astro', 'geo'}, optional
      Defines the convention of projection : 'astro' (default, east towards left, west towards right)
      or 'geo' (east towards roght, west towards left)
    remove_dip : bool, optional
      If :const:`True`, remove the dipole+monopole
    remove_mono : bool, optional
      If :const:`True`, remove the monopole
    gal_cut : float, scalar, optional
      Symmetric galactic cut for the dipole/monopole fit.
      Removes points in latitude range [-gal_cut, +gal_cut]
    format : str, optional
      The format of the scale label. Default: '%g'
    cbar : bool, optional
      Display the colorbar. Default: True
    notext : bool, optional
      If True, no text is printed around the map
    norm : {'hist', 'log', None}
      Color normalization, hist= histogram equalized color mapping,
      log= logarithmic color mapping, default: None (linear color mapping)
    cmap : a color map
       The colormap to use (see matplotlib.cm)
    badcolor : str
      Color to use to plot bad values
    bgcolor : str
      Color to use for background
    hold : bool, optional
      If True, replace the current Axes by an Equidistant AzimuthalAxes.
      use this if you want to have multiple maps on the same
      figure. Default: False
    sub : int, scalar or sequence, optional
      Use only a zone of the current figure (same syntax as subplot).
      Default: None
    reuse_axes : bool, optional
      If True, reuse the current Axes (should be a AzimuthalAxes). This is
      useful if you want to overplot with a partially transparent colormap,
      such as for plotting a line integral convolution. Default: False
    margins : None or sequence, optional
      Either None, or a sequence (left,bottom,right,top)
      giving the margins on left,bottom,right and top
      of the axes. Values are relative to figure (0-1).
      Default: None
    return_projected_map : bool
      if True returns the projected map in a 2d numpy array
    alpha : float, array-like or None
      An array containing the alpha channel, supports masked maps, see the `ma` function.
      If None, no transparency will be applied.

    See Also
    --------
    mollview, gnomview, cartview, orthview
    """
    # Create the figure
    import pylab

    if map is None:
        map = np.zeros(12) + np.inf
        cbar = False

    # Ensure that the nside is valid
    nside = pixelfunc.get_nside(map)
    pixelfunc.check_nside(nside, nest=nest)

    if not (hold or sub or reuse_axes):
        f = pylab.figure(fig, figsize=(8.5, 5.4))
        extent = (0.02, 0.05, 0.96, 0.9)
    elif hold:
        f = pylab.gcf()
        left, bottom, right, top = np.array(f.gca().get_position()).ravel()
        extent = (left, bottom, right - left, top - bottom)
        f.delaxes(f.gca())
    elif reuse_axes:
        f = pylab.gcf()
    else:  # using subplot syntax
        f = pylab.gcf()
        if hasattr(sub, "__len__"):
            nrows, ncols, idx = sub
        else:
            nrows, ncols, idx = sub // 100, (sub % 100) // 10, (sub % 10)
        if idx < 1 or idx > ncols * nrows:
            raise ValueError("Wrong values for sub: %d, %d, %d" % (nrows, ncols, idx))
        c, r = (idx - 1) % ncols, (idx - 1) // ncols
        if not margins:
            margins = (0.01, 0.0, 0.0, 0.02)
        extent = (
            c * 1.0 / ncols + margins[0],
            1.0 - (r + 1) * 1.0 / nrows + margins[1],
            1.0 / ncols - margins[2] - margins[0],
            1.0 / nrows - margins[3] - margins[1],
        )
        extent = (
            extent[0] + margins[0],
            extent[1] + margins[1],
            extent[2] - margins[2] - margins[0],
            extent[3] - margins[3] - margins[1],
        )
        # extent = (c*1./ncols, 1.-(r+1)*1./nrows,1./ncols,1./nrows)
    # f=pylab.figure(fig,figsize=(8.5,5.4))

    # Starting to draw : turn interactive off
    wasinteractive = pylab.isinteractive()
    pylab.ioff()
    try:
        if reuse_axes:
            ax = f.gca()
        else:
            ax = PA.HpxAzimuthalAxes(
                f, extent, coord=coord, rot=rot, format=format, flipconv=flip
            )
            f.add_axes(ax)
        if remove_dip:
            map = pixelfunc.remove_dipole(
                map, gal_cut=gal_cut, nest=nest, copy=True
            )
        elif remove_mono:
            map = pixelfunc.remove_monopole(
                map, gal_cut=gal_cut, nest=nest, copy=True
            )
        img = ax.projmap(
            map,
            nest=nest,
            xsize=xsize,
            ysize=ysize,
            reso=reso,
            lamb=lamb,
            half_sky=half_sky,
            coord=coord,
            vmin=min,
            vmax=max,
            cmap=cmap,
            badcolor=badcolor,
            bgcolor=bgcolor,
            norm=norm,
            alpha=alpha,
        )
        if cbar:
            im = ax.get_images()[0]
            b = im.norm.inverse(np.linspace(0, 1, im.cmap.N + 1))
            v = np.linspace(im.norm.vmin, im.norm.vmax, im.cmap.N)
            mappable = plt.cm.ScalarMappable(
                norm=matplotlib.colors.Normalize(vmin=im.norm.vmin, vmax=im.norm.vmax),
                cmap=cmap,
            )
            if matplotlib.__version__ >= "0.91.0":
                cb = f.colorbar(
                    mappable,
                    ax=ax,
                    orientation="horizontal",
                    shrink=0.5,
                    aspect=25,
                    ticks=PA.BoundaryLocator(),
                    pad=0.05,
                    fraction=0.1,
                    boundaries=b,
                    values=v,
                    format=format,
                )
            else:
                # for older matplotlib versions, no ax kwarg
                cb = f.colorbar(
                    mappable,
                    orientation="horizontal",
                    shrink=0.5,
                    aspect=25,
                    ticks=PA.BoundaryLocator(),
                    pad=0.05,
                    fraction=0.1,
                    boundaries=b,
                    values=v,
                    format=format,
                )
            cb.solids.set_rasterized(True)
        if title is None:
            if lamb:
                title = "Lambert azimuthal equal-area view"
            else:
                title = "Azimuthal equidistant view"
        ax.set_title(title)
        if not notext:
            ax.text(
                0.86,
                0.05,
                ax.proj.coordsysstr,
                fontsize=14,
                fontweight="bold",
                transform=ax.transAxes,
            )
        if cbar:
            cb.ax.text(
                0.5,
                -1.0,
                unit,
                fontsize=14,
                transform=cb.ax.transAxes,
                ha="center",
                va="center",
            )
        f.sca(ax)
    finally:
        pylab.draw()
        if wasinteractive:
            pylab.ion()
            # pylab.show()
    if return_projected_map:
        return img
def azeqview ( map = None , fig = None , rot = None , zat = None , coord = None , unit = "" , xsize = 800 , ysize = None , reso = 1.5 , lamb = False , half_sky = False , title = None , nest = False , remove_dip = False , remove_mono = False , gal_cut = 0 , min = None , max = None , flip = "astro" , format = "%.3g" , cbar = True , cmap = None , badcolor = "gray" , bgcolor = "white" , norm = None , aspect = None , hold = False , sub = None , reuse_axes = False , margins = None , notext = False , return_projected_map = False , alpha = None , ) : # Create the figure import pylab if map is None : map = np . zeros ( 12 ) + np . inf cbar = False # Ensure that the nside is valid nside = pixelfunc . get_nside ( map ) pixelfunc . check_nside ( nside , nest = nest ) if not ( hold or sub or reuse_axes ) : f = pylab . figure ( fig , figsize = ( 8.5 , 5.4 ) ) extent = ( 0.02 , 0.05 , 0.96 , 0.9 ) elif hold : f = pylab . gcf ( ) left , bottom , right , top = np . array ( f . gca ( ) . get_position ( ) ) . ravel ( ) extent = ( left , bottom , right - left , top - bottom ) f . delaxes ( f . gca ( ) ) elif reuse_axes : f = pylab . gcf ( ) else : # using subplot syntax f = pylab . gcf ( ) if hasattr ( sub , "__len__" ) : nrows , ncols , idx = sub else : nrows , ncols , idx = sub // 100 , ( sub % 100 ) // 10 , ( sub % 10 ) if idx < 1 or idx > ncols * nrows : raise ValueError ( "Wrong values for sub: %d, %d, %d" % ( nrows , ncols , idx ) ) c , r = ( idx - 1 ) % ncols , ( idx - 1 ) // ncols if not margins : margins = ( 0.01 , 0.0 , 0.0 , 0.02 ) extent = ( c * 1.0 / ncols + margins [ 0 ] , 1.0 - ( r + 1 ) * 1.0 / nrows + margins [ 1 ] , 1.0 / ncols - margins [ 2 ] - margins [ 0 ] , 1.0 / nrows - margins [ 3 ] - margins [ 1 ] , ) extent = ( extent [ 0 ] + margins [ 0 ] , extent [ 1 ] + margins [ 1 ] , extent [ 2 ] - margins [ 2 ] - margins [ 0 ] , extent [ 3 ] - margins [ 3 ] - margins [ 1 ] , ) # extent = (c*1./ncols, 1.-(r+1)*1./nrows,1./ncols,1./nrows) # f=pylab.figure(fig,figsize=(8.5,5.4)) # Starting to draw : turn interactive off wasinteractive = pylab . isinteractive ( ) pylab . ioff ( ) try : if reuse_axes : ax = f . gca ( ) else : ax = PA . HpxAzimuthalAxes ( f , extent , coord = coord , rot = rot , format = format , flipconv = flip ) f . add_axes ( ax ) if remove_dip : map = pixelfunc . remove_dipole ( map , gal_cut = gal_cut , nest = nest , copy = True ) elif remove_mono : map = pixelfunc . remove_monopole ( map , gal_cut = gal_cut , nest = nest , copy = True ) img = ax . projmap ( map , nest = nest , xsize = xsize , ysize = ysize , reso = reso , lamb = lamb , half_sky = half_sky , coord = coord , vmin = min , vmax = max , cmap = cmap , badcolor = badcolor , bgcolor = bgcolor , norm = norm , alpha = alpha , ) if cbar : im = ax . get_images ( ) [ 0 ] b = im . norm . inverse ( np . linspace ( 0 , 1 , im . cmap . N + 1 ) ) v = np . linspace ( im . norm . vmin , im . norm . vmax , im . cmap . N ) mappable = plt . cm . ScalarMappable ( norm = matplotlib . colors . Normalize ( vmin = im . norm . vmin , vmax = im . norm . vmax ) , cmap = cmap , ) if matplotlib . __version__ >= "0.91.0" : cb = f . colorbar ( mappable , ax = ax , orientation = "horizontal" , shrink = 0.5 , aspect = 25 , ticks = PA . BoundaryLocator ( ) , pad = 0.05 , fraction = 0.1 , boundaries = b , values = v , format = format , ) else : # for older matplotlib versions, no ax kwarg cb = f . colorbar ( mappable , orientation = "horizontal" , shrink = 0.5 , aspect = 25 , ticks = PA . BoundaryLocator ( ) , pad = 0.05 , fraction = 0.1 , boundaries = b , values = v , format = format , ) cb . solids . set_rasterized ( True ) if title is None : if lamb : title = "Lambert azimuthal equal-area view" else : title = "Azimuthal equidistant view" ax . set_title ( title ) if not notext : ax . text ( 0.86 , 0.05 , ax . proj . coordsysstr , fontsize = 14 , fontweight = "bold" , transform = ax . transAxes , ) if cbar : cb . ax . text ( 0.5 , - 1.0 , unit , fontsize = 14 , transform = cb . ax . transAxes , ha = "center" , va = "center" , ) f . sca ( ax ) finally : pylab . draw ( ) if wasinteractive : pylab . ion ( ) # pylab.show() if return_projected_map : return img