~nipy-developers/nipy/fff2

« back to all changes in this revision

Viewing changes to python/misc/__init__.py

  • Committer: Alexis Roche
  • Date: 2008-04-04 12:04:12 UTC
  • mfrom: (13.1.11 fff2)
  • mto: (13.3.1 fff2)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: alexis.roche@cea.fr-20080404120412-xx76xtdqy9ucacfv
Cythonized "misc" subpackage. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import routines 
2
 
from routines import quantile 
 
1
from routines import * 
3
2
 
4
3
def test(level=1, verbosity=1):
5
4
        from numpy.testing import NumpyTest
6
5
        return NumpyTest().test(level, verbosity)
7
6
 
8
 
def median(x, axis=0):
9
 
        return quantile(x, axis=axis, ratio=0.5, interp=True)
10
7
 
11
 
"""
12
 
For the time being, assume axis=0
13
 
"""
14
 
def mahalanobis(x, vx):
15
 
        dim = x.shape[0]
16
 
        vx_flat = vx.reshape( [dim*dim]+list(vx.shape[2:]) )
17
 
        d2 = routines.mahalanobis(x, vx_flat).reshape(vx.shape[2:])
18
 
        return d2