(
        self, dpar=None, dmer=None, coord=None, local=None, verbose=True, **kwds
    )
return dpar, dmer
Draw a graticule.

        Input:
         - dpar: angular separation between parallels in degree
         - dmer: angular separation between meridians in degree
         - coord: coordinate system of the graticule ('G', 'E' or 'C')
         - local: if True, no rotation performed at all
Draw a graticule.
Draw a graticule .
def graticule(
        self, dpar=None, dmer=None, coord=None, local=None, verbose=True, **kwds
    ):
        """Draw a graticule.

        Input:
         - dpar: angular separation between parallels in degree
         - dmer: angular separation between meridians in degree
         - coord: coordinate system of the graticule ('G', 'E' or 'C')
         - local: if True, no rotation performed at all
        """
        gratargs = (dpar, dmer, coord, local)
        gratkwds = kwds
        if dpar is None:
            dpar = self._gratdef["dpar"]
        if local is None:
            local = self._gratdef["local"]
        if dmer is None:
            dmer = dpar
        dpar = abs(dpar) * dtor
        dmer = abs(dmer) * dtor
        if not local:
            vec = R.dir2vec(self.proj.get_center())
            vec0 = R.Rotator(coord=self.proj.mkcoord(coord=coord)).I(vec)
        else:
            vec = (1, 0, 0)
            vec0 = (1, 0, 0)
        u_pmin, u_pmax = kwds.pop("pmax", None), kwds.pop("pmin", None)
        u_mmin, u_mmax = kwds.pop("mmin", None), kwds.pop("mmax", None)
        if u_pmin:
            u_pmin = (pi / 2.0 - u_pmin * dtor) % pi
        if u_pmax:
            u_pmax = (pi / 2.0 - u_pmax * dtor) % pi
        if u_mmin:
            u_mmin = (((u_mmin + 180.0) % 360) - 180) * dtor
        if u_mmax:
            u_mmax = (((u_mmax + 180.0) % 360) - 180) * dtor
        pmin, pmax = self.get_parallel_interval(vec0)
        mmin, mmax = self.get_meridian_interval(vec0)
        if u_pmin:
            pmin = u_pmin
        if u_pmax:
            pmax = u_pmax
        if u_mmin:
            mmin = u_mmin
        if u_mmax:
            mmax = u_pmax
        log.warning(
            "{0} {1} {2} {3}".format(
                pmin / dtor, pmax / dtor, mmin / dtor, mmax / dtor
            )
        )
        if not kwds.pop("force", False):
            dpar, dmer = self._get_interv_graticule(
                pmin, pmax, dpar, mmin, mmax, dmer
            )
        theta_list = np.around(np.arange(pmin, pmax + 0.5 * dpar, dpar) / dpar) * dpar
        phi_list = np.around(np.arange(mmin, mmax + 0.5 * dmer, dmer) / dmer) * dmer
        theta = np.arange(
            pmin, pmax, min((pmax - pmin) / 100.0, self._segment_step_rad)
        )
        phi = np.arange(mmin, mmax, min((mmax - mmin) / 100.0, self._segment_step_rad))
        equator = False
        gratlines = []
        kwds.setdefault("lw", 1)
        kwds.setdefault("color", "k")
        for t in theta_list:
            if abs(t - pi / 2.0) < 1.0e-10:
                fmt = "-"
                equator = True
            elif abs(t) < 1.0e-10:  # special case: north pole
                t = 1.0e-10
                fmt = "-"
            elif abs(t - pi) < 1.0e-10:  # special case: south pole
                t = pi - 1.0e-10
                fmt = "-"
            else:
                fmt = ":"
            gratlines.append(
                self.projplot(
                    phi * 0.0 + t, phi, fmt, coord=coord, direct=local, **kwds
                )
            )
        if not equator and pmin <= pi / 2.0 and pi / 2 <= pmax:
            gratlines.append(
                self.projplot(
                    phi * 0.0 + pi / 2.0, phi, "-", coord=coord, direct=local, **kwds
                )
            )
        for p in phi_list:
            if abs(p) < 1.0e-10:
                fmt = "-"
            else:
                fmt = ":"
            gratlines.append(
                self.projplot(
                    theta, theta * 0.0 + p, fmt, coord=coord, direct=local, **kwds
                )
            )
        # Now the borders (only useful for full sky projection)
        if hasattr(self, "_do_border") and self._do_border:
            theta = np.arange(0, 181) * dtor
            gratlines.append(
                self.projplot(theta, theta * 0 - pi, "-k", lw=1, direct=True)
            )
            gratlines.append(
                self.projplot(theta, theta * 0 + 0.9999 * pi, "-k", lw=1, direct=True)
            )
            phi = np.arange(-180, 180) * dtor
            gratlines.append(
                self.projplot(phi * 0 + 1.0e-10, phi, "-k", lw=1, direct=True)
            )
            gratlines.append(
                self.projplot(phi * 0 + pi - 1.0e-10, phi, "-k", lw=1, direct=True)
            )
        if hasattr(self, "_graticules"):
            self._graticules.append((gratargs, gratkwds, gratlines))
        else:
            self._graticules = [(gratargs, gratkwds, gratlines)]
        return dpar, dmer
