Ignore:
Timestamp:
Apr 16, 2009, 9:15:06 AM (16 years ago)
Author:
rwilson
Message:

Numeric to numpy conversion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy_misc/tools/pytools/stats.py

    r2017 r6818  
    1010
    1111def mean(x):
    12   import Numeric
     12  import numpy as num
    1313
    14   sum = Numeric.sum(x) 
     14  sum = num.sum(x) 
    1515  avg = float(sum)/len(x)
    1616
     
    1919
    2020def cov(x,y=None):
    21   import Numeric
     21  import numpy as num
    2222  if y is None:
    2323    y = x
     
    2929  cy = y - mean(y) 
    3030
    31   p = Numeric.innerproduct(cx,cy) / N
     31  p = num.inner(cx,cy) / N
    3232
    3333
     
    6565  """
    6666 
    67   import Numeric 
    68   y = Numeric.ravel(x)
    69   p = Numeric.sqrt(Numeric.innerproduct(y,y))
     67  import numpy as num 
     68  y = num.ravel(x)
     69  p = num.sqrt(num.inner(y,y))
    7070  return p
    7171   
Note: See TracChangeset for help on using the changeset viewer.