From: Sasha <nd...@ma...> - 2006-01-25 00:56:51
|
You did not import float32. Your options: >>> from numpy import * >>> zeros(5, dtype=3Dfloat32) array([ 0., 0., 0., 0., 0.], dtype=3Dfloat32) or >>> import numpy >>> numpy.zeros(5, dtype=3Dnumpy.float32) array([ 0., 0., 0., 0., 0.], dtype=3Dfloat32) or >>> import numpy >>> numpy.zeros(5, dtype=3Dfloat) array([ 0., 0., 0., 0., 0.]) -- sasha On 1/24/06, ag...@no... <ag...@no...> wrote: > A curious problem (0.9.5.1993): > > n [12]: theta3 =3Dnumpy.zeros(66,dtype=3Dfloat32) > -------------------------------------------------------------------------= -- > exceptions.NameError Traceback (most rece= nt call > last) > > /working/jrd/mod2/agn/OCCAM/AGN_GLOBAL/<ipython console> > > NameError: name 'float32' is not defined > > But > n [14]: theta3 =3Dnumpy.zeros(66,dtype=3D'f') > > In [15]: theta3 > Out[15]: > array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., > 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., = 0.], > dtype=3Dfloat32) > > George Nuresr > > > ----------------------------------------------------------------------- > National Oceanography Centre, Southampton :: http://www.noc.soton.ac.uk > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |