File: scipyx.py

package info (click to toggle)
enthought-traits-ui 2.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 15,204 kB
  • ctags: 9,623
  • sloc: python: 45,547; sh: 32; makefile: 19
file content (37 lines) | stat: -rw-r--r-- 1,135 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
scipyx imports either numpy or Numeric based scipy_base from old scipy.
"""
from numerix import which
_nx,_vx = which
if _nx=='numeric':
    try:
        import sys
        from scipy_base import *
        sys.modules['enthought.util.scipyx.fastumath'] = fastumath
        sys.modules['enthought.util.scipyx.limits'] = limits
        from scipy import polynomial
        from scipy.stats import get_seed
        import scipy
        def set_seed(seed):
            scipy.stats.seed(seed[0], seed[1])
        
    except ImportError:
        print 'No scipy_base. Will assume numpy.'
        _nx='numpy'

elif _nx=='numpy':
    import sys
    from numpy import *
    try:
        from numpy.oldnumeric import *
    except ImportError:
        pass
    from numpy.core import umath as fastumath
    from scipy.misc import limits
    sys.modules['enthought.util.scipyx.fastumath'] = fastumath
    sys.modules['enthought.util.scipyx.limits'] = limits
    from numpy.lib import polynomial
    from numpy.random import get_state as get_seed
    from numpy.random import set_state as set_seed
else:
    print 'Nothing imported to scipyx'