Permalink
Browse files

DOC: replace add docstring sections "Example" with "Examples".

  • Loading branch information...
1 parent f5ce0d8 commit e8d3333ba12d29012c7b7cb1c8d46623e9803645 @rgommers rgommers committed Feb 19, 2011
@@ -68,7 +68,7 @@ def __init__(self, xi, yi):
is indicated by the repeated zero in the xi array; the corresponding
yi values are 0, the function value, and 2, the derivative value.
- For another example, given xi, yi, and a derivative ypi for each
+ For another example, given xi, yi, and a derivative ypi for each
point, appropriate arrays can be constructed as:
>>> xi_k, yi_k = np.repeat(xi, 2), np.ravel(np.dstack((yi,ypi)))
@@ -180,8 +180,8 @@ def derivatives(self,x,der=None):
the middle dimension will be dropped; if R is 1 then the
last dimension will be dropped.
- Example
- -------
+ Examples
+ --------
>>> KroghInterpolator([0,0,0],[1,2,3]).derivatives(0)
array([1.0,2.0,3.0])
>>> KroghInterpolator([0,0,0],[1,2,3]).derivatives([0,0])
@@ -893,7 +893,7 @@ def _find_derivatives(x, y):
w1 = 2*hk[1:] + hk[:-1]
w2 = hk[1:] + 2*hk[:-1]
whmean = 1.0/(w1+w2)*(w1/mk[1:] + w2/mk[:-1])
-
+
dk = np.zeros_like(y)
dk[1:-1][condition] = 0.0
dk[1:-1][~condition] = 1.0/whmean[~condition]
@@ -904,16 +904,16 @@ def _find_derivatives(x, y):
dk[0] = _edge_case(mk[0],dk[1])
dk[-1] = _edge_case(mk[-1],dk[-2])
return dk
-
+
def pchip(x, y):
- """PCHIP 1-d monotonic cubic interpolation
-
+ """PCHIP 1-d monotonic cubic interpolation
+
Description
-----------
x and y are arrays of values used to approximate some function f:
y = f(x)
- This class factory function returns a callable class whose __call__ method
+ This class factory function returns a callable class whose __call__ method
uses monotonic cubic, interpolation to find the value of new points.
Parameters
@@ -924,10 +924,10 @@ def pchip(x, y):
y : array
A 1-D array of real values. y's length along the interpolation
axis must be equal to the length of x.
-
+
Assumes x is sorted in monotonic order (e.g. x[1] > x[0])
"""
derivs = _find_derivatives(x,y)
return PiecewisePolynomial(x, zip(y, derivs), orders=3, direction=None)
-
+
View
@@ -119,7 +119,7 @@ def maxnomlen(atrv):
-------
slen : int
length of longest component
-
+
Examples
--------
maxnomlen("{floup, bouga, fl, ratata}") returns 6 (the size of
@@ -176,7 +176,7 @@ def tokenize_attribute(iterable, attribute):
Given a raw string attribute, try to get the name and type of the
attribute. Constraints:
-
+
* The first line must start with @attribute (case insensitive, and
space like characters before @attribute are allowed)
* Works also if the attribute is spread on multilines.
@@ -204,7 +204,7 @@ def tokenize_attribute(iterable, attribute):
>>> iterable = iter([0] * 10) # dummy iterator
>>> tokenize_attribute(iterable, r"@attribute floupi real")
('floupi', 'real', 0)
-
+
If attribute is r"'floupi 2' real", will return 'floupi 2' as name,
and real as value.
@@ -397,8 +397,8 @@ class MetaData(object):
Knows about attributes names and types.
- Example
- -------
+ Examples
+ --------
data, meta = loadarff('iris.arff')
# This will print the attributes names of the iris.arff dataset
for i in meta:
@@ -644,7 +644,7 @@ def test_weka(filename):
# make sure nose does not find this as a test
test_weka.__test__ = False
-
+
def floupi(filename):
data, meta = loadarff(filename)
View
@@ -106,13 +106,13 @@
class MatFile5Reader(MatFileReader):
''' Reader for Mat 5 mat files
Adds the following attribute to base class
-
+
uint16_codec - char codec to use for uint16 char arrays
(defaults to system default codec)
Uses variable reader that has the following stardard interface (see
abstract class in ``miobase``::
-
+
__init__(self, file_reader)
read_header(self)
array_from_header(self)
@@ -121,7 +121,7 @@ class MatFile5Reader(MatFileReader):
set_stream(self, stream)
read_full_tag(self)
-
+
'''
@docfiller
def __init__(self,
@@ -188,7 +188,7 @@ def initialize_read(self):
# reader because we use the matrix_reader object to contain
# compressed matrices (so they have their own stream)
self._file_reader = VarReader5(self)
- # reader for matrix streams
+ # reader for matrix streams
self._matrix_reader = VarReader5(self)
def read_var_header(self):
@@ -232,7 +232,7 @@ def read_var_header(self):
raise TypeError('Expecting miMATRIX type here, got %d' % mdtype)
header = self._matrix_reader.read_header()
return header, next_pos
-
+
def read_var_array(self, header, process=True):
''' Read array, given `header`
@@ -242,13 +242,13 @@ def read_var_array(self, header, process=True):
object with fields defining variable header
process : {True, False} bool, optional
If True, apply recursive post-processing during loading of
- array.
-
+ array.
+
Returns
-------
arr : array
array with post-processing applied or not according to
- `process`.
+ `process`.
'''
return self._matrix_reader.array_from_header(header, process)
@@ -333,8 +333,8 @@ def varmats_from_mat(file_obj):
file with something like ``open('test.mat',
'wb').write(var_file_obj.read())``
- Example
- -------
+ Examples
+ --------
>>> import scipy.io
BytesIO is from the ``io`` module in python 3, and is ``cStringIO`` for
@@ -445,7 +445,7 @@ def to_writeable(source):
dtype = []
values = []
for field, value in source.items():
- if (isinstance(field, basestring) and
+ if (isinstance(field, basestring) and
not field[0] in '_0123456789'):
dtype.append((field,object))
values.append(value)
@@ -520,7 +520,7 @@ def write_regular_element(self, arr, mdtype, byte_count):
self.file_stream.write(asbytes('\x00') * (8-bc_mod_8))
def write_header(self,
- shape,
+ shape,
mclass,
is_complex=False,
is_logical=False,
@@ -561,7 +561,7 @@ def write_header(self,
# reset the one-shot store to defaults
self._var_name = ''
self._var_is_global = False
-
+
def update_matrix_tag(self, start_pos):
curr_pos = self.file_stream.tell()
self.file_stream.seek(start_pos)
@@ -571,7 +571,7 @@ def update_matrix_tag(self, start_pos):
def write_top(self, arr, name, is_global):
""" Write variable at top level of mat file
-
+
Parameters
----------
arr : array-like
@@ -588,7 +588,7 @@ def write_top(self, arr, name, is_global):
self._var_name = name
# write the header and data
self.write(arr)
-
+
def write(self, arr):
''' Write `arr` to stream at top and sub levels
@@ -760,7 +760,7 @@ def __init__(self, file_stream,
global_vars=None,
long_field_names=False,
oned_as=None):
- ''' Initialize writer for matlab 5 format files
+ ''' Initialize writer for matlab 5 format files
Parameters
----------
View
@@ -301,8 +301,8 @@ def set_meta(self, **kwds):
""" Update the metadata dictionary with the keywords and data provided
by keywords.
- Example
- -------
+ Examples
+ --------
data.set_meta(lab="Ph 7; Lab 26", title="Ag110 + Ag108 Decay")
"""
@@ -513,8 +513,8 @@ def set_meta(self, **kwds):
""" Update the metadata dictionary with the keywords and data provided
here.
- Example
- -------
+ Examples
+ --------
set_meta(name="Exponential", equation="y = a exp(b x) + c")
"""
@@ -479,8 +479,8 @@ def fixed_point(func, x0, args=(), xtol=1e-8, maxiter=500):
Uses Steffensen's Method using Aitken's Del^2 convergence acceleration.
See Burden, Faires, "Numerical Analysis", 5th edition, pg. 80
- Example
- -------
+ Examples
+ --------
>>> from numpy import sqrt, array
>>> from scipy.optimize import fixed_point
>>> def func(x, c1, c2):
Oops, something went wrong.

0 comments on commit e8d3333

Please sign in to comment.