def deltasigma_nfw(self):
def _centered_dsigma(self):<EOL><INDENT>firstpart = np.zeros_like(self._x)<EOL>secondpart = np.zeros_like(self._x)<EOL>g = np.zeros_like(self._x)<EOL>small_1a = <NUM_LIT> / self._x[self._x_small]**<NUM_LIT:2><EOL>small_1b = <NUM_LIT> / (self._x[self._x_small]**<NUM_LIT:2> - <NUM_LIT:1.>)<EOL>small_1c = np.sqrt(<NUM_LIT:1.> - self._x[self._x_small]**<NUM_LIT:2>)<EOL>firstpart[self._x_small] = (small_1a + small_1b) / small_1c<EOL>big_1a = <NUM_LIT> / (self._x[self._x_big]**<NUM_LIT:2> *<EOL>np.sqrt(self._x[self._x_big]**<NUM_LIT:2> - <NUM_LIT:1.>))<EOL>big_1b = <NUM_LIT> / ((self._x[self._x_big]**<NUM_LIT:2> - <NUM_LIT:1.>)**<NUM_LIT>)<EOL>firstpart[self._x_big] = big_1a + big_1b<EOL>small_2a = np.sqrt((<NUM_LIT:1.> - self._x[self._x_small]) /<EOL>(<NUM_LIT:1.> + self._x[self._x_small]))<EOL>secondpart[self._x_small] = np.log((<NUM_LIT:1.> + small_2a) /<EOL>(<NUM_LIT:1.> - small_2a))<EOL>big_2a = self._x[self._x_big] - <NUM_LIT:1.><EOL>big_2b = <NUM_LIT:1.> + self._x[self._x_big]<EOL>secondpart[self._x_big] = np.arctan(np.sqrt(big_2a / big_2b))<EOL>both_3a = (<NUM_LIT> / (self._x**<NUM_LIT:2>)) * np.log(self._x / <NUM_LIT>)<EOL>both_3b = <NUM_LIT> / (self._x**<NUM_LIT:2> - <NUM_LIT:1.>)<EOL>g = firstpart * secondpart + both_3a - both_3b<EOL>g[self._x_one] = (<NUM_LIT> / <NUM_LIT>) + <NUM_LIT> * np.log(<NUM_LIT:0.5>)<EOL>if np.isnan(np.sum(g)) or np.isinf(np.sum(g)):<EOL><INDENT>print('<STR_LIT>', g)<EOL><DEDENT>deltasigma = self._rs_dc_rcrit * g<EOL>return deltasigma<EOL><DEDENT>def _offset_dsigma(self):<EOL><INDENT>original_rbins = self._rbins.value<EOL>try:<EOL><INDENT>sigma_sm_rbins = self._sigma_sm<EOL><DEDENT>except AttributeError:<EOL><INDENT>sigma_sm_rbins = self.sigma_nfw()<EOL><DEDENT>innermost_sampling = <NUM_LIT>  <EOL>inner_prec = self._numRinner<EOL>r_inner = np.linspace(innermost_sampling,<EOL>original_rbins.min(),<EOL>endpoint=False, num=inner_prec)<EOL>outer_prec = self._factorRouter * self._nbins<EOL>r_outer = np.linspace(original_rbins.min(),<EOL>original_rbins.max(),<EOL>endpoint=False, num=outer_prec + <NUM_LIT:1>)[<NUM_LIT:1>:]<EOL>r_ext_unordered = np.hstack([r_inner, r_outer, original_rbins])<EOL>r_extended = np.sort(r_ext_unordered)<EOL>self._rbins = r_extended * units.Mpc<EOL>self._nbins = self._rbins.shape[<NUM_LIT:0>]<EOL>_set_dimensionless_radius(self)  <EOL>rs_dc_rcrit = self._rs * self._delta_c * self._rho_crit<EOL>self._rs_dc_rcrit = rs_dc_rcrit.reshape(self._nlens,<EOL><NUM_LIT:1>).repeat(self._nbins, <NUM_LIT:1>)<EOL>sigma_sm_extended = self.sigma_nfw()<EOL>mean_inside_sigma_sm = np.zeros([self._nlens,<EOL>original_rbins.shape[<NUM_LIT:0>]])<EOL>for i, r in enumerate(original_rbins):<EOL><INDENT>index_of_rbin = np.where(r_extended == r)[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>x = r_extended[<NUM_LIT:0>:index_of_rbin + <NUM_LIT:1>]<EOL>y = sigma_sm_extended[:, <NUM_LIT:0>:index_of_rbin + <NUM_LIT:1>] * x<EOL>integral = simps(y, x=x, axis=-<NUM_LIT:1>, even='<STR_LIT>')<EOL>mean_inside_sigma_sm[:, i] = (<NUM_LIT> / r**<NUM_LIT:2>) * integral<EOL><DEDENT>mean_inside_sigma_sm = mean_inside_sigma_sm * (units.Msun /<EOL>units.pc**<NUM_LIT:2>)<EOL>self._rbins = original_rbins * units.Mpc<EOL>self._nbins = self._rbins.shape[<NUM_LIT:0>]<EOL>_set_dimensionless_radius(self)<EOL>rs_dc_rcrit = self._rs * self._delta_c * self._rho_crit<EOL>self._rs_dc_rcrit = rs_dc_rcrit.reshape(self._nlens,<EOL><NUM_LIT:1>).repeat(self._nbins, <NUM_LIT:1>)<EOL>self._sigma_sm = sigma_sm_rbins  <EOL>dsigma_sm = mean_inside_sigma_sm - sigma_sm_rbins<EOL>return dsigma_sm<EOL><DEDENT>if self._sigmaoffset is None:<EOL><INDENT>finaldeltasigma = _centered_dsigma(self)<EOL><DEDENT>elif np.abs(self._sigmaoffset).sum() == <NUM_LIT:0>:<EOL><INDENT>finaldeltasigma = _centered_dsigma(self)<EOL><DEDENT>else:<EOL><INDENT>finaldeltasigma = _offset_dsigma(self)<EOL><DEDENT>return finaldeltasigma<EOL>
Calculate NFW differential surface mass density profile.

        Generate the differential surface mass density profiles of each cluster
        halo, assuming a spherical NFW model. Optionally includes the effect of
        cluster miscentering offsets, if the parent object was initialized
        with offsets.

        Returns
        ----------
        Quantity
            Differential surface mass density profiles (ndarray, in
            astropy.units of Msun/pc/pc). Each row corresponds to a single
            cluster halo.