numpy.numarray.alter_code1
index
/usr/lib/python2.6/dist-packages/numpy/numarray/alter_code1.py

This module converts code written for numarray to run with numpy
 
Makes the following changes:
 * Changes import statements
 
   import numarray.package
       --> import numpy.numarray.package as numarray_package
           with all numarray.package in code changed to numarray_package
 
   import numarray --> import numpy.numarray as numarray
   import numarray.package as <yyy> --> import numpy.numarray.package as <yyy>
 
   from numarray import <xxx> --> from numpy.numarray import <xxx>
   from numarray.package import <xxx>
       --> from numpy.numarray.package import <xxx>
 
   package can be convolve, image, nd_image, mlab, linear_algebra, ma,
                  matrix, fft, random_array
 
 
 * Makes search and replace changes to:
   - .imaginary --> .imag
   - .flat --> .ravel() (most of the time)
   - .byteswapped() --> .byteswap(False)
   - .byteswap() --> .byteswap(True)
   - .info() --> numarray.info(self)
   - .isaligned() --> .flags.aligned
   - .isbyteswapped() --> (not .dtype.isnative)
   - .typecode() --> .dtype.char
   - .iscontiguous() --> .flags.contiguous
   - .is_c_array() --> .flags.carray and .dtype.isnative
   - .is_fortran_contiguous() --> .flags.fortran
   - .is_f_array() --> .dtype.isnative and .flags.farray
   - .itemsize() --> .itemsize
   - .nelements() --> .size
   - new(type) --> numarray.newobj(self, type)
   - .repeat(r) --> .repeat(r, axis=0)
   - .size() --> .size
   - type() -- numarray.typefrom(self)
   - .typecode() --> .dtype.char
   - .stddev() --> .std()
   - .togglebyteorder() --> numarray.togglebyteorder(self)
   - .getshape() --> .shape
   - .setshape(obj) --> .shape=obj
   - .getflat() --> .ravel()
   - .getreal() --> .real
   - .setreal() --> .real =
   - .getimag() --> .imag
   - .setimag() --> .imag =
   - .getimaginary() --> .imag
   - .setimaginary() --> .imag

 
Modules
       
datetime
glob
os
re
sys

 
Functions
       
_func(arg, dirname, fnames)
addimport(astr)
changeimports(fstr, name, newname)
convertall(direc='.', orig=1)
Convert all .py files to use numpy.oldnumeric (from Numeric) in the directory given
 
For each file, a backup of <usesnumeric>.py is made as
<usesnumeric>.py.orig.  A new file named <usesnumeric>.py
is then written with the updated code.
convertfile(filename, orig=1)
Convert the filename given from using Numarray to using NumPy
 
Copies the file to filename.orig and then over-writes the file
with the updated code
convertsrc(direc='.', ext=None, orig=1)
Replace Numeric/arrayobject.h with numpy/oldnumeric.h in all files in the
directory with extension give by list ext (if ext is None, then all files are
replaced).
converttree(direc='.')
Convert all .py files in the tree given
fromargs(args)
fromstr(filestr)
makenewfile(name, filestr)
replaceattr(astr)
replaceother(astr)

 
Data
        __all__ = ['convertfile', 'convertall', 'converttree', 'convertsrc']
__file__ = '/usr/lib/python2.6/dist-packages/numpy/numarray/alter_code1.pyc'
__name__ = 'numpy.numarray.alter_code1'
__package__ = 'numpy.numarray'
flatindex_re = <_sre.SRE_Pattern object at 0x70bb730>
header_re = <_sre.SRE_Pattern object at 0x710d050>
info_re = <_sre.SRE_Pattern object at 0x7100330>
isbyte_re = <_sre.SRE_Pattern object at 0x710acc0>
iscarr_re = <_sre.SRE_Pattern object at 0x7101710>
isfarr_re = <_sre.SRE_Pattern object at 0x710b280>
new_re = <_sre.SRE_Pattern object at 0x7101950>
repeat_re = <_sre.SRE_Pattern object at 0x710b9e0>
setimag_re = <_sre.SRE_Pattern object at 0x710cc70>
setimaginary_re = <_sre.SRE_Pattern object at 0x710ca30>
setreal_re = <_sre.SRE_Pattern object at 0x70ffed0>
setshape_re = <_sre.SRE_Pattern object at 0x710b7a0>
toggle_re = <_sre.SRE_Pattern object at 0x7101b30>
type_re = <_sre.SRE_Pattern object at 0x710ab30>