Say there is a (non-holomorphic) real function $Z(\tau,\bar{\tau})$ which obeys the (non-holomorphic) modularity conditions of some weight $k$ $$Z(\tau+1,\bar{\tau}+1)=Z(\tau,\bar{\tau}),\qquad Z(-1/\tau,-1/\bar{\tau})=|\tau|^kZ(\tau,\bar{\tau})$$ Assuming that $Z$ can be represented as a sum of $N$ holomorphic squares $$Z(\tau,\bar{\tau})=\sum_{i=1}^N|f_i(\tau)|^2$$ can one say somethig about the functions $f_i(\tau)$? Of course they can be modular forms of weight $k/2$, consistent with the transformation properties of $Z$. The question is whether they can be anything else (I think they can't at least for $N=1$)?
The question is not very precise, but I hope it still makes sense. My practical situation is that I have some explicit real functions $Z$ which obey "real modularity", and I know they must be representable as sum of holomorphic squares. But this representation is not evident from the definition of $Z$. My hope was that modular forms could provide a convenient basis make this decomposition.
Afterthoughts.
I now believe that if functions $f_i$ are linearly independent then the action of $S$ and $T$ generators on them must be represented by some linear transformations with possible weight factors. $$f_i(\tau+1)=T_{ij}f_{j}(\tau),\qquad f_i(-1/\tau)=\tau^kS_{ij}f_{j}(\tau)$$ (This follows from an observation that if $\{f_i\}$ and $\{g_i\}$ are holomorphic and linearly independent, and $\sum |f_i(\tau)|^2=\sum |g_i(\tau)|^2$, then there must be a unitary transformation mapping $f_i$ to $g_i$.)
If $T=S=Id$ each $f_i$ is a modular form. The question then is what other representations of $PSL(2,\mathbb{Z})$ can occur, and what are the corresponding functions $f_i$? Alas, I do not know the answer even for $N=1$, namely how to describe the space of holomorphic functions (assuming nice properties at infinity etc) which satisfy $$|f(\tau+1)|=|f(\tau)|,\qquad |f(-1/\tau)|=|\tau^kf(\tau)|$$ I guess that by dividing this by a suitable power of the Dedekind Eta-function one can reduce this to $k=0$ case, and now maybe this is something to look for in a textbook. Anyway, any comments are appreciated.