Let $f,g:[0,2\pi]\to\mathbb{C}$ be two trigonometric polynomials of degree $n$, so that $$ f(\theta) = \sum_{j=0}^n f_j e^{ij\theta} $$ and $$ g(\theta) = \sum_{j=0}^n g_j e^{ij\theta}. $$
Suppose that $|f(\theta)|=|g(\theta)|$ for all $\theta\in[0,2\pi]$ and that moreover the coefficients satisfy $|f_j|=|g_j|$ for all $0\leq j\leq n$.
Is it the case that $f(\theta)=e^{i\varphi} g(\theta)$ for some constant phase $\varphi$?
I know that when one restricts to infinite Fourier series this is not the case, but I am curious if the situation is different for functions with finite Fourier series.
The result fails for $f(\theta)=1+2e^{i\theta}-e^{2i\theta}, g(\theta)=-1+2e^{i\theta}+e^{2i\theta}$ as clearly $f \ne cg$ for any constant $c$ but $|f(\theta)|=|\bar f(\theta)|=|1+2e^{-i\theta}-e^{-2i\theta}|=|e^{-2i\theta} g(\theta)|$ so $|f(\theta)|=|g(\theta)|$ and the coefficients have same absolute value respectively.
Edit later: Note that one should be able to characterize all pairs of polynomials (of the same degree - though that is kind of immaterial as we can always put a $z^k$) for which $|P(z)|=|Q(z)|, |z|=1$ using the fact that $|1-\bar \alpha e^{i \theta}|=|e^{i\theta}-\alpha|, |\alpha|<1$ and that if $P,Q$ have no roots in the open unit disc (and $|P(z)|=|Q(z)|, |z|=1$ ) then $P=cQ$ for some $|c| =1$ as if one replaces all the unit disc root factors $z-\alpha$ of $P, Q$ respectively by the factors $1-\bar \alpha z$, preserving the degree and the modulus values on the unit circle, one gets eventually to some $P_1=cQ_1$ so the (nonzero) roots of $P,Q$ that are not equal, must occur in pairs $\alpha, 1/\bar \alpha$, one root of $P$ and one root of $Q$ respectively