Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Refactor private modules #7

Merged
merged 16 commits into from

2 participants

@rgommers
Owner

These should all be straightforward cleanups, with the possible exception of numpy functions exposed in scipy.special (arccos/arccosh & friends). Should those stay in the special namespace?

@WarrenWeckesser

Delete the duplicate definition of all in line 1.

@WarrenWeckesser
Collaborator

Remove the duplicate 'all' in line 1 of wavelets.py.

@WarrenWeckesser

'extract' and 'sometrue' are imported from numpy. I don't think they need to be exposed.

'orthogonal' and 'specfun' are modules in this package, and they are already exposed in init, so I don't think they need to be in all here.

@WarrenWeckesser

Shouldn't the function 'report_error' also be included in all?

Owner

It wasn't exposed before, and I don't see a good reason why it should be. The input for it is already translated by it in the Output class. I think a better change is to prepend an underscore to report _error.

Collaborator

OK, sounds good.

@WarrenWeckesser

I don't think 'warnings' should be here. There is code at the beginning of the file that tries to import warnings, and handles the case where that fails. That suggests this is pre-python 2.1 code, so 'warnings' was certainly never intended to be part of the public API.

@WarrenWeckesser
Collaborator

I've added several line notes to the commits. Other than those small suggestions, this looks good.

@rgommers
Owner

Thanks for reviewing Warren. I think I'll just push this, better now than just before a release.

@WarrenWeckesser
Collaborator

Go for it. Thanks for doing the hard part!

@rgommers rgommers merged commit 8673985 into scipy:master
@rgommers
Owner

Merged.

@jnothman jnothman referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@jnothman jnothman referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2011
  1. @rgommers

    ENH: add __all__ dicts to kdtree and ckdtree in spatial.

    rgommers authored
    This cleans up the spatial namespace quite a bit.
  2. @rgommers
  3. @rgommers
  4. @rgommers
  5. @rgommers
  6. @rgommers

    STY: Add __all__ dicts to scipy.optimize modules.

    rgommers authored
    This did not reduce the number of exposed functions, add them anyway for
    consistency.
  7. @rgommers
  8. @rgommers
  9. @rgommers
  10. @rgommers
  11. @rgommers
  12. @rgommers
  13. @rgommers
  14. @rgommers
  15. @rgommers
Commits on May 23, 2011
  1. @rgommers
This page is out of date. Refresh to see the latest.
Showing with 346 additions and 183 deletions.
  1. +9 −0 scipy/cluster/hierarchy.py
  2. +17 −17 scipy/constants/constants.py
  3. +3 −1 scipy/integrate/quadpack.py
  4. +6 −4 scipy/interpolate/rbf.py
  5. +1 −2  scipy/io/__init__.py
  6. +3 −0  scipy/io/matlab/__init__.py
  7. +2 −0  scipy/linalg/decomp_lu.py
  8. +3 −0  scipy/linalg/decomp_qr.py
  9. +2 −0  scipy/linalg/decomp_svd.py
  10. +7 −3 scipy/linalg/special_matrices.py
  11. +2 −1  scipy/misc/__init__.py
  12. +4 −0 scipy/misc/doccer.py
  13. +1 −6 scipy/ndimage/__init__.py
  14. +10 −0 scipy/ndimage/filters.py
  15. +4 −0 scipy/ndimage/fourier.py
  16. +4 −0 scipy/ndimage/interpolation.py
  17. +7 −1 scipy/ndimage/measurements.py
  18. +8 −0 scipy/ndimage/morphology.py
  19. +3 −12 scipy/odr/__init__.py
  20. +3 −2 scipy/odr/models.py
  21. +6 −4 scipy/odr/odrpack.py
  22. +4 −0 scipy/optimize/cobyla.py
  23. +3 −0  scipy/optimize/lbfgsb.py
  24. +3 −0  scipy/optimize/nnls.py
  25. +4 −1 scipy/optimize/tnc.py
  26. +2 −0  scipy/signal/bsplines.py
  27. +13 −5 scipy/signal/filter_design.py
  28. +4 −0 scipy/signal/fir_filter_design.py
  29. +3 −0  scipy/signal/ltisys.py
  30. +7 −0 scipy/signal/signaltools.py
  31. +80 −62 scipy/signal/spectral.c
  32. +3 −0  scipy/signal/spectral.pyx
  33. +3 −0  scipy/signal/waveforms.py
  34. +3 −2 scipy/signal/wavelets.py
  35. +5 −0 scipy/signal/windows.py
  36. +3 −2 scipy/sparse/linalg/eigen/arpack/arpack.py
  37. +20 −2 scipy/spatial/ckdtree.c
  38. +1 −1  scipy/spatial/ckdtree.pyx
  39. +5 −0 scipy/spatial/kdtree.py
  40. +0 −1  scipy/special/__init__.py
  41. +17 −0 scipy/special/basic.py
  42. +3 −0  scipy/special/spfun_stats.py
  43. +2 −1  scipy/special/tests/test_data.py
  44. +52 −51 scipy/stats/distributions.py
  45. +1 −2  scipy/stats/kde.py
