I have something like this:
coefs = [28, -36, 50, -22] print(numpy.roots(coefs))
Of course the result is:
[ 0.35770550+1.117926
You can do it, using iscomplex as follows:
r = numpy.roots(coefs) In [15]: r[~numpy.iscomplex(r)] Out[15]: array([ 0.57030329+0.j])
Also you can use isreal as pointed out in comments:
In [17]: r[numpy.isreal(r)] Out[17]: array([ 0.57030329+0.j])