I'm trying to do an integral of the form $\int_C f(u,v) $, where $C$ is a set of contours in $u$ and $v$. In particular, each variable's contour starts at $-\infty+i \epsilon$, goes around a branch cut at $-2g$ (where $g$ is a parameter of the problem), then goes below the real line and out to $-\infty-i \epsilon$ before circling around to $\infty-i \epsilon$, coming back around a branch cut at $2g$ and ending up at $\infty+i \epsilon$. If this description is a bit unclear, there's a drawing of the contour in Figure 5 of this paper.
$f(u,v)$ has poles when $u=v-2i$ and when $v=u-2i$. While the paper suggests integrating above the real axis and replacing the integration below the real axis with analytic residues around these poles, that method isn't feasible for the case I'm working on. Instead, I'm trying to integrate along this contour numerically.
The problem I'm having is that when I try to approximate the (infinite) contour with a finite one, I inevitably end up with a contour that crosses the poles, since the poles in each variable depend on the other one.
I suspect that there's a smarter way to approach all of this, but I can't find much literature on taking residues numerically at all, let alone anything applicable to this particular situation. Any recommendations would be appreciated!
Edit: One thing that I should clarify, I need to have fixed contours in $u$ and $v$, neither can depend on the other. If I had a different $v$ contour for each value of $u$ then taking the $v$ residues analytically would be faster, and I'm trying to get a speedup over doing that.