repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
scipy | scipy-main/scipy/optimize/tests/test_constraints.py | import pytest
import numpy as np
from numpy.testing import TestCase, assert_array_equal
import scipy.sparse as sps
from scipy.optimize._constraints import (
Bounds, LinearConstraint, NonlinearConstraint, PreparedConstraint,
new_bounds_to_old, old_bound_to_new, strict_bounds)
class TestStrictBounds(TestCase):
... | 9,402 | 35.730469 | 77 | py |
scipy | scipy-main/scipy/optimize/tests/test_cobyla.py | import math
import numpy as np
from numpy.testing import assert_allclose, assert_, assert_array_equal
from scipy.optimize import fmin_cobyla, minimize, Bounds
class TestCobyla:
def setup_method(self):
self.x0 = [4.95, 0.66]
self.solution = [math.sqrt(25 - (2.0/3)**2), 2.0/3]
self.opts = ... | 5,152 | 30.808642 | 101 | py |
scipy | scipy-main/scipy/optimize/tests/test__shgo.py | import logging
import sys
import numpy
import numpy as np
import time
from multiprocessing import Pool
from numpy.testing import assert_allclose, IS_PYPY
import pytest
from pytest import raises as assert_raises, warns
from scipy.optimize import (shgo, Bounds, minimize_scalar, minimize, rosen,
... | 40,298 | 33.740517 | 84 | py |
scipy | scipy-main/scipy/optimize/tests/test_linesearch.py | """
Tests for line search routines
"""
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_array_almost_equal_nulp, assert_warns,
suppress_warnings)
import scipy.optimize._linesearch as ls
from scipy.optimize._linesearch import LineSearchWarni... | 10,896 | 33.593651 | 84 | py |
scipy | scipy-main/scipy/optimize/tests/__init__.py | 0 | 0 | 0 | py | |
scipy | scipy-main/scipy/optimize/tests/test_lbfgsb_hessinv.py | import numpy as np
from numpy.testing import assert_allclose
import scipy.linalg
from scipy.optimize import minimize
def test_1():
def f(x):
return x**4, 4*x**3
for gtol in [1e-8, 1e-12, 1e-20]:
for maxcor in range(20, 35):
result = minimize(fun=f, jac=True, method='L-BFGS-B', x0=... | 1,137 | 24.863636 | 72 | py |
scipy | scipy-main/scipy/optimize/tests/test_least_squares.py | from itertools import product
import numpy as np
from numpy.linalg import norm
from numpy.testing import (assert_, assert_allclose,
assert_equal, suppress_warnings)
from pytest import raises as assert_raises
from scipy.sparse import issparse, lil_matrix
from scipy.sparse.linalg import asline... | 31,773 | 38.130542 | 96 | py |
scipy | scipy-main/scipy/optimize/tests/test_minimize_constrained.py | import numpy as np
import pytest
from scipy.linalg import block_diag
from scipy.sparse import csc_matrix
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_array_less, assert_, assert_allclose,
suppress_warnings)
from scipy.optimize import (Nonli... | 25,696 | 31.902689 | 100 | py |
scipy | scipy-main/scipy/optimize/tests/test_lbfgsb_setulb.py | import numpy as np
from scipy.optimize import _lbfgsb
def objfun(x):
"""simplified objective func to test lbfgsb bound violation"""
x0 = [0.8750000000000278,
0.7500000000000153,
0.9499999999999722,
0.8214285714285992,
0.6363636363636085]
x1 = [1.0, 0.0, 1.0, 0.0, 0.... | 3,172 | 26.119658 | 72 | py |
scipy | scipy-main/scipy/optimize/tests/test_zeros.py | import pytest
from functools import lru_cache
from numpy.testing import (assert_warns, assert_,
assert_allclose,
assert_equal,
assert_array_equal,
assert_array_less,
suppress_warnings... | 47,558 | 37.077662 | 112 | py |
scipy | scipy-main/scipy/optimize/tests/test_lsq_linear.py | import pytest
import numpy as np
from numpy.linalg import lstsq
from numpy.testing import assert_allclose, assert_equal, assert_
from scipy.sparse import rand, coo_matrix
from scipy.sparse.linalg import aslinearoperator
from scipy.optimize import lsq_linear
from scipy.optimize._minimize import Bounds
A = np.array([... | 10,861 | 37.112281 | 79 | py |
scipy | scipy-main/scipy/optimize/tests/test_differentiable_functions.py | import pytest
import numpy as np
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_array_equal, assert_, assert_allclose,
assert_equal)
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import LinearOperator
from scipy.optimize._diffe... | 26,154 | 34.730874 | 86 | py |
scipy | scipy-main/scipy/optimize/tests/test_trustregion_exact.py | """
Unit tests for trust-region iterative subproblem.
To run it in its simplest form::
nosetests test_optimize.py
"""
import numpy as np
from scipy.optimize._trustregion_exact import (
estimate_smallest_singular_value,
singular_leading_submatrix,
IterativeSubproblem)
from scipy.linalg import (svd, get_l... | 12,954 | 35.699717 | 78 | py |
scipy | scipy-main/scipy/optimize/tests/test_milp.py | """
Unit test for Mixed Integer Linear Programming
"""
import re
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import pytest
from .test_linprog import magic_square
from scipy.optimize import milp, Bounds, LinearConstraint
from scipy import sparse
def test_milp_iv():
message =... | 14,553 | 36.704663 | 79 | py |
scipy | scipy-main/scipy/optimize/tests/test__differential_evolution.py | """
Unit tests for the differential global minimization algorithm.
"""
import multiprocessing
import platform
from scipy.optimize._differentialevolution import (DifferentialEvolutionSolver,
_ConstraintWrapper)
from scipy.optimize import differential_evolution
from sci... | 61,777 | 40.323077 | 96 | py |
scipy | scipy-main/scipy/optimize/tests/test__linprog_clean_inputs.py | """
Unit test for Linear Programming via Simplex Algorithm.
"""
import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import raises as assert_raises
from scipy.optimize._linprog_util import _clean_inputs, _LPProblem
from copy import deepcopy
from datetime import date
def test... | 11,422 | 36.575658 | 118 | py |
scipy | scipy-main/scipy/optimize/tests/test_quadratic_assignment.py | import pytest
import numpy as np
from scipy.optimize import quadratic_assignment, OptimizeWarning
from scipy.optimize._qap import _calc_score as _score
from numpy.testing import assert_equal, assert_, assert_warns
################
# Common Tests #
################
def chr12c():
A = [
[0, 90, 10, 0, 0, 0,... | 16,309 | 36.75463 | 79 | py |
scipy | scipy-main/scipy/optimize/cython_optimize/setup.py | def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('cython_optimize', parent_package, top_path)
config.add_data_files('*.pxd')
config.add_extension('_zeros', sources='_zeros.c')
return config
if __name__ == '__main__':
... | 411 | 30.692308 | 71 | py |
scipy | scipy-main/scipy/optimize/cython_optimize/__init__.py | """
Cython optimize root finding API
================================
The underlying C functions for the following root finders can be accessed
directly using Cython:
- `~scipy.optimize.bisect`
- `~scipy.optimize.ridder`
- `~scipy.optimize.brenth`
- `~scipy.optimize.brentq`
The Cython API for the root finding functio... | 4,869 | 35.343284 | 79 | py |
scipy | scipy-main/scipy/optimize/_trlib/setup.py | def configuration(parent_package='', top_path=None):
from numpy import get_include
from numpy.distutils.system_info import get_info
from scipy._build_utils import uses_blas64
from numpy.distutils.misc_util import Configuration
from os.path import join, dirname
if uses_blas64():
lapack_... | 1,174 | 36.903226 | 82 | py |
scipy | scipy-main/scipy/optimize/_trlib/__init__.py | from ._trlib import TRLIBQuadraticSubproblem
__all__ = ['TRLIBQuadraticSubproblem', 'get_trlib_quadratic_subproblem']
def get_trlib_quadratic_subproblem(tol_rel_i=-2.0, tol_rel_b=-3.0, disp=False):
def subproblem_factory(x, fun, jac, hess, hessp):
return TRLIBQuadraticSubproblem(x, fun, jac, hess, hessp,... | 524 | 39.384615 | 79 | py |
scipy | scipy-main/scipy/optimize/_lsq/dogbox.py | """
Dogleg algorithm with rectangular trust regions for least-squares minimization.
The description of the algorithm can be found in [Voglis]_. The algorithm does
trust-region iterations, but the shape of trust regions is rectangular as
opposed to conventional elliptical. The intersection of a trust region and
an init... | 11,682 | 34.189759 | 79 | py |
scipy | scipy-main/scipy/optimize/_lsq/least_squares.py | """Generic interface for least-squares minimization."""
from warnings import warn
import numpy as np
from numpy.linalg import norm
from scipy.sparse import issparse
from scipy.sparse.linalg import LinearOperator
from scipy.optimize import _minpack, OptimizeResult
from scipy.optimize._numdiff import approx_derivative,... | 39,522 | 39.998963 | 87 | py |
scipy | scipy-main/scipy/optimize/_lsq/setup.py | def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('_lsq', parent_package, top_path)
config.add_extension('givens_elimination',
sources=['givens_elimination.c'])
return config
if __name__ == '__main__... | 415 | 33.666667 | 60 | py |
scipy | scipy-main/scipy/optimize/_lsq/lsq_linear.py | """Linear least squares with bound constraints on independent variables."""
import numpy as np
from numpy.linalg import norm
from scipy.sparse import issparse, csr_matrix
from scipy.sparse.linalg import LinearOperator, lsmr
from scipy.optimize import OptimizeResult
from scipy.optimize._minimize import Bounds
from .com... | 15,217 | 40.922865 | 79 | py |
scipy | scipy-main/scipy/optimize/_lsq/trf.py | """Trust Region Reflective algorithm for least-squares optimization.
The algorithm is based on ideas from paper [STIR]_. The main idea is to
account for the presence of the bounds by appropriate scaling of the variables (or,
equivalently, changing a trust-region shape). Let's introduce a vector v:
| ub[i] ... | 19,477 | 33.720143 | 83 | py |
scipy | scipy-main/scipy/optimize/_lsq/bvls.py | """Bounded-variable least-squares algorithm."""
import numpy as np
from numpy.linalg import norm, lstsq
from scipy.optimize import OptimizeResult
from .common import print_header_linear, print_iteration_linear
def compute_kkt_optimality(g, on_bound):
"""Compute the maximum violation of KKT conditions."""
g_k... | 5,195 | 27.23913 | 79 | py |
scipy | scipy-main/scipy/optimize/_lsq/common.py | """Functions used by least-squares algorithms."""
from math import copysign
import numpy as np
from numpy.linalg import norm
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from scipy.sparse import issparse
from scipy.sparse.linalg import LinearOperator, aslinearoperator
EPS = np.finfo(float).eps
# Fu... | 20,548 | 26.957823 | 79 | py |
scipy | scipy-main/scipy/optimize/_lsq/__init__.py | """This module contains least-squares algorithms."""
from .least_squares import least_squares
from .lsq_linear import lsq_linear
__all__ = ['least_squares', 'lsq_linear']
| 172 | 27.833333 | 52 | py |
scipy | scipy-main/scipy/optimize/_lsq/trf_linear.py | """The adaptation of Trust Region Reflective algorithm for a linear
least-squares problem."""
import numpy as np
from numpy.linalg import norm
from scipy.linalg import qr, solve_triangular
from scipy.sparse.linalg import lsmr
from scipy.optimize import OptimizeResult
from .givens_elimination import givens_elimination
... | 7,642 | 29.572 | 79 | py |
scipy | scipy-main/scipy/signal/_filter_design.py | """Filter design."""
import math
import operator
import warnings
import numpy
import numpy as np
from numpy import (atleast_1d, poly, polyval, roots, real, asarray,
resize, pi, absolute, sqrt, tan, log10,
arcsinh, sin, exp, cosh, arccosh, ceil, conjugate,
zeros,... | 181,936 | 32.145746 | 105 | py |
scipy | scipy-main/scipy/signal/_lti_conversion.py | """
ltisys -- a collection of functions to convert linear time invariant systems
from one representation to another.
"""
import numpy
import numpy as np
from numpy import (r_, eye, atleast_2d, poly, dot,
asarray, prod, zeros, array, outer)
from scipy import linalg
from ._filter_design import tf2zpk,... | 16,142 | 29.230337 | 99 | py |
scipy | scipy-main/scipy/signal/_max_len_seq_inner.py | # Author: Eric Larson
# 2014
import numpy as np
#pythran export _max_len_seq_inner(int32[], int8[], int, int, int8[])
#pythran export _max_len_seq_inner(int64[], int8[], int, int, int8[])
# Fast inner loop of max_len_seq.
def _max_len_seq_inner(taps, state, nbits, length, seq):
# Here we compute MLS using a shif... | 821 | 33.25 | 78 | py |
scipy | scipy-main/scipy/signal/_short_time_fft.py | """Implementation of an FFT-based Short-time Fourier Transform. """
# Implementation Notes for this file (as of 2023-07)
# --------------------------------------------------
# * MyPy version 1.1.1 does not seem to support decorated property methods
# properly. Hence, applying ``@property`` to methods decorated with ... | 73,105 | 42.671446 | 79 | py |
scipy | scipy-main/scipy/signal/_waveforms.py | # Author: Travis Oliphant
# 2003
#
# Feb. 2010: Updated by Warren Weckesser:
# Rewrote much of chirp()
# Added sweep_poly()
import numpy as np
from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \
exp, cos, sin, polyval, polyint
__all__ = ['sawtooth', 'square', 'gausspulse', 'chirp', 's... | 20,523 | 29.496285 | 79 | py |
scipy | scipy-main/scipy/signal/ltisys.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _ltisys
__all__ = [ # noqa: F822
'lti', 'dlti', 'TransferFunction', 'ZerosPolesGain', 'StateSpace',
'lsim', 'lsim2', 'imp... | 1,470 | 36.717949 | 76 | py |
scipy | scipy-main/scipy/signal/setup.py | from scipy._build_utils import numpy_nodepr_api
from scipy._build_utils import tempita
import os
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
from scipy._build_utils.compiler_helper import set_c_flags_hook
config = Configuration('signal', parent... | 2,412 | 35.560606 | 75 | py |
scipy | scipy-main/scipy/signal/lti_conversion.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _lti_conversion
__all__ = [ # noqa: F822
'tf2ss', 'abcd_normalize', 'ss2tf', 'zpk2ss', 'ss2zpk',
'cont2discrete','eye', ... | 936 | 29.225806 | 79 | py |
scipy | scipy-main/scipy/signal/_bsplines.py | import warnings
from numpy import (logical_and, asarray, pi, zeros_like,
piecewise, array, arctan2, tan, zeros, arange, floor)
from numpy import (sqrt, exp, greater, less, cos, add, sin, less_equal,
greater_equal)
# From splinemodule.c
from ._spline import cspline2d, sepfir2d
fr... | 22,470 | 27.845956 | 89 | py |
scipy | scipy-main/scipy/signal/fir_filter_design.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _fir_filter_design
__all__ = [ # noqa: F822
'kaiser_beta', 'kaiser_atten', 'kaiserord',
'firwin', 'firwin2', 'remez', '... | 1,003 | 28.529412 | 82 | py |
scipy | scipy-main/scipy/signal/_max_len_seq.py | # Author: Eric Larson
# 2014
"""Tools for MLS generation"""
import numpy as np
from ._max_len_seq_inner import _max_len_seq_inner
__all__ = ['max_len_seq']
# These are definitions of linear shift register taps for use in max_len_seq()
_mls_taps = {2: [1], 3: [2], 4: [3], 5: [3], 6: [5], 7: [6], 8: [7, 6, 1],
... | 5,062 | 35.164286 | 154 | py |
scipy | scipy-main/scipy/signal/_wavelets.py | import numpy as np
from scipy.linalg import eig
from scipy.special import comb
from scipy.signal import convolve
__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'morlet2', 'cwt']
def daub(p):
"""
The coefficients for the FIR low-pass filter producing Daubechies wavelets.
p>=1 gives the order of... | 14,132 | 27.551515 | 84 | py |
scipy | scipy-main/scipy/signal/filter_design.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _filter_design
__all__ = [ # noqa: F822
'findfreqs', 'freqs', 'freqz', 'tf2zpk', 'zpk2tf', 'normalize',
'lp2lp', 'lp2hp',... | 1,719 | 39 | 78 | py |
scipy | scipy-main/scipy/signal/wavelets.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _wavelets
__all__ = [ # noqa: F822
'daub', 'qmf', 'cascade', 'morlet', 'ricker', 'morlet2', 'cwt',
'eig', 'comb', 'convol... | 828 | 27.586207 | 76 | py |
scipy | scipy-main/scipy/signal/_ltisys.py | """
ltisys -- a collection of classes and functions for modeling linear
time invariant systems.
"""
#
# Author: Travis Oliphant 2001
#
# Feb 2010: Warren Weckesser
# Rewrote lsim2 and added impulse2.
# Apr 2011: Jeffrey Armstrong <jeff@approximatrix.com>
# Added dlsim, dstep, dimpulse, cont2discrete
# Aug 2013: Jua... | 130,684 | 32.380587 | 83 | py |
scipy | scipy-main/scipy/signal/_fir_filter_design.py | """Functions for FIR filter design."""
from math import ceil, log
import operator
import warnings
import numpy as np
from numpy.fft import irfft, fft, ifft
from scipy.special import sinc
from scipy.linalg import (toeplitz, hankel, solve, LinAlgError, LinAlgWarning,
lstsq)
from scipy._lib.dep... | 49,160 | 36.816154 | 86 | py |
scipy | scipy-main/scipy/signal/signaltools.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _signaltools
__all__ = [ # noqa: F822
'correlate', 'correlation_lags', 'correlate2d',
'convolve', 'convolve2d', 'fftconvo... | 1,401 | 35.894737 | 76 | py |
scipy | scipy-main/scipy/signal/_peak_finding.py | """
Functions for identifying peaks in signals.
"""
import math
import numpy as np
from scipy.signal._wavelets import cwt, ricker
from scipy.stats import scoreatpercentile
from ._peak_finding_utils import (
_local_maxima_1d,
_select_by_peak_distance,
_peak_prominences,
_peak_widths
)
__all__ = ['arg... | 48,807 | 36.20122 | 81 | py |
scipy | scipy-main/scipy/signal/bsplines.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _bsplines
__all__ = [ # noqa: F822
'spline_filter', 'bspline', 'gauss_spline', 'cubic', 'quadratic',
'cspline1d', 'qsplin... | 1,085 | 31.909091 | 76 | py |
scipy | scipy-main/scipy/signal/spectral.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _spectral_py
__all__ = [ # noqa: F822
'periodogram', 'welch', 'lombscargle', 'csd', 'coherence',
'spectrogram', 'stft',... | 944 | 27.636364 | 76 | py |
scipy | scipy-main/scipy/signal/_spectral.py | # Author: Pim Schellart
# 2010 - 2011
"""Tools for spectral analysis of unequally sampled signals."""
import numpy as np
#pythran export _lombscargle(float64[], float64[], float64[])
def _lombscargle(x, y, freqs):
"""
_lombscargle(x, y, freqs)
Computes the Lomb-Scargle periodogram.
Parameters
-... | 1,940 | 22.107143 | 68 | py |
scipy | scipy-main/scipy/signal/waveforms.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal` namespace for importing the functions
# included below.
import warnings
from . import _waveforms
__all__ = [ # noqa: F822
'sawtooth', 'square', 'gausspulse', 'chirp', 'sweep_poly',
'unit_impulse', 'place', '... | 890 | 28.7 | 76 | py |
scipy | scipy-main/scipy/signal/__init__.py | """
=======================================
Signal processing (:mod:`scipy.signal`)
=======================================
Convolution
===========
.. autosummary::
:toctree: generated/
convolve -- N-D convolution.
correlate -- N-D correlation.
fftconvolve -- N-D convolution usi... | 16,116 | 39.494975 | 83 | py |
scipy | scipy-main/scipy/signal/_upfirdn.py | # Code adapted from "upfirdn" python library with permission:
#
# Copyright (c) 2009, Motorola, Inc
#
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must re... | 7,884 | 35.336406 | 78 | py |
scipy | scipy-main/scipy/signal/spline.py | # This file is not meant for public use and will be removed in the future
# versions of SciPy. Use the `scipy.signal` namespace for importing the
# functions included below.
import warnings
from . import _spline
__all__ = [ # noqa: F822
'cspline2d', 'qspline2d', 'sepfir2d', 'symiirorder1', 'symiirorder2']
def... | 810 | 29.037037 | 78 | py |
scipy | scipy-main/scipy/signal/_signaltools.py | # Author: Travis Oliphant
# 1999 -- 2002
import operator
import math
from math import prod as _prod
import timeit
import warnings
from scipy.spatial import cKDTree
from . import _sigtools
from ._ltisys import dlti
from ._upfirdn import upfirdn, _output_len, _upfirdn_modes
from scipy import linalg, fft as sp_fft
from ... | 157,611 | 33.05618 | 85 | py |
scipy | scipy-main/scipy/signal/_spectral_py.py | """Tools for spectral analysis.
"""
import numpy as np
from scipy import fft as sp_fft
from . import _signaltools
from .windows import get_window
from ._spectral import _lombscargle
from ._arraytools import const_ext, even_ext, odd_ext, zero_ext
import warnings
__all__ = ['periodogram', 'welch', 'lombscargle', 'csd',... | 77,910 | 36.242352 | 80 | py |
scipy | scipy-main/scipy/signal/_arraytools.py | """
Functions for acting on a axis of an array.
"""
import numpy as np
def axis_slice(a, start=None, stop=None, step=None, axis=-1):
"""Take a slice along axis 'axis' from 'a'.
Parameters
----------
a : numpy.ndarray
The array to be sliced.
start, stop, step : int or None
The slic... | 7,489 | 29.950413 | 79 | py |
scipy | scipy-main/scipy/signal/_savitzky_golay.py | import numpy as np
from scipy.linalg import lstsq
from scipy._lib._util import float_factorial
from scipy.ndimage import convolve1d
from ._arraytools import axis_slice
def savgol_coeffs(window_length, polyorder, deriv=0, delta=1.0, pos=None,
use="conv"):
"""Compute the coefficients for a 1-D Sav... | 13,417 | 36.480447 | 79 | py |
scipy | scipy-main/scipy/signal/_czt.py | # This program is public domain
# Authors: Paul Kienzle, Nadav Horesh
"""
Chirp z-transform.
We provide two interfaces to the chirp z-transform: an object interface
which precalculates part of the transform and can be applied efficiently
to many different data sets, and a functional interface which is applied
only to ... | 19,445 | 32.760417 | 89 | py |
scipy | scipy-main/scipy/signal/tests/test_array_tools.py | import numpy as np
from numpy.testing import assert_array_equal
from pytest import raises as assert_raises
from scipy.signal._arraytools import (axis_slice, axis_reverse,
odd_ext, even_ext, const_ext, zero_ext)
class TestArrayTools:
def test_axis_slice(self):
a = np.arange(12).reshape(3, 4)
... | 3,632 | 31.4375 | 63 | py |
scipy | scipy-main/scipy/signal/tests/test_dltisys.py | # Author: Jeffrey Armstrong <jeff@approximatrix.com>
# April 4, 2011
import numpy as np
from numpy.testing import (assert_equal,
assert_array_almost_equal, assert_array_equal,
assert_allclose, assert_, assert_almost_equal,
suppress_warnin... | 21,558 | 34.991653 | 78 | py |
scipy | scipy-main/scipy/signal/tests/test_signaltools.py | import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from decimal import Decimal
from itertools import product
from math import gcd
import pytest
from pytest import raises as assert_raises
from numpy.testing import (
assert_equal,
assert_almost_equal, assert_array_equal, assert_array_alm... | 141,168 | 37.226103 | 98 | py |
scipy | scipy-main/scipy/signal/tests/test_ltisys.py | from abc import abstractmethod
import warnings
import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose,
assert_, suppress_warnings)
from pytest import raises as assert_raises
from pytest import warns
from scipy.signal import (ss2tf, tf2ss, lsim2, imp... | 48,251 | 35.861727 | 79 | py |
scipy | scipy-main/scipy/signal/tests/test_czt.py | # This program is public domain
# Authors: Paul Kienzle, Nadav Horesh
'''
A unit test module for czt.py
'''
import pytest
from numpy.testing import assert_allclose
from scipy.fft import fft
from scipy.signal import (czt, zoom_fft, czt_points, CZT, ZoomFFT)
import numpy as np
def check_czt(x):
# Check that czt is ... | 6,993 | 30.790909 | 77 | py |
scipy | scipy-main/scipy/signal/tests/test_short_time_fft.py | """Unit tests for module `_short_time_fft`.
This file's structure loosely groups the tests into the following sequential
categories:
1. Test function `_calc_dual_canonical_window`.
2. Test for invalid parameters and exceptions in `ShortTimeFFT` (until the
`test_from_window` function).
3. Test algorithmic properti... | 33,174 | 39.805658 | 95 | py |
scipy | scipy-main/scipy/signal/tests/_scipy_spectral_test_shim.py | """Helpers to utilize existing stft / istft tests for testing `ShortTimeFFT`.
This module provides the functions stft_compare() and istft_compare(), which,
compares the output between the existing (i)stft() and the shortTimeFFT based
_(i)stft_wrapper() implementations in this module.
For testing add the following imp... | 20,033 | 39.885714 | 81 | py |
scipy | scipy-main/scipy/signal/tests/test_peak_finding.py | import copy
import numpy as np
from numpy.testing import (
assert_,
assert_equal,
assert_allclose,
assert_array_equal
)
import pytest
from pytest import raises, warns
from scipy.signal._peak_finding import (
argrelmax,
argrelmin,
peak_prominences,
peak_widths,
_unpack_condition_arg... | 33,667 | 36.914414 | 89 | py |
scipy | scipy-main/scipy/signal/tests/test_spectral.py | import sys
import numpy as np
from numpy.testing import (assert_, assert_approx_equal,
assert_allclose, assert_array_equal, assert_equal,
assert_array_almost_equal_nulp, suppress_warnings)
import pytest
from pytest import raises as assert_raises
from scipy import ... | 59,640 | 35.860939 | 105 | py |
scipy | scipy-main/scipy/signal/tests/test_wavelets.py | import numpy as np
from numpy.testing import assert_equal, \
assert_array_equal, assert_array_almost_equal, assert_array_less, assert_
import scipy.signal._wavelets as wavelets
class TestWavelets:
def test_qmf(self):
assert_array_equal(wavelets.qmf([1, 1]), [1, -1])
def test_daub(self):
... | 5,977 | 37.818182 | 80 | py |
scipy | scipy-main/scipy/signal/tests/test_result_type.py | # Regressions tests on result types of some signal functions
import numpy as np
from numpy.testing import assert_
from scipy.signal import (decimate,
lfilter_zi,
lfiltic,
sos2tf,
sosfilt_zi)
def test_decimate():
... | 1,627 | 29.716981 | 68 | py |
scipy | scipy-main/scipy/signal/tests/test_windows.py | import pickle
import numpy as np
from numpy import array
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_allclose,
assert_equal, assert_, assert_array_less,
suppress_warnings)
import pytest
from pytest imp... | 41,738 | 46.920781 | 5,222 | py |
scipy | scipy-main/scipy/signal/tests/test_bsplines.py | # pylint: disable=missing-docstring
import numpy as np
from numpy import array
from numpy.testing import (assert_allclose, assert_array_equal,
assert_almost_equal, suppress_warnings)
import pytest
from pytest import raises
import scipy.signal._bsplines as bsp
from scipy import signal
class... | 10,621 | 46.419643 | 79 | py |
scipy | scipy-main/scipy/signal/tests/test_upfirdn.py | # Code adapted from "upfirdn" python library with permission:
#
# Copyright (c) 2009, Motorola, Inc
#
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must re... | 11,240 | 38.03125 | 78 | py |
scipy | scipy-main/scipy/signal/tests/__init__.py | 0 | 0 | 0 | py | |
scipy | scipy-main/scipy/signal/tests/test_savitzky_golay.py | import pytest
import numpy as np
from numpy.testing import (assert_allclose, assert_equal,
assert_almost_equal, assert_array_equal,
assert_array_almost_equal)
from scipy.ndimage import convolve1d
from scipy.signal import savgol_coeffs, savgol_filter
from scipy.sig... | 12,424 | 33.610028 | 78 | py |
scipy | scipy-main/scipy/signal/tests/mpsig.py | """
Some signal functions implemented using mpmath.
"""
try:
import mpmath
except ImportError:
mpmath = None
def _prod(seq):
"""Returns the product of the elements in the sequence `seq`."""
p = 1
for elem in seq:
p *= elem
return p
def _relative_degree(z, p):
"""
Return rela... | 3,308 | 25.902439 | 78 | py |
scipy | scipy-main/scipy/signal/tests/test_cont2discrete.py | import numpy as np
from numpy.testing import \
assert_array_almost_equal, assert_almost_equal, \
assert_allclose, assert_equal
import pytest
from scipy.signal import cont2discrete as c2d
from scipy.signal import dlsim, ss2tf, ss2zpk, lsim, lti
from scipy.signal impor... | 14,605 | 34.026379 | 78 | py |
scipy | scipy-main/scipy/signal/tests/test_fir_filter_design.py | import numpy as np
from numpy.testing import (assert_almost_equal, assert_array_almost_equal,
assert_equal, assert_,
assert_allclose, assert_warns)
from pytest import raises as assert_raises
import pytest
from scipy.fft import fft
from scipy.special import sinc
fro... | 28,932 | 41.863704 | 90 | py |
scipy | scipy-main/scipy/signal/tests/test_max_len_seq.py | import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
from pytest import raises as assert_raises
from numpy.fft import fft, ifft
from scipy.signal import max_len_seq
class TestMLS:
def test_mls_inputs(self):
# can't all be zero state
assert_raises(ValueError, max_len_... | 3,106 | 46.075758 | 79 | py |
scipy | scipy-main/scipy/signal/tests/test_filter_design.py | import warnings
from scipy._lib import _pep440
import numpy as np
from numpy.testing import (assert_array_almost_equal,
assert_array_equal, assert_array_less,
assert_equal, assert_,
assert_allclose, assert_warns, suppress_warnings)
import... | 189,415 | 43.307836 | 254 | py |
scipy | scipy-main/scipy/signal/tests/test_waveforms.py | import numpy as np
from numpy.testing import (assert_almost_equal, assert_equal,
assert_, assert_allclose, assert_array_equal)
from pytest import raises as assert_raises
import scipy.signal._waveforms as waveforms
# These chirp_* functions are the instantaneous frequencies of the signals
#... | 11,975 | 33.022727 | 78 | py |
scipy | scipy-main/scipy/signal/windows/setup.py | def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('windows', parent_package, top_path)
config.add_data_dir('tests')
return config
| 227 | 24.333333 | 63 | py |
scipy | scipy-main/scipy/signal/windows/_windows.py | """The suite of window functions."""
import operator
import warnings
import numpy as np
from scipy import linalg, special, fft as sp_fft
__all__ = ['boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
'blackmanharris', 'flattop', 'bartlett', 'barthann',
'hamming', 'kaiser', 'kaiser_be... | 83,617 | 34.207579 | 227 | py |
scipy | scipy-main/scipy/signal/windows/windows.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.signal.windows` namespace for importing the functions
# included below.
import warnings
from . import _windows
__all__ = [ # noqa: F822
'boxcar', 'triang', 'parzen', 'bohman', 'blackman', 'nuttall',
'blackmanharris'... | 1,117 | 32.878788 | 84 | py |
scipy | scipy-main/scipy/signal/windows/__init__.py | """
Window functions (:mod:`scipy.signal.windows`)
==============================================
The suite of window functions for filtering and spectral estimation.
.. currentmodule:: scipy.signal.windows
.. autosummary::
:toctree: generated/
get_window -- Return a window of a given length and ... | 2,119 | 39 | 77 | py |
scipy | scipy-main/scipy/ndimage/measurements.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.ndimage` namespace for importing the functions
# included below.
import warnings
from . import _measurements
__all__ = [ # noqa: F822
'label', 'find_objects', 'labeled_comprehension',
'sum', 'mean', 'variance', 'st... | 1,015 | 29.787879 | 78 | py |
scipy | scipy-main/scipy/ndimage/_fourier.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 11,385 | 35.967532 | 78 | py |
scipy | scipy-main/scipy/ndimage/setup.py | import os
from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
from numpy import get_include
from scipy._build_utils import numpy_nodepr_api
def configuration(parent_package='', top_path=None):
config = Configuration('ndimage', parent_package, top_path)
include_dirs = ... | 1,474 | 29.102041 | 81 | py |
scipy | scipy-main/scipy/ndimage/_measurements.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 56,013 | 32.441194 | 124 | py |
scipy | scipy-main/scipy/ndimage/_interpolation.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 35,940 | 35.787103 | 82 | py |
scipy | scipy-main/scipy/ndimage/_morphology.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 94,837 | 36.678983 | 90 | py |
scipy | scipy-main/scipy/ndimage/fourier.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.ndimage` namespace for importing the functions
# included below.
import warnings
from . import _fourier
__all__ = [ # noqa: F822
'fourier_gaussian', 'fourier_uniform',
'fourier_ellipsoid', 'fourier_shift'
]
def _... | 816 | 26.233333 | 77 | py |
scipy | scipy-main/scipy/ndimage/_ni_support.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 4,747 | 37.290323 | 76 | py |
scipy | scipy-main/scipy/ndimage/interpolation.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.ndimage` namespace for importing the functions
# included below.
import warnings
from . import _interpolation
__all__ = [ # noqa: F822
'spline_filter1d', 'spline_filter',
'geometric_transform', 'map_coordinates',
... | 909 | 27.4375 | 79 | py |
scipy | scipy-main/scipy/ndimage/_filters.py | # Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | 65,628 | 34.475135 | 90 | py |
scipy | scipy-main/scipy/ndimage/__init__.py | """
=========================================================
Multidimensional image processing (:mod:`scipy.ndimage`)
=========================================================
.. currentmodule:: scipy.ndimage
This package contains various functions for multidimensional image
processing.
Filters
=======
.. autosum... | 5,155 | 29.329412 | 74 | py |
scipy | scipy-main/scipy/ndimage/morphology.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.ndimage` namespace for importing the functions
# included below.
import warnings
from . import _morphology
__all__ = [ # noqa: F822
'iterate_structure', 'generate_binary_structure',
'binary_erosion', 'binary_dilati... | 1,188 | 32.027778 | 77 | py |
scipy | scipy-main/scipy/ndimage/_ni_docstrings.py | """Docstring components common to several ndimage functions."""
from scipy._lib import doccer
__all__ = ['docfiller']
_input_doc = (
"""input : array_like
The input array.""")
_axis_doc = (
"""axis : int, optional
The axis of `input` along which to calculate. Default is -1.""")
_output_doc = (
"""output : ar... | 8,516 | 39.751196 | 79 | py |
scipy | scipy-main/scipy/ndimage/filters.py | # This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.ndimage` namespace for importing the functions
# included below.
import warnings
from . import _filters
__all__ = [ # noqa: F822
'correlate1d', 'convolve1d', 'gaussian_filter1d',
'gaussian_filter', 'prewitt', 'sobe... | 1,193 | 32.166667 | 77 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.