def graticule ( self , dpar = None , dmer = None , coord = None , local = None , verbose = True , * * kwds ) : gratargs = ( dpar , dmer , coord , local ) gratkwds = kwds if dpar is None : dpar = self . _gratdef [ "dpar" ] if local is None : local = self . _gratdef [ "local" ] if dmer is None : dmer = dpar dpar = abs ( dpar ) * dtor dmer = abs ( dmer ) * dtor if not local : vec = R . dir2vec ( self . proj . get_center ( ) ) vec0 = R . Rotator ( coord = self . proj . mkcoord ( coord = coord ) ) . I ( vec ) else : vec = ( 1 , 0 , 0 ) vec0 = ( 1 , 0 , 0 ) u_pmin , u_pmax = kwds . pop ( "pmax" , None ) , kwds . pop ( "pmin" , None ) u_mmin , u_mmax = kwds . pop ( "mmin" , None ) , kwds . pop ( "mmax" , None ) if u_pmin : u_pmin = ( pi / 2.0 - u_pmin * dtor ) % pi if u_pmax : u_pmax = ( pi / 2.0 - u_pmax * dtor ) % pi if u_mmin : u_mmin = ( ( ( u_mmin + 180.0 ) % 360 ) - 180 ) * dtor if u_mmax : u_mmax = ( ( ( u_mmax + 180.0 ) % 360 ) - 180 ) * dtor pmin , pmax = self . get_parallel_interval ( vec0 ) mmin , mmax = self . get_meridian_interval ( vec0 ) if u_pmin : pmin = u_pmin if u_pmax : pmax = u_pmax if u_mmin : mmin = u_mmin if u_mmax : mmax = u_pmax log . warning ( "{0} {1} {2} {3}" . format ( pmin / dtor , pmax / dtor , mmin / dtor , mmax / dtor ) ) if not kwds . pop ( "force" , False ) : dpar , dmer = self . _get_interv_graticule ( pmin , pmax , dpar , mmin , mmax , dmer ) theta_list = np . around ( np . arange ( pmin , pmax + 0.5 * dpar , dpar ) / dpar ) * dpar phi_list = np . around ( np . arange ( mmin , mmax + 0.5 * dmer , dmer ) / dmer ) * dmer theta = np . arange ( pmin , pmax , min ( ( pmax - pmin ) / 100.0 , self . _segment_step_rad ) ) phi = np . arange ( mmin , mmax , min ( ( mmax - mmin ) / 100.0 , self . _segment_step_rad ) ) equator = False gratlines = [ ] kwds . setdefault ( "lw" , 1 ) kwds . setdefault ( "color" , "k" ) for t in theta_list : if abs ( t - pi / 2.0 ) < 1.0e-10 : fmt = "-" equator = True elif abs ( t ) < 1.0e-10 : # special case: north pole t = 1.0e-10 fmt = "-" elif abs ( t - pi ) < 1.0e-10 : # special case: south pole t = pi - 1.0e-10 fmt = "-" else : fmt = ":" gratlines . append ( self . projplot ( phi * 0.0 + t , phi , fmt , coord = coord , direct = local , * * kwds ) ) if not equator and pmin <= pi / 2.0 and pi / 2 <= pmax : gratlines . append ( self . projplot ( phi * 0.0 + pi / 2.0 , phi , "-" , coord = coord , direct = local , * * kwds ) ) for p in phi_list : if abs ( p ) < 1.0e-10 : fmt = "-" else : fmt = ":" gratlines . append ( self . projplot ( theta , theta * 0.0 + p , fmt , coord = coord , direct = local , * * kwds ) ) # Now the borders (only useful for full sky projection) if hasattr ( self , "_do_border" ) and self . _do_border : theta = np . arange ( 0 , 181 ) * dtor gratlines . append ( self . projplot ( theta , theta * 0 - pi , "-k" , lw = 1 , direct = True ) ) gratlines . append ( self . projplot ( theta , theta * 0 + 0.9999 * pi , "-k" , lw = 1 , direct = True ) ) phi = np . arange ( - 180 , 180 ) * dtor gratlines . append ( self . projplot ( phi * 0 + 1.0e-10 , phi , "-k" , lw = 1 , direct = True ) ) gratlines . append ( self . projplot ( phi * 0 + pi - 1.0e-10 , phi , "-k" , lw = 1 , direct = True ) ) if hasattr ( self , "_graticules" ) : self . _graticules . append ( ( gratargs , gratkwds , gratlines ) ) else : self . _graticules = [ ( gratargs , gratkwds , gratlines ) ] return dpar , dmer