Effective detection of CM modular forms Say $f$ is a newform of weight $k$ and level $\Gamma_1(N)$. $f$ is called CM if, for example, there is an imaginary quadratic field $K$ such that for all $p\nmid N$ which are inert in $K$, the $p$th Fourier coefficient $a_p$ of $f$ is 0. (Ribet's article Galois representations attached to eigenforms with Nebentypus is a nice reference for this material). Specific examples include the newforms attached to CM elliptic curves. All examples arise as inductions of algebraic Hecke characters of $K$ of type $(k-1,0)$.
Is there an effective bound in terms of $k$ and $N$ (or other basic invariants of $f$) on how many $a_p$ you have to check to know whether or not $f$ is CM? Or, is there an effective bound on the discriminant of the associated $K$ and the conductor of the associated algebraic Hecke character? What if we assume GRH?
A related question was asked here by Mike Bennett, but no answer has been given.
My motivation is simply to be able to computationally check if a given newform is CM using, say, SAGE. Thanks.
 A: If the form is CM then it will be isomorphic to a quadratic twist of itself. So I think what I'd do with a form which I suspect is or is not CM is to just twist by all the (finitely many ) possible quadratic characters that could be involved and then to check to see if $f$ is the same as its twist, which one can do by proving that the difference is zero using the standard bound (1+degree of $\omega^k$ on the modular curve).
A: Given a modular form with CM type vanishing behavior of its coefficients $a_p$ (as described in Ribet) it is often not difficult to find a Hecke character whose L-series agrees with those of your given form. Sturm's bound in terms of the weight $k$ and the level $N$ then tells you how many terms you have to consider in order to ensure that the two forms are the same. (See Sturm 1987, On the congruence of modular forms.) 
A: What is actually meant by "If the form is CM then it will be isomorphic to a quadratic twist of itself." (K. Buzzard)?
Because if this should really mean (and the rest of the answer sounds like that) that the form is equal to it's twist then I have the impression that this is not correct. If the conductor $M$ of the character $\chi$ divides the level $N$ of $f$, then a coefficient $a_p$ of $f$ with $p \mid M$ might be non-zero according to Ribet's definition. But after the twist this will be $0$.
I think there are also easy counter-examples. For instance take the unique normalized cusp-form for $\Gamma_0(7)$ and character $\left( \frac{-7}{\cdot} \right)$ the Kronecker character. This form is constructed from a hecke character of $Q(\sqrt{-7})$, as far as I can see.
And $a_n = 0$ if $\left( \frac{-7}{n} \right) = -1$. But $a_7 \neq 0$.
What am I missing?
