[Numpy-discussion] Need help for the migration from Numeric to numpy

Frank Thommen structures-it@embl-heidelberg...
Mon Oct 18 06:22:52 CDT 2010


Bruce Southey wrote:
> [...]
>>> It took me a while to track it down, but there used to be a module/file
>>> called 'convertcode.py' for conversion. It was mentioned as tip in
>>> Travis's 'Guide to Numpy'  page 31 in Jan 6 2005 version. But the
>>> alter_code path is in Dec 7 2006 (linked at http://docs.scipy.org/doc/).
>>> It is advisable to read it as it address differences between Numeric and
>>> old numpy ie section 2.6!
>> Thanks for the hint. I'm currently reading through this document. I'm
>> sure this will help a lot.
>>
>> convertcode.py doesn't seem to provided with current numpy releases.
>>
>>
>>> Travis said in the thread:
>>> http://mail.scipy.org/pipermail/numpy-discussion/2006-August/010085.html
>>> "The transition approach is to use the compatibility layer first by
>>> running oldnumeric.alter_code1.py and then running  alter_code2.py which
>>> will take you from the compatibility layer to NumPy  (but alter_code2 is
>>> not completed yet)."
>> My experience is, that these scripts don't work at all (any more).
>>
>>
>> frank
>> 
> Hi,
> Yeah I never had much success with using such codes.
> 
> Anyhow, I have attached the last version of convertcode.py I have (came 
> with numpy 0.9.6). If you want that numpy version as does not seem to be 
> on sourceforge please let me know (the gzipped tar file is about 930K).
> 
> Bruce
> 

Hi,

thanks a lot for digging this out, but `python convertcode.py ./test.py` 
only adds a line '## Automatically adapted for numpy Oct 18, 2010 by 
convertcode.py' on top of the file.  That's all.  All other Numeric code 
in the script (including impoerts) are unchanged.

I think it's the most timesaving and nerve-conserving way to let the 
user change his scripts manually (with the help of Travis's 'Guide to 
Numpy') and providing Numeric in the meantime ;-)

Thanks to all respondents for the hints and links

    frank



More information about the NumPy-Discussion mailing list