code: def deflections_from_grid(self, grid):
          
          factor = 2.0 * self.einstein_radius_rescaled * self.axis_ratio / np.sqrt(1 - self.axis_ratio ** 2)
  
          psi = np.sqrt(np.add(np.multiply(self.axis_ratio ** 2, np.square(grid[:, 1])), np.square(grid[:, 0])))
  
          deflection_y = np.arctanh(np.divide(np.multiply(np.sqrt(1 - self.axis_ratio ** 2), grid[:, 0]), psi))
          deflection_x = np.arctan(np.divide(np.multiply(np.sqrt(1 - self.axis_ratio ** 2), grid[:, 1]), psi))
          return self.rotate_grid_from_profile(np.multiply(factor, np.vstack((deflection_y, deflection_x)).T))
docs: Calculate the deflection angles at a given set of arc-second gridded coordinates.
  
          For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, \
          coordinates at (0.0, 0.0) are shifted slightly to (1.0e-8, 1.0e-8).
  
          Parameters
          ----------
          grid : grids.RegularGrid
              The grid of (y,x) arc-second coordinates the deflection angles are computed on.