Package qtcm :: Module num_settings
[hide private]
[frames] | no frames]

Module num_settings

source code

Choose and import using numpy, Numeric, or numarray modules.

Sets the following module variables accordingly:

   N    = All numpy/Numeric/numarray functions, usage e.g. 
          N.arange(4).
   MA   = All numpy/Numeric/numarray masked array functions, 
          usage e.g.  MA.masked_array(data).
   MLab = All numpy/Numeric/numarray Matlab compatibility 
          functions, usage e.g. MLab.squeeze(data).  For numpy,
          (it appears) many of these function are in the regular
          core library, so MLab for numpy is just numpy.
   isscalar = Function to emulate numpy's isscalar function.
   typecode = Function to emulate Numeric's typecode() method
          for Numeric objects.
   typecodes = Dictionary, with additions, that builds off of a
          copy of the N.typecodes dictionary.

Thus, by importing using this package you will be able to code
to a generic naming convention, regardless of what array package
is used.  The module tries importing numpy first, then numarray,
and finally Numeric.  The later packages are imported only if
the earlier ones return an ImportError.  Currently, if you have
numpy installed, MA and MLab will not be defined, since aliases
for the numpy versions of those packages have not yet been
programmed into this module.


Version: 0.1.2

Date: September 12, 2008

Author: Johnny Lin

Functions [hide private]
 
typecode(arg)
Return typecode of arg if arg was a numpy array.
source code
 
isscalar(arg) source code
Variables [hide private]
  __credits__ = 'http://www.johnny-lin.com/py_pkgs/qtcm/'
  typecodes = {'All': '?bhilqpBHILQPfdgFDGSUVO', 'AllFloat': 'fd...
Function Details [hide private]

typecode(arg)

source code 
Return typecode of arg if arg was a numpy array.

Input argument:
* arg:  Any argument that can be read converted by numpy into
  an array.


Variables Details [hide private]

typecodes

Value:
{'All': '?bhilqpBHILQPfdgFDGSUVO',
 'AllFloat': 'fdgFDG',
 'AllInteger': 'bBhHiIlLqQpP',
 'Character': 'cS',
 'Complex': 'FDG',
 'Float': 'fdg',
 'Integer': 'bhilqp',
 'UnsignedInteger': 'BHILQP'}