1
2
3
4
5
6
7
8
9 """MultiVariate Pattern Analysis
10
11
12 Package Organization
13 ====================
14 The mvpa package contains the following subpackages and modules:
15
16 .. packagetree::
17 :style: UML
18
19 :group Algorithms: algorithms
20 :group Anatomical Atlases: atlases
21 :group Basic Data Structures: datasets
22 :group Classifiers (supervised learners): clfs
23 :group Feature Selections: featsel
24 :group Mappers (usually unsupervised learners): mappers
25 :group Measures: measures
26 :group Miscellaneous: base misc support
27 :group Unittests: tests
28
29 :author: `Michael Hanke <michael.hanke@gmail.com>`__,
30 `Yaroslav Halchenko <debian@onerussian.com>`__,
31 `Per B. Sederberg <persed@princeton.edu>`__
32 :requires: Python 2.4+
33 :version: 0.4.8
34 :see: `The PyMVPA webpage <http://www.pymvpa.org>`__
35 :see: `GIT Repository Browser <http://git.debian.org/?p=pkg-exppsy/pymvpa.git;a=summary>`__
36
37 :license: The MIT License <http://www.opensource.org/licenses/mit-license.php>
38 :copyright: |copy| 2006-2010 Michael Hanke <michael.hanke@gmail.com>
39 :copyright: |copy| 2007-2010 Yaroslav O. Halchenko <debian@onerussian.com>
40
41 :newfield contributor: Contributor, Contributors (Alphabetical Order)
42 :contributor: `Emanuele Olivetti <emanuele@relativita.com>`__
43 :contributor: `Per B. Sederberg <persed@princeton.edu>`__
44
45 .. |copy| unicode:: 0xA9 .. copyright sign
46 """
47
48 __docformat__ = 'restructuredtext'
49
50
51 __version__ = '0.4.8'
52
53 import os
54 import random
55 import numpy as N
56 from mvpa.base import cfg
57 from mvpa.base import externals
58 from mvpa.base.info import wtf
59
60
61
62 pymvpa_dataroot = os.path.join(os.path.dirname(__file__), 'data')
63
64 if not __debug__:
65 try:
66 import psyco
67 psyco.profile()
68 except ImportError:
69 from mvpa.base import verbose
70 verbose(2, "Psyco online compilation is not enabled")
71 else:
72
73 from mvpa.base import debug
74
75 debug('INIT', 'mvpa')
76
77 if cfg.has_option('general', 'seed'):
78 _random_seed = cfg.getint('general', 'seed')
79 else:
80 _random_seed = int(N.random.uniform()*(2**31-1))
81
82 -def seed(random_seed):
83 """Uniform and combined seeding of all relevant random number
84 generators.
85 """
86 N.random.seed(random_seed)
87 random.seed(random_seed)
88
89 seed(_random_seed)
90
91
92 from mvpa.tests import run as test
93
94
95
96
97 externals.exists('numpy', force=True, raiseException=True)
98
99
100 externals.exists('scipy', force=True, raiseException=False)
101
102 if __debug__:
103 debug('RANDOM', 'Seeding RNG with %d' % _random_seed)
104 debug('INIT', 'mvpa end')
105
106
107 if cfg.getboolean('debug', 'wtf', default=False):
108 import sys
109 _sys_excepthook = sys.excepthook
111 """Custom exception handler to report also pymvpa's wtf
112
113 Calls original handler, and then collects WTF and spits it out
114 """
115 ret = _sys_excepthook(*args)
116 sys.stdout.write("PyMVPA's WTF: collecting information... hold on...")
117 sys.stdout.flush()
118 wtfs = wtf()
119 sys.stdout.write("\rPyMVPA's WTF: \n")
120 sys.stdout.write(str(wtfs))
121 return ret
122 sys.excepthook = _pymvpa_excepthook
123