Package mvpa
[hide private]
[frames] | no frames]

Source Code for Package mvpa

  1  # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 
  2  # vi: set ft=python sts=4 ts=4 sw=4 et: 
  3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
  4  # 
  5  #   See COPYING file distributed along with the PyMVPA package for the 
  6  #   copyright and license terms. 
  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.1 
 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-2009 Michael Hanke <michael.hanke@gmail.com> 
 39  :copyright: |copy| 2007-2009 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  # canonical PyMVPA version string 
 51  __version__ = '0.4.2' 
 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   
 59  # locate data root -- data might not be installed, but if it is, it should be at 
 60  # this location 
 61  pymvpa_dataroot = os.path.join(os.path.dirname(__file__), 'data') 
 62   
 63  if not __debug__: 
 64      try: 
 65          import psyco 
 66          psyco.profile() 
 67      except ImportError: 
 68          from mvpa.base import verbose 
 69          verbose(2, "Psyco online compilation is not enabled") 
 70  else: 
 71      # Controllable seeding of random number generator 
 72      from mvpa.base import debug 
 73   
 74      debug('INIT', 'mvpa') 
 75   
 76  if cfg.has_option('general', 'seed'): 
 77      _random_seed = cfg.getint('general', 'seed') 
 78  else: 
 79      _random_seed = int(N.random.uniform()*(2**31-1)) 
 80   
81 -def seed(random_seed):
82 """Uniform and combined seeding of all relevant random number 83 generators. 84 """ 85 N.random.seed(random_seed) 86 random.seed(random_seed)
87 88 seed(_random_seed) 89 90 # import the main unittest interface 91 from mvpa.tests import run as test 92 93 # PyMVPA is useless without numpy 94 # Also, this check enforcing population of externals.versions 95 # for possible later version checks, hence don't remove 96 externals.exists('numpy', force=True, raiseException=True) 97 # We might need to suppress the warnings so enforcing check here, 98 # it is ok if it would fail 99 externals.exists('scipy', force=True, raiseException=False) 100 101 if __debug__: 102 debug('RANDOM', 'Seeding RNG with %d' % _random_seed) 103 debug('INIT', 'mvpa end') 104