:param R: projected distance
        :param Rs: scale radius
        :param rho0: central core density
        :param r_core: core radius
540400
def cBurkPot(self, R, Rs, rho0, r_core):

        
        x = R * Rs ** -1
        p = Rs * r_core ** -1
        hx = self._H(x, p)

        return 2 * rho0 * Rs ** 3 * hx
1207013
def _rho02alpha(self, rho0, Rs):

        

        theta_Rs = rho0 * (4 * Rs ** 2 * (1 + np.log(1. / 2.)))
        return theta_Rs
815051
def get_distance_term(self, C, rup, rjb, imt):
        
        h = self._get_h(C, rup.hypo_depth)
        rval = np.sqrt(rjb ** 2. + h ** 2.)
        c3 = self.get_distance_coefficients(C, imt)

        f_r = (C["c1"] + C["c2"] * (rup.mag - self.CONSTANTS["Mref"])) *\
            np.log(rval / self.CONSTANTS["Rref"]) +\
            c3 * (rval - self.CONSTANTS["Rref"])
        return f_r
494598
def nfwParam_physical(self, M, c):
        
        r200 = self.nfw_param.r200_M(M * self.h) / self.h * self.a_z(self.z_lens)  # physical radius r200
        rho0 = self.nfw_param.rho0_c(c) * self.h**2 / self.a_z(self.z_lens)**3 # physical density in M_sun/Mpc**3
        Rs = r200/c
        return rho0, Rs, r200
1166382
def _compute_distance(self, rup, dists, C):
        
        rval = np.sqrt(dists.repi ** 2 + C['h'] ** 2)
        return C['c1'] * np.log10(rval)
1199702
def radialrange(self, origin, return_all_global_extrema=False):
        """"""
        return bezier_radialrange(self, origin,
                return_all_global_extrema=return_all_global_extrema)
132513
def mass_3d(self, r, rho0, gamma):
        
        mass_3d = 4 * np.pi * rho0 /(-gamma + 3) * r ** (-gamma + 3)
        return mass_3d
1269780
def _alpha2rho0(self, theta_Rs, Rs):

        

        rho0 = theta_Rs / (4. * Rs ** 2 * (1. + np.log(1. / 2.)))
        return rho0
1312500
def rho2sigma(self, rho0, Ra, Rs):
        
        return np.pi * rho0 * Ra * Rs / (Rs + Ra)
49317
def _Rforce(self,R,phi=0.,t=0.):
        
        return self._Pot.Rforce(R,0.,t=t,use_physical=False)
365773
def R_r(self, r):
        
        phi = np.random.uniform(0, 2*np.pi)
        theta = np.random.uniform(0, np.pi)
        x = r * np.sin(theta) * np.cos(phi)
        y = r * np.sin(theta) * np.sin(phi)
        R = np.sqrt(x**2 + y**2)
        return R, x, y
1293319
def K(self, r, R, kwargs):
        
        u = r / R
        if np.min(u) < 1:
            raise ValueError("3d radius is smaller than projected radius! Does not make sense.")

        if self._type == 'const_wrong':
            beta = kwargs['beta']
            k = 1./2. * u**(2*beta - 1.) * ((3./2 - beta) * np.sqrt(np.pi) * special.gamma(beta - 1./2)/special.gamma(beta)
                        + beta * self._B(x=1./u**2, a=beta+1./2, b=1./2) - self._B(x=1./u**2, a=beta-1./2, b=1./2))
        elif self._type == 'const':
            beta = kwargs['beta']
            k = np.sqrt(1 - 1./u**2) / (1. - 2*beta) + np.sqrt(np.pi)/2 * special.gamma(beta - 1./2)/special.gamma(beta)\
                * (3./2 - beta) * u**(2*beta - 1.) * (1 - special.betainc(beta+1./2, 1./2, 1./u**2))
        elif self._type == 'isotropic':
            k = np.sqrt(1 - 1./u**2)
        elif self._type == 'radial':
            k = np.pi/4 * u - 1./2 * np.sqrt(1 - 1./u**2) - u/2. * np.arcsin(1./u)
        elif self._type == 'OsipkovMerritt':
            r_ani = kwargs['r_ani']
            ua = r_ani / R
            k = (ua**2 + 1./2) / (ua**2 + 1)**(3./2) * (u**2 + ua**2) / u * np.arctan(np.sqrt((u**2 - 1) / (ua**2 + 1))) \
                - 1./2/(ua**2 + 1) * np.sqrt(1 -1./u**2)
        elif self._type == 'Colin':
            r_ani = kwargs['r_ani']
            ua = r_ani / R
            if ua == 1:
                k = (1 + 1./u) * np.arccosh(u) - 1./6 * (8./u + 7) * np.sqrt((u-1.)/(u+1.))
            else:
                k = 0.5 / (ua**2 - 1) * np.sqrt(1 - 1./u**2) + (1. + ua/u) * np.cosh(u) - np.sign(ua - 1) * ua * \
                            (ua**2 - 0.5) / np.abs(ua**2-1)**(3./2) * (1. + ua/u) * np.arccosh((ua*u + 1)/(u + ua))
        else:
            raise ValueError('anisotropy type %s not supported!' % self._type)
        return k
700889
def ae_core_density(self):
        """"""
        mesh, values, attrib = self._parse_radfunc("ae_core_density")
        return RadialFunction(mesh, values)
1307439
def init_centers_widths(self, R):
        

        kmeans = KMeans(
            init='k-means++',
            n_clusters=self.K,
            n_init=10,
            random_state=100)
        kmeans.fit(R)
        centers = kmeans.cluster_centers_
        widths = self._get_max_sigma(R) * np.ones((self.K, 1))
        return centers, widths
858236
def _set_rho_grids(self):
        
        rho_grids = np.arange(self.rho_bins) * 2 / self.rho_bins - 1 \
            + 1 / self.rho_bins
        rho_weights = np.ones(self.rho_bins) / self.rho_bins
        return rho_grids, rho_weights
572393
def _get_distance_scaling(self, C, dists, mag):
        
        r_h = self._get_rh(C, dists)
        return (C["c1"] + C["c2"] * (mag - self.CONSTANTS["mref"])) *\
            np.log(r_h / self.CONSTANTS["rref"]) +\
            C["c3"] * (r_h - self.CONSTANTS["rref"])
1055601
def rprojs(self):
        
        # TODO: should this be moved to Mesh?  Even though its surely possible
        # to compute without being placed in orbit, projecting in x,y doesn't
        # make much sense without LOS orientation.
        rprojs = np.linalg.norm(self.coords_for_computations[:,:2], axis=1)
        return ComputedColumn(self, rprojs)