@geometry_profiles.transform_grid<EOL><INDENT>@geometry_profiles.move_grid_to_radial_minimum<EOL>def potential_from_grid(self, grid, tabulate_bins=<NUM_LIT:1000>):<DEDENT>
@jit_integrand<EOL>def deflection_integrand(x, kappa_radius, scale_radius, inner_slope):<EOL><INDENT>return (x + kappa_radius / scale_radius) ** (inner_slope - <NUM_LIT:3>) * ((<NUM_LIT:1> - np.sqrt(<NUM_LIT:1> - x ** <NUM_LIT:2>)) / x)<EOL><DEDENT>eta_min, eta_max, minimum_log_eta, maximum_log_eta, bin_size = self.tabulate_integral(grid, tabulate_bins)<EOL>potential_grid = np.zeros(grid.shape[<NUM_LIT:0>])<EOL>deflection_integral = np.zeros((tabulate_bins,))<EOL>for i in range(tabulate_bins):<EOL><INDENT>eta = <NUM_LIT> ** (minimum_log_eta + (i - <NUM_LIT:1>) * bin_size)<EOL>integral =quad(deflection_integrand, a=<NUM_LIT:0.0>, b=<NUM_LIT:1.0>, args=(eta, self.scale_radius, self.inner_slope),<EOL>epsrel=EllipticalGeneralizedNFW.epsrel)[<NUM_LIT:0>]<EOL>deflection_integral[i] = ((eta / self.scale_radius) ** (<NUM_LIT:2> - self.inner_slope)) * (<EOL>(<NUM_LIT:1.0> / (<NUM_LIT:3> - self.inner_slope)) *<EOL>special.hyp2f1(<NUM_LIT:3> - self.inner_slope, <NUM_LIT:3> - self.inner_slope, <NUM_LIT:4> - self.inner_slope,<EOL>- (eta / self.scale_radius)) + integral)<EOL><DEDENT>for i in range(grid.shape[<NUM_LIT:0>]):<EOL><INDENT>potential_grid[i] = (<NUM_LIT> * self.kappa_s * self.axis_ratio) *quad(self.potential_func, a=<NUM_LIT:0.0>, b=<NUM_LIT:1.0>, args=(grid[i, <NUM_LIT:0>], grid[i, <NUM_LIT:1>],<EOL>self.axis_ratio, minimum_log_eta,<EOL>maximum_log_eta, tabulate_bins,<EOL>deflection_integral),<EOL>epsrel=EllipticalGeneralizedNFW.epsrel)[<NUM_LIT:0>]<EOL><DEDENT>return potential_grid<EOL>
Calculate the potential at a given set of arc-second gridded coordinates.

Parameters
----------
grid : grids.RegularGrid
    The grid of (y,x) arc-second coordinates the deflection angles are computed on.
tabulate_bins : int
    The number of bins to tabulate the inner integral of this profile.