summaryrefslogtreecommitdiff
path: root/numpy/random/oldrngstats.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-04 23:32:12 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-04 23:32:12 +0000
commitf1cca04886d4f63f7b1ed5b382986af3a9ee6a61 (patch)
tree053f566b31cb6edc24a41b800ec7f2972c4bca40 /numpy/random/oldrngstats.py
parent8f26568de7cc97ac0dcedfd5061e08bb54770b61 (diff)
downloadnumpy-f1cca04886d4f63f7b1ed5b382986af3a9ee6a61.tar.gz
Many name-changes in oldnumeric. This may break some numpy code that was using the oldnumeric interface.
Diffstat (limited to 'numpy/random/oldrngstats.py')
-rw-r--r--numpy/random/oldrngstats.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/numpy/random/oldrngstats.py b/numpy/random/oldrngstats.py
deleted file mode 100644
index 60248247e..000000000
--- a/numpy/random/oldrngstats.py
+++ /dev/null
@@ -1,35 +0,0 @@
-
-__all__ = ['average', 'histogram', 'standardDeviation', 'variance']
-
-import numpy.oldnumeric as Numeric
-
-def average(data):
- data = Numeric.array(data)
- return Numeric.add.reduce(data)/len(data)
-
-def variance(data):
- data = Numeric.array(data)
- return Numeric.add.reduce((data-average(data))**2)/(len(data)-1)
-
-def standardDeviation(data):
- data = Numeric.array(data)
- return Numeric.sqrt(variance(data))
-
-def histogram(data, nbins, range = None):
- data = Numeric.array(data, Numeric.Float)
- if range is None:
- min = Numeric.minimum.reduce(data)
- max = Numeric.maximum.reduce(data)
- else:
- min, max = range
- data = Numeric.repeat(data,
- Numeric.logical_and(Numeric.less_equal(data, max),
- Numeric.greater_equal(data,
- min)))
- bin_width = (max-min)/nbins
- data = Numeric.floor((data - min)/bin_width).astype(Numeric.Int)
- histo = Numeric.add.reduce(Numeric.equal(
- Numeric.arange(nbins)[:,Numeric.NewAxis], data), -1)
- histo[-1] = histo[-1] + Numeric.add.reduce(Numeric.equal(nbins, data))
- bins = min + bin_width*(Numeric.arange(nbins)+0.5)
- return Numeric.transpose(Numeric.array([bins, histo]))