View
9 scipy/cluster/hierarchy.py
@@ -171,6 +171,15 @@
_cpy_linkage_methods = set(_cpy_non_euclid_methods.keys()).union(
set(_cpy_euclid_methods.keys()))
+__all__ = ['ClusterNode', 'average', 'centroid', 'complete', 'cophenet',
+ 'correspond', 'dendrogram', 'fcluster', 'fclusterdata',
+ 'from_mlab_linkage', 'inconsistent', 'is_isomorphic',
+ 'is_monotonic', 'is_valid_im', 'is_valid_linkage', 'leaders',
+ 'leaves_list', 'linkage', 'maxRstat', 'maxdists', 'maxinconsts',
+ 'median', 'num_obs_linkage', 'set_link_color_palette', 'single',
+ 'to_mlab_linkage', 'to_tree', 'ward', 'weighted', 'distance']
+
+
try:
import warnings
def _warning(s):
View
34 scipy/constants/constants.py
@@ -18,7 +18,7 @@
import math as _math
from codata import value as _cd
-import numpy as np
+import numpy as _np
#mathematical constants
pi = _math.pi
@@ -193,11 +193,11 @@ def C2K(C):
Examples
--------
>>> from scipy.constants.constants import C2K
- >>> C2K(np.array([-40, 40.0]))
+ >>> C2K(_np.array([-40, 40.0]))
array([ 233.15, 313.15])
"""
- return np.asanyarray(C) + zero_Celsius
+ return _np.asanyarray(C) + zero_Celsius
def K2C(K):
"""
@@ -221,11 +221,11 @@ def K2C(K):
Examples
--------
>>> from scipy.constants.constants import K2C
- >>> K2C(np.array([233.15, 313.15]))
+ >>> K2C(_np.array([233.15, 313.15]))
array([-40., 40.])
"""
- return np.asanyarray(K) - zero_Celsius
+ return _np.asanyarray(K) - zero_Celsius
def F2C(F):
"""
@@ -248,11 +248,11 @@ def F2C(F):
Examples
--------
>>> from scipy.constants.constants import F2C
- >>> F2C(np.array([-40, 40.0]))
+ >>> F2C(_np.array([-40, 40.0]))
array([-40. , 4.44444444])
"""
- return (np.asanyarray(F) - 32) / 1.8
+ return (_np.asanyarray(F) - 32) / 1.8
def C2F(C):
"""
@@ -275,11 +275,11 @@ def C2F(C):
Examples
--------
>>> from scipy.constants.constants import C2F
- >>> C2F(np.array([-40, 40.0]))
+ >>> C2F(_np.array([-40, 40.0]))
array([ -40., 104.])
"""
- return 1.8 * np.asanyarray(C) + 32
+ return 1.8 * _np.asanyarray(C) + 32
def F2K(F):
"""
@@ -304,11 +304,11 @@ def F2K(F):
Examples
--------
>>> from scipy.constants.constants import F2K
- >>> F2K(np.array([-40, 104]))
+ >>> F2K(_np.array([-40, 104]))
array([ 233.15, 313.15])
"""
- return C2K(F2C(np.asanyarray(F)))
+ return C2K(F2C(_np.asanyarray(F)))
def K2F(K):
"""
@@ -333,11 +333,11 @@ def K2F(K):
Examples
--------
>>> from scipy.constants.constants import K2F
- >>> K2F(np.array([233.15, 313.15]))
+ >>> K2F(_np.array([233.15, 313.15]))
array([ -40., 104.])
"""
- return C2F(K2C(np.asanyarray(K)))
+ return C2F(K2C(_np.asanyarray(K)))
#optics
@@ -363,11 +363,11 @@ def lambda2nu(lambda_):
Examples
--------
>>> from scipy.constants.constants import lambda2nu
- >>> lambda2nu(np.array((1, speed_of_light)))
+ >>> lambda2nu(_np.array((1, speed_of_light)))
array([ 2.99792458e+08, 1.00000000e+00])
"""
- return np.asanyarray(c) / lambda_
+ return _np.asanyarray(c) / lambda_
def nu2lambda(nu):
"""
@@ -391,9 +391,9 @@ def nu2lambda(nu):
Examples
--------
>>> from scipy.constants.constants import nu2lambda
- >>> nu2lambda(np.array((1, speed_of_light)))
+ >>> nu2lambda(_np.array((1, speed_of_light)))
array([ 2.99792458e+08, 1.00000000e+00])
"""
- return c / np.asanyarray(nu)
+ return c / _np.asanyarray(nu)
View
4 scipy/integrate/quadpack.py
@@ -1,11 +1,13 @@
# Author: Travis Oliphant 2001
-__all__ = ['quad', 'dblquad', 'tplquad', 'quad_explain', 'Inf','inf']
import _quadpack
import sys
import numpy
from numpy import inf, Inf
+__all__ = ['quad', 'dblquad', 'tplquad', 'quad_explain']
+
+
error = _quadpack.error
def quad_explain(output=sys.stdout):
View
10 scipy/interpolate/rbf.py
@@ -47,6 +47,8 @@
float_)
from scipy import linalg
+__all__ = ['Rbf']
+
class Rbf(object):
"""
@@ -129,7 +131,7 @@ def _init_function(self, r):
self.function = self.function.lower()
_mapped = {'inverse': 'inverse_multiquadric',
'inverse multiquadric': 'inverse_multiquadric',
- 'thin-plate': 'thin_plate'}
+ 'thin-plate': 'thin_plate'}
if self.function in _mapped:
self.function = _mapped[self.function]
@@ -166,7 +168,7 @@ def _init_function(self, r):
Rbf)
else:
raise ValueError("Function argument must take 1 or 2 arguments.")
-
+
a0 = self._function(r)
if a0.shape != r.shape:
raise ValueError("Callable must take array and return array of the same shape")
@@ -189,11 +191,11 @@ def __init__(self, *args, **kwargs):
self.function = kwargs.pop('function', 'multiquadric')
# attach anything left in kwargs to self
- # for use by any user-callable function or
+ # for use by any user-callable function or
# to save on the object returned.
for item, value in kwargs.items():
setattr(self, item, value)
-
+
self.A = self._init_function(r) - eye(self.N)*self.smooth
self.nodes = linalg.solve(self.A, self.di)
View
3  scipy/io/__init__.py
@@ -8,12 +8,11 @@
# matfile read and write
-from matlab import loadmat, savemat
+from matlab import loadmat, savemat, byteordercodes
# netCDF file support
from netcdf import netcdf_file, netcdf_variable
-from matlab import byteordercodes
from data_store import save_as_module
from mmio import mminfo, mmread, mmwrite
from idl import readsav
View
3  scipy/io/matlab/__init__.py
@@ -9,6 +9,9 @@
"""
# Matlab file read and write utilities
from mio import loadmat, savemat
+import byteordercodes
+
+__all__ = ['loadmat', 'savemat', 'byteordercodes']
from numpy.testing import Tester
test = Tester().test
View
2  scipy/linalg/decomp_lu.py
@@ -9,6 +9,8 @@
from lapack import get_lapack_funcs
from flinalg import get_flinalg_funcs
+__all__ = ['lu', 'lu_solve', 'lu_factor']
+
def lu_factor(a, overwrite_a=False):
"""Compute pivoted LU decomposition of a matrix.
View
3  scipy/linalg/decomp_qr.py
@@ -9,6 +9,9 @@
from lapack import get_lapack_funcs, find_best_lapack_type
from misc import _datacopied
+# XXX: what is qr_old, should it be kept?
+__all__ = ['qr', 'rq', 'qr_old']
+
def qr(a, overwrite_a=False, lwork=None, mode='full'):
"""Compute QR decomposition of a matrix.
View
2  scipy/linalg/decomp_svd.py
@@ -8,6 +8,8 @@
from misc import LinAlgError, _datacopied
from lapack import get_lapack_funcs
+__all__ = ['svd', 'svdvals', 'diagsvd', 'orth']
+
def svd(a, full_matrices=True, compute_uv=True, overwrite_a=False):
"""Singular Value Decomposition.
View
10 scipy/linalg/special_matrices.py
@@ -2,6 +2,10 @@
import math
import numpy as np
+__all__ = ['tri', 'tril', 'triu', 'toeplitz', 'circulant', 'hankel',
+ 'hadamard', 'leslie', 'all_mat', 'kron', 'block_diag', 'companion']
+
+
#-----------------------------------------------------------------------------
# matrix construction functions
#-----------------------------------------------------------------------------
@@ -308,7 +312,7 @@ def hadamard(n, dtype=int):
[ 1, -1, -1, 1]])
"""
-
+
# This function is a slightly modified version of the
# function contributed by Ivo in ticket #675.
@@ -322,7 +326,7 @@ def hadamard(n, dtype=int):
H = np.array([[1]], dtype=dtype)
# Sylvester's construction
- for i in range(0, lg2):
+ for i in range(0, lg2):
H = np.vstack((np.hstack((H, H)), np.hstack((H, -H))))
return H
@@ -493,7 +497,7 @@ def block_diag(*arrs):
bad_args = [k for k in range(len(arrs)) if arrs[k].ndim > 2]
if bad_args:
raise ValueError("arguments in the following positions have dimension "
- "greater than 2: %s" % bad_args)
+ "greater than 2: %s" % bad_args)
shapes = np.array([a.shape for a in arrs])
out = np.zeros(np.sum(shapes, axis=0), dtype=arrs[0].dtype)
View
3  scipy/misc/__init__.py
@@ -1,7 +1,8 @@
from info import __doc__
-__all__ = ['who', 'source', 'info']
+__all__ = ['who', 'source', 'info', 'doccer']
+import doccer
from common import *
from numpy import who, source, info as _info
View
4 scipy/misc/doccer.py
@@ -3,6 +3,10 @@
import sys
+__all__ = ['docformat', 'indentcount_lines', 'filldoc',
+ 'unindent_dict', 'unindent_string']
+
+
def docformat(docstring, docdict=None):
''' Fill a function docstring from variables in dictionary
View
7 scipy/ndimage/__init__.py
@@ -28,7 +28,6 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import numpy
from filters import *
from fourier import *
from interpolation import *
@@ -36,13 +35,9 @@
from morphology import *
from io import *
-# doccer is moved to scipy.misc in scipy 0.8
-from scipy.misc import doccer
-doccer = numpy.deprecate(doccer, old_name='doccer',
- new_name='scipy.misc.doccer')
-
from info import __doc__
__version__ = '2.0'
+__all__ = filter(lambda s: not s.startswith('_'), dir())
from numpy.testing import Tester
test = Tester().test
View
10 scipy/ndimage/filters.py
@@ -34,6 +34,16 @@
import _nd_image
from scipy.misc import doccer
+__all__ = ['correlate1d', 'convolve1d', 'gaussian_filter1d', 'gaussian_filter',
+ 'prewitt', 'sobel', 'generic_laplace', 'laplace',
+ 'gaussian_laplace', 'generic_gradient_magnitude',
+ 'gaussian_gradient_magnitude', 'correlate', 'convolve',
+ 'uniform_filter1d', 'uniform_filter', 'minimum_filter1d',
+ 'maximum_filter1d', 'minimum_filter', 'maximum_filter',
+ 'rank_filter', 'median_filter', 'percentile_filter',
+ 'generic_filter1d', 'generic_filter']
+
+
_input_doc = \
"""input : array-like
input array to filter"""
View
4 scipy/ndimage/fourier.py
@@ -33,6 +33,10 @@
import _ni_support
import _nd_image
+__all__ = ['fourier_gaussian', 'fourier_uniform', 'fourier_ellipsoid',
+ 'fourier_shift']
+
+
def _get_output_fourier(output, input):
if output is None:
if input.dtype.type in [numpy.complex64, numpy.complex128,
View
4 scipy/ndimage/interpolation.py
@@ -33,6 +33,10 @@
import _ni_support
import _nd_image
+__all__ = ['spline_filter1d', 'spline_filter', 'geometric_transform',
+ 'map_coordinates', 'affine_transform', 'shift', 'zoom', 'rotate']
+
+
def _extend_mode_to_code(mode):
mode = _ni_support._extend_mode_to_code(mode)
return mode
View
8 scipy/ndimage/measurements.py
@@ -34,6 +34,12 @@
import _nd_image
import morphology
+__all__ = ['label', 'find_objects', 'labeled_comprehension', 'sum', 'mean',
+ 'variance', 'standard_deviation', 'minimum', 'maximum',
+ 'minimum_position', 'maximum_position', 'extrema', 'center_of_mass',
+ 'histogram', 'watershed_ift']
+
+
def label(input, structure = None, output = None):
"""
Label features in an array.
@@ -417,7 +423,7 @@ def _sum_centered(labels):
if (not _safely_castable_to_int(labels.dtype) or
labels.min() < 0 or labels.max() > labels.size):
unique_labels, new_labels = numpy.unique(labels, return_inverse=True)
- counts = numpy.bincount(new_labels)
+ counts = numpy.bincount(new_labels)
sums = numpy.bincount(new_labels, weights=input.ravel())
if centered:
sums_c = _sum_centered(new_labels)
View
8 scipy/ndimage/morphology.py
@@ -33,6 +33,14 @@
import _nd_image
import filters
+__all__ = ['iterate_structure', 'generate_binary_structure', 'binary_erosion',
+ 'binary_dilation', 'binary_opening', 'binary_closing',
+ 'binary_hit_or_miss', 'binary_propagation', 'binary_fill_holes',
+ 'grey_erosion', 'grey_dilation', 'grey_opening', 'grey_closing',
+ 'morphological_gradient', 'morphological_laplace', 'white_tophat',
+ 'black_tophat', 'distance_transform_bf', 'distance_transform_cdt',
+ 'distance_transform_edt']
+
def _center_is_true(structure, origin):
structure = numpy.array(structure)
View
15 scipy/odr/__init__.py
@@ -8,19 +8,10 @@
__author__ = 'Robert Kern <robert.kern@gmail.com>'
__date__ = '2006-09-21'
-import odrpack
-from odrpack import odr ,\
- odr_error ,\
- odr_stop ,\
- Data ,\
- RealData ,\
- Model ,\
- Output ,\
- ODR
+from odrpack import *
+from models import *
-__all__ = ['odr', 'odr_error', 'odr_stop', 'Data', 'RealData', 'Model',
- 'Output', 'ODR', 'odrpack']
+__all__ = filter(lambda s: not s.startswith('_'), dir())
from numpy.testing import Tester
test = Tester().test
-#### EOF #######################################################################
View
5 scipy/odr/models.py
@@ -4,6 +4,9 @@
import numpy as np
from scipy.odr.odrpack import Model
+__all__ = ['Model', 'exponential', 'multilinear', 'unilinear', 'quadratic',
+ 'polynomial']
+
def _lin_fcn(B, x):
a, b = B[0], B[1:]
@@ -156,5 +159,3 @@ def _quad_est(data):
estimate=_quad_est, meta={'name': 'Quadratic',
'equ': 'y = B_0*x**2 + B_1*x + B_2',
'TeXequ': '$y = \\beta_0 x^2 + \\beta_1 x + \\beta_2'})
-
-#### EOF #######################################################################
View
10 scipy/odr/odrpack.py
@@ -113,6 +113,10 @@ def f(B, x):
import numpy
from scipy.odr import __odrpack
+__all__ = ['odr', 'odr_error', 'odr_stop', 'Data', 'RealData', 'Model',
+ 'Output', 'ODR']
+
+
odr = __odrpack.odr
odr_error = __odrpack.odr_error
odr_stop = __odrpack.odr_stop
@@ -136,7 +140,7 @@ def _conv(obj, dtype=None):
return obj
-def report_error(info):
+def _report_error(info):
""" Interprets the return code of the odr routine.
Parameters
@@ -590,7 +594,7 @@ def __init__(self, output):
if len(output) == 4:
# full output
self.__dict__.update(output[3])
- self.stopreason = report_error(self.info)
+ self.stopreason = _report_error(self.info)
def pprint(self):
@@ -1106,5 +1110,3 @@ def restart(self, iter=None):
self.maxit = iter
return self.run()
-
-#### EOF #######################################################################
View
4 scipy/optimize/cobyla.py
@@ -10,6 +10,10 @@
import _cobyla
from numpy import copy
+
+__all__ = ['fmin_cobyla']
+
+
def fmin_cobyla(func, x0, cons, args=(), consargs=None, rhobeg=1.0, rhoend=1e-4,
iprint=1, maxfun=1000, disp=None):
"""
View
3  scipy/optimize/lbfgsb.py
@@ -29,6 +29,9 @@
import optimize
from numpy.compat import asbytes
+__all__ = ['fmin_l_bfgs_b']
+
+
approx_fprime = optimize.approx_fprime
def fmin_l_bfgs_b(func, x0, fprime=None, args=(),
View
3  scipy/optimize/nnls.py
@@ -1,6 +1,9 @@
import _nnls
from numpy import asarray_chkfinite, zeros, double
+__all__ = ['nnls']
+
+
def nnls(A,b):
"""
Solve ``argmin_x || Ax - b ||_2`` for ``x>=0``.
View
5 scipy/optimize/tnc.py
@@ -34,6 +34,9 @@
from scipy.optimize import moduleTNC
from numpy import asarray, inf, array
+__all__ = ['fmin_tnc']
+
+
MSG_NONE = 0 # No messages
MSG_ITER = 1 # One line per iteration
MSG_INFO = 2 # Informational messages
@@ -178,7 +181,7 @@ def fmin_tnc(func, x0, fprime=None, args=(), approx_grad=0,
raise ValueError('length of x0 != length of bounds')
if disp is not None:
- messages = {0:MSG_NONE, 1:MSG_ITER, 2:MSG_INFO, 3:MSG_VERS,
+ messages = {0:MSG_NONE, 1:MSG_ITER, 2:MSG_INFO, 3:MSG_VERS,
4:MSG_EXIT, 5:MSG_ALL}.get(disp, MSG_ALL)
if approx_grad:
View
2  scipy/signal/bsplines.py
@@ -10,6 +10,8 @@
from scipy.misc import comb
+__all__ = ['spline_filter', 'bspline', 'gauss_spline', 'cubic', 'quadratic',
+ 'cspline1d', 'qspline1d', 'cspline1d_eval', 'qspline1d_eval']
gamma = scipy.special.gamma
View
18 scipy/signal/filter_design.py
@@ -12,6 +12,14 @@
from scipy import special, optimize
from scipy.misc import comb
+__all__ = ['findfreqs', 'freqs', 'freqz', 'tf2zpk', 'zpk2tf', 'normalize',
+ 'lp2lp', 'lp2hp', 'lp2bp', 'lp2bs', 'bilinear', 'iirdesign',
+ 'iirfilter', 'butter', 'cheby1', 'cheby2', 'ellip', 'bessel',
+ 'band_stop_obj', 'buttord', 'cheb1ord', 'cheb2ord', 'ellipord',
+ 'buttap', 'cheb1ap', 'cheb2ap', 'ellipap', 'besselap',
+ 'filter_dict', 'band_dict', 'BadCoefficients']
+
+
class BadCoefficients(UserWarning):
pass
@@ -1155,12 +1163,12 @@ def cheb2ap(N, rs):
EPSILON = 2e-16
-def vratio(u, ineps, mp):
+def _vratio(u, ineps, mp):
[s,c,d,phi] = special.ellipj(u,mp)
ret = abs(ineps - s/c)
return ret
-def kratio(m, k_ratio):
+def _kratio(m, k_ratio):
m = float(m)
if m < 0:
m = 0.0
@@ -1205,10 +1213,10 @@ def ellipap(N, rp, rs):
else:
krat = N*val[0] / val[1]
- m = optimize.fmin(kratio, [0.5], args=(krat,), maxfun=250, maxiter=250,
+ m = optimize.fmin(_kratio, [0.5], args=(krat,), maxfun=250, maxiter=250,
disp=0)
if m < 0 or m > 1:
- m = optimize.fminbound(kratio, 0, 1, args=(krat,), maxfun=250,
+ m = optimize.fminbound(_kratio, 0, 1, args=(krat,), maxfun=250,
maxiter=250, disp=0)
capk = special.ellipk(m)
@@ -1224,7 +1232,7 @@ def ellipap(N, rp, rs):
z = 1j*z
z = numpy.concatenate((z,conjugate(z)))
- r = optimize.fmin(vratio, special.ellipk(m), args=(1./eps, ck1p*ck1p),
+ r = optimize.fmin(_vratio, special.ellipk(m), args=(1./eps, ck1p*ck1p),
maxfun=250, maxiter=250, disp=0)
v0 = capk * r / (N*val[0])
View
4 scipy/signal/fir_filter_design.py
@@ -6,6 +6,10 @@
from scipy.special import sinc
import sigtools
+__all__ = ['kaiser_beta', 'kaiser_atten', 'kaiserord',
+ 'firwin', 'firwin2', 'remez']
+
+
# Some notes on function parameters:
#
# `cutoff` and `width` are given as a numbers between 0 and 1. These
View
3  scipy/signal/ltisys.py
@@ -20,6 +20,9 @@
from numpy import r_, eye, real, atleast_1d, atleast_2d, poly, \
squeeze, diag, asarray
+__all__ = ['tf2ss', 'ss2tf', 'abcd_normalize', 'zpk2ss', 'ss2zpk', 'lti',
+ 'lsim', 'lsim2', 'impulse', 'impulse2', 'step', 'step2']
+
def tf2ss(num, den):
"""Transfer function to state-space representation.
View
7 scipy/signal/signaltools.py
@@ -17,6 +17,13 @@
from scipy.misc import factorial
from windows import get_window
+__all__ = ['correlate', 'fftconvolve', 'convolve', 'convolve2d', 'correlate2d',
+ 'order_filter', 'medfilt', 'medfilt2d', 'wiener', 'lfilter',
+ 'lfiltic', 'deconvolve', 'hilbert', 'hilbert2', 'cmplx_sort',
+ 'unique_roots', 'invres', 'invresz', 'residue', 'residuez',
+ 'resample', 'detrend', 'lfilter_zi', 'filtfilt', 'decimate']
+
+
_modedict = {'valid':0, 'same':1, 'full':2}
_boundarydict = {'fill':0, 'pad':0, 'wrap':2, 'circular':2, 'symm':1,
View
142 scipy/signal/spectral.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.12.1 on Sun Feb 13 12:00:22 2011 */
+/* Generated by Cython 0.12.1 on Tue Mar 8 17:29:15 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -683,7 +683,7 @@ static char __pyx_k_5[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_6[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_7[] = "Format string allocated too short.";
static char __pyx_k_8[] = "Tools for spectral analysis of unequally sampled signals.";
-static char __pyx_k_9[] = "lombscargle (line 16)";
+static char __pyx_k_9[] = "lombscargle (line 19)";
static char __pyx_k__B[] = "B";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
@@ -718,6 +718,7 @@ static char __pyx_k__range[] = "range";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__fields[] = "fields";
static char __pyx_k__format[] = "format";
+static char __pyx_k____all__[] = "__all__";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__strides[] = "strides";
static char __pyx_k____main__[] = "__main__";
@@ -740,6 +741,7 @@ static PyObject *__pyx_kp_u_7;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__base;
@@ -769,7 +771,7 @@ static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_int_15;
-/* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":16
+/* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":19
*
* @cython.boundscheck(False)
* def lombscargle(np.ndarray[np.float64_t, ndim=1] x, # <<<<<<<<<<<<<<
@@ -854,17 +856,17 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__freqs);
if (likely(values[2])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lombscargle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lombscargle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_x = ((PyArrayObject *)values[0]);
__pyx_v_y = ((PyArrayObject *)values[1]);
@@ -878,7 +880,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("lombscargle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("scipy.signal.spectral.lombscargle");
return NULL;
@@ -890,29 +892,29 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_bstruct_x.buf = NULL;
__pyx_bstruct_y.buf = NULL;
__pyx_bstruct_freqs.buf = NULL;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freqs), __pyx_ptype_5numpy_ndarray, 1, "freqs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_freqs), __pyx_ptype_5numpy_ndarray, 1, "freqs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
- if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_x, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_bstride_0_x = __pyx_bstruct_x.strides[0];
__pyx_bshape_0_x = __pyx_bstruct_x.shape[0];
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
- if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_bstride_0_y = __pyx_bstruct_y.strides[0];
__pyx_bshape_0_y = __pyx_bstruct_y.shape[0];
{
__Pyx_BufFmt_StackElem __pyx_stack[1];
- if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_freqs, (PyObject*)__pyx_v_freqs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_freqs, (PyObject*)__pyx_v_freqs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_bstride_0_freqs = __pyx_bstruct_freqs.strides[0];
__pyx_bshape_0_freqs = __pyx_bstruct_freqs.shape[0];
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":121
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":124
*
* # Check input sizes
* if x.shape[0] != y.shape[0]: # <<<<<<<<<<<<<<
@@ -922,57 +924,57 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_t_1 = ((__pyx_v_x->dimensions[0]) != (__pyx_v_y->dimensions[0]));
if (__pyx_t_1) {
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":122
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":125
* # Check input sizes
* if x.shape[0] != y.shape[0]:
* raise ValueError("Input arrays do not have the same size.") # <<<<<<<<<<<<<<
*
* # Create empty array for output periodogram
*/
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
- __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":125
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":128
*
* # Create empty array for output periodogram
* pgram = np.empty(freqs.shape[0], dtype=np.float64) # <<<<<<<<<<<<<<
*
* # Local variables
*/
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_freqs->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_freqs->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
@@ -981,7 +983,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_v_pgram = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":132
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":135
* cdef double tau, c_tau, s_tau, c_tau2, s_tau2, cs_tau
*
* for i in range(freqs.shape[0]): # <<<<<<<<<<<<<<
@@ -992,7 +994,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":134
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":137
* for i in range(freqs.shape[0]):
*
* xc = 0. # <<<<<<<<<<<<<<
@@ -1001,7 +1003,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_xc = 0.0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":135
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":138
*
* xc = 0.
* xs = 0. # <<<<<<<<<<<<<<
@@ -1010,7 +1012,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_xs = 0.0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":136
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":139
* xc = 0.
* xs = 0.
* cc = 0. # <<<<<<<<<<<<<<
@@ -1019,7 +1021,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_cc = 0.0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":137
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":140
* xs = 0.
* cc = 0.
* ss = 0. # <<<<<<<<<<<<<<
@@ -1028,7 +1030,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_ss = 0.0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":138
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":141
* cc = 0.
* ss = 0.
* cs = 0. # <<<<<<<<<<<<<<
@@ -1037,7 +1039,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_cs = 0.0;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":140
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":143
* cs = 0.
*
* for j in range(x.shape[0]): # <<<<<<<<<<<<<<
@@ -1048,7 +1050,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
__pyx_v_j = __pyx_t_10;
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":142
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":145
* for j in range(x.shape[0]):
*
* c = cos(freqs[i] * x[j]) # <<<<<<<<<<<<<<
@@ -1061,7 +1063,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_0_x;
__pyx_v_c = cos(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_freqs.buf, __pyx_t_11, __pyx_bstride_0_freqs)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_12, __pyx_bstride_0_x))));
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":143
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":146
*
* c = cos(freqs[i] * x[j])
* s = sin(freqs[i] * x[j]) # <<<<<<<<<<<<<<
@@ -1074,7 +1076,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_x;
__pyx_v_s = sin(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_freqs.buf, __pyx_t_13, __pyx_bstride_0_freqs)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_x.buf, __pyx_t_14, __pyx_bstride_0_x))));
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":145
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":148
* s = sin(freqs[i] * x[j])
*
* xc += y[j] * c # <<<<<<<<<<<<<<
@@ -1085,7 +1087,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_y;
__pyx_v_xc += ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_15, __pyx_bstride_0_y)) * __pyx_v_c);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":146
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":149
*
* xc += y[j] * c
* xs += y[j] * s # <<<<<<<<<<<<<<
@@ -1096,7 +1098,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_0_y;
__pyx_v_xs += ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_y.buf, __pyx_t_16, __pyx_bstride_0_y)) * __pyx_v_s);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":147
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":150
* xc += y[j] * c
* xs += y[j] * s
* cc += c * c # <<<<<<<<<<<<<<
@@ -1105,7 +1107,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_cc += (__pyx_v_c * __pyx_v_c);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":148
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":151
* xs += y[j] * s
* cc += c * c
* ss += s * s # <<<<<<<<<<<<<<
@@ -1114,7 +1116,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_ss += (__pyx_v_s * __pyx_v_s);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":149
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":152
* cc += c * c
* ss += s * s
* cs += c * s # <<<<<<<<<<<<<<
@@ -1124,7 +1126,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_v_cs += (__pyx_v_c * __pyx_v_s);
}
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":151
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":154
* cs += c * s
*
* tau = atan(2 * cs / (cc - ss)) / (2 * freqs[i]) # <<<<<<<<<<<<<<
@@ -1135,7 +1137,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_t_18 = (__pyx_v_cc - __pyx_v_ss);
if (unlikely(__pyx_t_18 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_19 = atan((__pyx_t_17 / __pyx_t_18));
__pyx_t_10 = __pyx_v_i;
@@ -1143,11 +1145,11 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_t_20 = (2 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_freqs.buf, __pyx_t_10, __pyx_bstride_0_freqs)));
if (unlikely(__pyx_t_20 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_tau = (__pyx_t_19 / __pyx_t_20);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":152
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":155
*
* tau = atan(2 * cs / (cc - ss)) / (2 * freqs[i])
* c_tau = cos(freqs[i] * tau) # <<<<<<<<<<<<<<
@@ -1158,7 +1160,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_freqs;
__pyx_v_c_tau = cos(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_freqs.buf, __pyx_t_21, __pyx_bstride_0_freqs)) * __pyx_v_tau));
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":153
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":156
* tau = atan(2 * cs / (cc - ss)) / (2 * freqs[i])
* c_tau = cos(freqs[i] * tau)
* s_tau = sin(freqs[i] * tau) # <<<<<<<<<<<<<<
@@ -1169,7 +1171,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_0_freqs;
__pyx_v_s_tau = sin(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_bstruct_freqs.buf, __pyx_t_22, __pyx_bstride_0_freqs)) * __pyx_v_tau));
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":154
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":157
* c_tau = cos(freqs[i] * tau)
* s_tau = sin(freqs[i] * tau)
* c_tau2 = c_tau * c_tau # <<<<<<<<<<<<<<
@@ -1178,7 +1180,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_c_tau2 = (__pyx_v_c_tau * __pyx_v_c_tau);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":155
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":158
* s_tau = sin(freqs[i] * tau)
* c_tau2 = c_tau * c_tau
* s_tau2 = s_tau * s_tau # <<<<<<<<<<<<<<
@@ -1187,7 +1189,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_s_tau2 = (__pyx_v_s_tau * __pyx_v_s_tau);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":156
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":159
* c_tau2 = c_tau * c_tau
* s_tau2 = s_tau * s_tau
* cs_tau = 2 * c_tau * s_tau # <<<<<<<<<<<<<<
@@ -1196,7 +1198,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_v_cs_tau = ((2 * __pyx_v_c_tau) * __pyx_v_s_tau);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":158
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":161
* cs_tau = 2 * c_tau * s_tau
*
* pgram[i] = 0.5 * (((c_tau * xc + s_tau * xs)**2 / \ # <<<<<<<<<<<<<<
@@ -1205,7 +1207,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_t_19 = pow(((__pyx_v_c_tau * __pyx_v_xc) + (__pyx_v_s_tau * __pyx_v_xs)), 2);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":159
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":162
*
* pgram[i] = 0.5 * (((c_tau * xc + s_tau * xs)**2 / \
* (c_tau2 * cc + cs_tau * cs + s_tau2 * ss)) + \ # <<<<<<<<<<<<<<
@@ -1215,10 +1217,10 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_t_18 = (((__pyx_v_c_tau2 * __pyx_v_cc) + (__pyx_v_cs_tau * __pyx_v_cs)) + (__pyx_v_s_tau2 * __pyx_v_ss));
if (unlikely(__pyx_t_18 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":160
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":163
* pgram[i] = 0.5 * (((c_tau * xc + s_tau * xs)**2 / \
* (c_tau2 * cc + cs_tau * cs + s_tau2 * ss)) + \
* ((c_tau * xs - s_tau * xc)**2 / \ # <<<<<<<<<<<<<<
@@ -1227,7 +1229,7 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
*/
__pyx_t_17 = pow(((__pyx_v_c_tau * __pyx_v_xs) - (__pyx_v_s_tau * __pyx_v_xc)), 2);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":161
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":164
* (c_tau2 * cc + cs_tau * cs + s_tau2 * ss)) + \
* ((c_tau * xs - s_tau * xc)**2 / \
* (c_tau2 * ss - cs_tau * cs + s_tau2 * cc))) # <<<<<<<<<<<<<<
@@ -1237,23 +1239,23 @@ static PyObject *__pyx_pf_5scipy_6signal_8spectral_lombscargle(PyObject *__pyx_s
__pyx_t_23 = (((__pyx_v_c_tau2 * __pyx_v_ss) - (__pyx_v_cs_tau * __pyx_v_cs)) + (__pyx_v_s_tau2 * __pyx_v_cc));
if (unlikely(__pyx_t_23 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_6 = PyFloat_FromDouble((0.5 * ((__pyx_t_19 / __pyx_t_18) + (__pyx_t_17 / __pyx_t_23)))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyFloat_FromDouble((0.5 * ((__pyx_t_19 / __pyx_t_18) + (__pyx_t_17 / __pyx_t_23)))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":158
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":161
* cs_tau = 2 * c_tau * s_tau
*
* pgram[i] = 0.5 * (((c_tau * xc + s_tau * xs)**2 / \ # <<<<<<<<<<<<<<
* (c_tau2 * cc + cs_tau * cs + s_tau2 * ss)) + \
* ((c_tau * xs - s_tau * xc)**2 / \
*/
- if (__Pyx_SetItemInt(__pyx_v_pgram, __pyx_v_i, __pyx_t_6, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetItemInt(__pyx_v_pgram, __pyx_v_i, __pyx_t_6, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
- /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":163
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":166
* (c_tau2 * ss - cs_tau * cs + s_tau2 * cc)))
*
* return pgram # <<<<<<<<<<<<<<
@@ -3259,6 +3261,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
{&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
+ {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
@@ -3289,8 +3292,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
@@ -3385,6 +3388,21 @@ PyMODINIT_FUNC PyInit_spectral(void)
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ /* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":10
+ * cimport cython
+ *
+ * __all__ = ['lombscargle'] # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__lombscargle));
+ PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__lombscargle));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lombscargle));
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
/* "/Users/rgommers/Code/scipy/scipy/signal/spectral.pyx":1
* # Author: Pim Schellart # <<<<<<<<<<<<<<
* # 2010 - 2011
View
3  scipy/signal/spectral.pyx
@@ -7,6 +7,9 @@ import numpy as np
cimport numpy as np
cimport cython
+__all__ = ['lombscargle']
+
+
cdef extern from "math.h":
double cos(double)
double sin(double)
View
3  scipy/signal/waveforms.py
@@ -8,6 +8,9 @@
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, polyint
+__all__ = ['sawtooth', 'square', 'gausspulse', 'chirp', 'sweep_poly']
+
+
def sawtooth(t, width=1):
"""
Return a periodic sawtooth waveform.
View
5 scipy/signal/wavelets.py
@@ -1,10 +1,11 @@
-__all__ = ['daub','qmf','cascade','morlet']
-
import numpy as np
from numpy.dual import eig
from scipy.misc import comb
from scipy import linspace, pi, exp
+__all__ = ['daub', 'qmf', 'wavedec', 'cascade', 'morlet']
+
+
def daub(p):
"""
The coefficients for the FIR low-pass filter producing Daubechies wavelets.
View
5 scipy/signal/windows.py
@@ -4,6 +4,11 @@
from scipy import special, linalg
from scipy.fftpack import fft
+__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
+ 'blackmanharris', 'flattop', 'bartlett', 'hanning', 'barthann',
+ 'hamming', 'kaiser', 'gaussian', 'general_gaussian', 'chebwin',
+ 'slepian', 'get_window']
+
def boxcar(M, sym=True):
"""The M-point boxcar window.
View
5 scipy/sparse/linalg/eigen/arpack/arpack.py
@@ -39,13 +39,14 @@
__docformat__ = "restructuredtext en"
-__all___=['eigs', 'eigsh', 'svds', 'ArpackNoConvergence']
-
import _arpack
import numpy as np
from scipy.sparse.linalg.interface import aslinearoperator, LinearOperator
from scipy.sparse import csc_matrix, csr_matrix, isspmatrix
+__all__ =['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence']
+
+
_type_conv = {'f':'s', 'd':'d', 'F':'c', 'D':'z'}
_ndigits = {'f':5, 'd':12, 'F':5, 'D':12}
View
22 scipy/spatial/ckdtree.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.12.1 on Sun Feb 20 19:40:58 2011 */
+/* Generated by Cython 0.12.1 on Sun Feb 27 19:13:59 2011 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -924,6 +924,7 @@ static char __pyx_k__astype[] = "astype";
static char __pyx_k__fields[] = "fields";
static char __pyx_k__format[] = "format";
static char __pyx_k__kdtree[] = "kdtree";
+static char __pyx_k____all__[] = "__all__";
static char __pyx_k____build[] = "__build";
static char __pyx_k____query[] = "__query";
static char __pyx_k__asarray[] = "asarray";
@@ -971,6 +972,7 @@ static PyObject *__pyx_kp_u_8;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____build;
static PyObject *__pyx_n_s____free_tree;
static PyObject *__pyx_n_s____main__;
@@ -7660,6 +7662,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
{&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
+ {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
{&__pyx_n_s____build, __pyx_k____build, sizeof(__pyx_k____build), 0, 0, 1, 1},
{&__pyx_n_s____free_tree, __pyx_k____free_tree, sizeof(__pyx_k____free_tree), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
@@ -7866,7 +7869,7 @@ PyMODINIT_FUNC PyInit_ckdtree(void)
*
* cdef double infinity = np.inf # <<<<<<<<<<<<<<
*
- *
+ * __all__ = ['cKDTree']
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
@@ -7877,6 +7880,21 @@ PyMODINIT_FUNC PyInit_ckdtree(void)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_5scipy_7spatial_7ckdtree_infinity = __pyx_t_3;
+ /* "/Users/rgommers/Code/scipy/scipy/spatial/ckdtree.pyx":11
+ * cdef double infinity = np.inf
+ *
+ * __all__ = ['cKDTree'] # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+ __Pyx_INCREF(((PyObject *)__pyx_n_s__cKDTree));
+ PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__cKDTree));
+ __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cKDTree));
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+
/* "/Users/rgommers/Code/scipy/scipy/spatial/ckdtree.pyx":515
*
* def query(cKDTree self, object x, int k=1, double eps=0, double p=2,
View
2  scipy/spatial/ckdtree.pyx
@@ -8,7 +8,7 @@ import kdtree
cdef double infinity = np.inf
-
+__all__ = ['cKDTree']
# priority queue
View
5 scipy/spatial/kdtree.py
@@ -5,6 +5,11 @@
from heapq import heappush, heappop
import scipy.sparse
+__all__ = ['minkowski_distance_p', 'minkowski_distance',
+ 'distance_matrix',
+ 'Rectangle', 'KDTree']
+
+
def minkowski_distance_p(x,y,p=2):
"""Compute the pth power of the L**p distance between x and y
View
1  scipy/special/__init__.py
@@ -5,7 +5,6 @@
from info import __doc__, __docformat__
#from special_version import special_version as __version__
-from numpy import *
from _cephes import *
from basic import *
View
17 scipy/special/basic.py
@@ -11,6 +11,23 @@
import specfun
import orthogonal
+__all__ = ['agm', 'ai_zeros', 'assoc_laguerre', 'bei_zeros', 'beip_zeros',
+ 'ber_zeros', 'bernoulli', 'berp_zeros', 'bessel_diff_formula',
+ 'bi_zeros', 'digamma', 'diric', 'ellipk', 'erf_zeros', 'erfcinv',
+ 'erfinv', 'errprint', 'euler', 'fresnel_zeros',
+ 'fresnelc_zeros', 'fresnels_zeros', 'gamma', 'gammaln', 'h1vp',
+ 'h2vp', 'hankel1', 'hankel2', 'hyp0f1', 'iv', 'ivp', 'jn_zeros',
+ 'jnjnp_zeros', 'jnp_zeros', 'jnyn_zeros', 'jv', 'jvp', 'kei_zeros',
+ 'keip_zeros', 'kelvin_zeros', 'ker_zeros', 'kerp_zeros', 'kv',
+ 'kvp', 'lmbda', 'lpmn', 'lpn', 'lqmn', 'lqn', 'mathieu_a',
+ 'mathieu_b', 'mathieu_even_coef', 'mathieu_odd_coef', 'ndtri',
+ 'obl_cv_seq', 'pbdn_seq', 'pbdv_seq', 'pbvv_seq',
+ 'polygamma', 'pro_cv_seq', 'psi', 'riccati_jn', 'riccati_yn',
+ 'sinc', 'sph_harm', 'sph_in', 'sph_inkn',
+ 'sph_jn', 'sph_jnyn', 'sph_kn', 'sph_yn', 'y0_zeros', 'y1_zeros',
+ 'y1p_zeros', 'yn_zeros', 'ynp_zeros', 'yv', 'yvp', 'zeta']
+
+
def sinc(x):
"""Returns sin(pi*x)/(pi*x) at all points of array x.
"""
View
3  scipy/special/spfun_stats.py
@@ -36,6 +36,9 @@
import numpy as np
from scipy.special import gammaln as loggam
+__all__ = ['multigammln']
+
+
def multigammaln(a, d):
"""returns the log of multivariate gamma, also sometimes called the
generalized gamma.
View
3  scipy/special/tests/test_data.py
@@ -1,8 +1,9 @@
import os
import numpy as np
+from numpy import arccosh, arcsinh, arctanh
from scipy.special import (
- arccosh, arcsinh, arctanh, erf, erfc, log1p, expm1,
+ erf, erfc, log1p, expm1,
jn, jv, yn, yv, iv, kv, kn, gamma, gammaln, digamma, beta, cbrt,
ellipe, ellipeinc, ellipk, ellipj, erfinv, erfcinv, exp1, expi, expn,
zeta, gammaincinv, lpmv
View
103 scipy/stats/distributions.py
@@ -29,57 +29,6 @@
from numpy import flatnonzero as nonzero
import vonmises_cython
-def _moment(data, n, mu=None):
- if mu is None:
- mu = data.mean()
- return ((data - mu)**n).mean()
-
-def _moment_from_stats(n, mu, mu2, g1, g2, moment_func, args):
- if (n==0):
- return 1.0
- elif (n==1):
- if mu is None:
- val = moment_func(1,*args)
- else:
- val = mu
- elif (n==2):
- if mu2 is None or mu is None:
- val = moment_func(2,*args)
- else:
- val = mu2 + mu*mu
- elif (n==3):
- if g1 is None or mu2 is None or mu is None:
- val = moment_func(3,*args)
- else:
- mu3 = g1*(mu2**1.5) # 3rd central moment
- val = mu3+3*mu*mu2+mu**3 # 3rd non-central moment
- elif (n==4):
- if g1 is None or g2 is None or mu2 is None or mu is None:
- val = moment_func(4,*args)
- else:
- mu4 = (g2+3.0)*(mu2**2.0) # 4th central moment
- mu3 = g1*(mu2**1.5) # 3rd central moment
- val = mu4+4*mu*mu3+6*mu*mu*mu2+mu**4
- else:
- val = moment_func(n, *args)
-
- return val
-
-
-def _skew(data):
- data = np.ravel(data)
- mu = data.mean()
- m2 = ((data - mu)**2).mean()
- m3 = ((data - mu)**3).mean()
- return m3 / m2**1.5
-
-def _kurtosis(data):
- data = np.ravel(data)
- mu = data.mean()
- m2 = ((data - mu)**2).mean()
- m4 = ((data - mu)**4).mean()
- return m4 / m2**2 - 3
-
__all__ = [
'rv_continuous',
'ksone', 'kstwobign', 'norm', 'alpha', 'anglit', 'arcsine',
@@ -378,6 +327,58 @@ def instancemethod(func, obj, cls):
pass
+def _moment(data, n, mu=None):
+ if mu is None:
+ mu = data.mean()
+ return ((data - mu)**n).mean()
+
+def _moment_from_stats(n, mu, mu2, g1, g2, moment_func, args):
+ if (n==0):
+ return 1.0
+ elif (n==1):
+ if mu is None:
+ val = moment_func(1,*args)
+ else:
+ val = mu
+ elif (n==2):
+ if mu2 is None or mu is None:
+ val = moment_func(2,*args)
+ else:
+ val = mu2 + mu*mu
+ elif (n==3):
+ if g1 is None or mu2 is None or mu is None:
+ val = moment_func(3,*args)
+ else:
+ mu3 = g1*(mu2**1.5) # 3rd central moment
+ val = mu3+3*mu*mu2+mu**3 # 3rd non-central moment
+ elif (n==4):
+ if g1 is None or g2 is None or mu2 is None or mu is None:
+ val = moment_func(4,*args)
+ else:
+ mu4 = (g2+3.0)*(mu2**2.0) # 4th central moment
+ mu3 = g1*(mu2**1.5) # 3rd central moment
+ val = mu4+4*mu*mu3+6*mu*mu*mu2+mu**4
+ else:
+ val = moment_func(n, *args)
+
+ return val
+
+
+def _skew(data):
+ data = np.ravel(data)
+ mu = data.mean()
+ m2 = ((data - mu)**2).mean()
+ m3 = ((data - mu)**3).mean()
+ return m3 / m2**1.5
+
+def _kurtosis(data):
+ data = np.ravel(data)
+ mu = data.mean()
+ m2 = ((data - mu)**2).mean()
+ m4 = ((data - mu)**4).mean()
+ return m4 / m2**2 - 3
+
+
def _build_random_array(fun, args, size=None):
# Build an array by applying function fun to
View
3  scipy/stats/kde.py
@@ -31,8 +31,7 @@
import stats
import mvn
-__all__ = ['gaussian_kde',
-]
+__all__ = ['gaussian_kde']
class gaussian_kde(object):
Something went wrong with that request. Please try again.