[Numpy-discussion] Numpy question
bsouthey at gmail.com
Thu May 26 11:50:18 EDT 2011
On 05/26/2011 10:13 AM, Derek Homeier wrote:
> On 26 May 2011, at 11:17, Talla wrote:
>> Below is the output of the coammands you mentioned.
>> Python 2.6.2 (r262:71600, Jul 7 2009, 20:21:09) [MSC v.1500 32 bit
>> (Intel)] on win3
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import numpy
>> [0 1 2]
>> Which looks to me it is working just fine.
>> so what is the problem though?
> Numpy is working with your Python2.6 and 2.7 installations, but as
> Pauli pointed out,
> the script you want to run instead is using instead a different and
> very ancient Python library,
> Numeric (which in its days occasionally was referred to as "NumPy",
> too, just to add
> confusion ;-).
> This means you could either try to
> - get Python2.4 to work on your machine and hope the Numeric binary
> works with it
> - compile Numeric from source for your Python2.6 or Python2.7
> installation (it actually
> still builds with Python2.7), but this might be challenging for a
> - try to modify your script to work with numpy instead. Numpy provides
> all the functionality
> Numeric has ever offered afaik; its syntax is merely slightly
> different in a few cases.
> You should find some helpful information here:
> (please note the caveats about the automatic converter!)
> It might even be enough to replace the line in the script
> File "AbinitBandStructureMaker.py", line 16, in<module>
> from Numeric import *
> from numpy.oldnumeric import *
> ymmv - if you can contact the maintainer/original author of the
> script, you might ask
> them for assistance - it does not make much sense to rely on a
> software package that
> has not been maintained for half a decade, after all.
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
The source code does not appears to use many Numeric/numpy functions so
it should be easy to convert to numpy. You can probably get away with by
just importing what it needs:
from numpy import array
The 'AbinitStructureViewer.py' is a little more complex because it uses
the old dtype with zeros(). So you will also have to import zeros as
well ('from numpy import array, zeros') *and* change those calls such as:
'zeros(3,Int)' to 'zeros(3,int)'
For more details about converting see:
More information about the NumPy-Discussion