I am trying to understand the action of a modular S transformation on a $\vartheta$-function. To do this for the problem I'm considering I first need to understand the following.
Given a $\vartheta$-function, $$ \vartheta\Big[\genfrac{}{}{0pt}{}{\frac{p}{q}}{0} \Big](0|q\,\tau) = \sum_{n\in \mathbb{Z}} e^{i \pi (n + \frac{p}{q})^2 q\,\tau} $$ where $p \in (0,1,\cdots,q-1)$, $q$ is an integer $\geq 1$, and $\tau \in \mathbb{C}$. I want to prove that (up to signs) $$ \vartheta\Big[\genfrac{}{}{0pt}{}{\frac{p}{q}}{0} \Big](0|-\frac{q}{\tau}) = \sqrt{\frac{\tau}{iq}}\sum_{k=0}^{q-1}e^{-2\pi i \frac{k\,p}{q}}\,\vartheta\Big[\genfrac{}{}{0pt}{}{\frac{k}{q}}{0} \Big](0|q\,\tau) $$
Now for $q = 1$, I know how to show this using Poisson summation, but I don't understand where the sum over $k$ comes from when $q>1$. I've looked in the literature on $\vartheta$-functions but I haven't found anything that helps me prove this. All of the results are for $\vartheta$-functions of first order whereas this is a higher order one. This is a specific instance of a modular transformation so it should probably be an established result.
I've asked the same question here: https://math.stackexchange.com/questions/1955899/equality-regarding-vartheta-functions-using-poisson-summation