Skip to content

Commit

Permalink
Merge pull request #14393 from peterbell10/ci-not-failing
Browse files Browse the repository at this point in the history
  • Loading branch information
tupui committed Jul 13, 2021
2 parents e53b4fa + 42c2542 commit 1605c31
Show file tree
Hide file tree
Showing 35 changed files with 104 additions and 112 deletions.
10 changes: 7 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ stages:
CXX: g++-4.8
steps:
- script: |
set -e
set -euo pipefail
sudo apt update -y
sudo apt install -y g++-4.8 gcc-4.8
displayName: 'Install GCC 4.8'
Expand All @@ -169,11 +169,14 @@ stages:
- script: >-
python -m pip install
pycodestyle==2.5.0
pyflakes==2.1.1
pyflakes==2.3.1
displayName: 'Install tools'
failOnStderr: false
- script: |
PYFLAKES_NODOCTEST=1 pyflakes scipy benchmarks/benchmarks 2>&1 | grep -E -v 'unable to detect undefined names|assigned to but never used|imported but unused|redefinition of unused|may be undefined, or defined from star imports|syntax error in type comment .ignore.import.' > test.out; cat test.out; test \! -s test.out
set -euo pipefail
PYFLAKES_NODOCTEST=1 pyflakes scipy benchmarks/benchmarks 2>&1 | grep -E -v 'unable to detect undefined names|assigned to but never used|imported but unused|redefinition of unused|may be undefined, or defined from star imports|syntax error in type comment .ignore.import.' > test.out || true
cat test.out
test \! -s test.out
pycodestyle scipy benchmarks/benchmarks
# for Travis CI we used to do: git fetch --unshallow
# but apparently Azure clones are not as shallow
Expand All @@ -193,6 +196,7 @@ stages:
git submodule update --init
displayName: 'Fetch submodules'
- script: |
set -euo pipefail
docker pull i386/ubuntu:bionic
docker run -v $(pwd):/scipy i386/ubuntu:bionic /usr/bin/linux32 /bin/bash -c "cd scipy && \
apt-get -y update && \
Expand Down
1 change: 0 additions & 1 deletion benchmarks/benchmarks/blas_lapack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .common import Benchmark, safe_import

with safe_import():
import scipy.linalg.lapack as la
import scipy.linalg.blas as bla


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup(self):
rng = np.random.default_rng(1234)
m, k = 55, 3
x = np.sort(rng.random(m+1))
c = rng.random((3, m))
c = rng.random((k, m))
self.pp = interpolate.PPoly(c, x)

npts = 100
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import scipy.optimize
from scipy.optimize.optimize import rosen, rosen_der, rosen_hess
from scipy.optimize import (leastsq, basinhopping, differential_evolution,
dual_annealing, OptimizeResult)
dual_annealing)
from scipy.optimize._minimize import MINIMIZE_METHODS


Expand Down
4 changes: 0 additions & 4 deletions benchmarks/benchmarks/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ class FFTConvolve(Benchmark):

def setup(self, mode, size):
rng = np.random.default_rng(1234)
# sample a bunch of pairs of 2d arrays
pairs = []
self.a = rng.standard_normal(size[0])
self.b = rng.standard_normal(size[1])

Expand All @@ -111,8 +109,6 @@ class OAConvolve(Benchmark):

def setup(self, mode, size):
rng = np.random.default_rng(1234)
# sample a bunch of pairs of 2d arrays
pairs = []
self.a = rng.standard_normal(size[0])
self.b = rng.standard_normal(size[1])

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy
import numpy as np
from numpy import ones, array, asarray, empty, random
from numpy import ones, array, asarray, empty

from .common import Benchmark, safe_import

Expand Down
13 changes: 7 additions & 6 deletions benchmarks/benchmarks/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setup(self):
self.a = rng.random((6,3)) * 10
self.b = rng.random((6,3)) * 10
self.c = rng.random((6,3)) * 10

def time_f_oneway(self):
statistic, pvalue = stats.f_oneway(self.a, self.b, self.c)
statistic, pvalue = stats.f_oneway(self.a, self.b, self.c, axis=1)
Expand Down Expand Up @@ -444,19 +444,19 @@ class DistanceFunctions(Benchmark):

def setup(self, n_size):
rng = np.random.default_rng(12345678)
self.u_values= rng.random(n_size) * 10
self.u_values = rng.random(n_size) * 10
self.u_weights = rng.random(n_size) * 10
self.v_values = rng.random(n_size // 2) * 10
self.v_weights = rng.random(n_size // 2) * 10

def time_energy_distance(self, n_size):
distance = stats.energy_distance(
self.u_values, self.v_values,
self.u_values, self.v_values,
self.u_weights, self.v_weights)

def time_wasserstein_distance(self, n_size):
distance = stats.wasserstein_distance(
self.u_values, self.v_values,
self.u_values, self.v_values,
self.u_weights, self.v_weights)


Expand All @@ -465,10 +465,11 @@ class Somersd(Benchmark):
params = [
[10, 100]
]

def setup(self, n_size):
rng = np.random.default_rng(12345678)
self.x = rng.choice(n_size, size=n_size)
self.y = rng.choice(n_size, size=n_size)

def time_somersd(self, n_size):
res = stats.somersd(self.x, self.y)
res = stats.somersd(self.x, self.y)
16 changes: 8 additions & 8 deletions ci/azure-travis-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ steps:

# Build and test SciPy
- script: |
set -e
set -euo pipefail
python -c 'import numpy as np; print("relaxed strides checking:", np.ones((10,1),order="C").flags.f_contiguous)'
python -c 'import mpmath.libmp; assert mpmath.libmp.BACKEND == "gmpy"'
- ${{ if eq(parameters.use_wheel, true) }}:
- script: |
set -e
set -euo pipefail
# Run setup.py build before pip wheel, to build in current directory
# and make more efficient use of ccache
echo "setup.py build"
Expand All @@ -112,7 +112,7 @@ steps:
displayName: 'Install SciPy from Wheel'
- ${{ if eq(parameters.use_sdist, true) }}:
- script: |
set -e
set -euo pipefail
echo "setup.py sdist"
python tools/suppress_output.py python setup.py sdist
# Move out of source directory to avoid finding local scipy
Expand All @@ -124,16 +124,16 @@ steps:
# messes with build isolation.
pip install $PWD/scipy* -v
displayName: 'Install SciPy from SDist'
- script: 'python -u runtests.py -g -j2 --build-only $COVERAGE $USE_WHEEL_BUILD'
- script: 'python -u runtests.py -g -j2 --build-only ${COVERAGE:-} ${USE_WHEEL_BUILD:-}'
env:
${{ if eq(parameters.coverage, true) }}:
COVERAGE: '--coverage --gcov'
${{ if or(eq(parameters.use_wheel, true), eq(parameters.use_sdist, true))}}:
USE_WHEEL_BUILD: '--no-build'
displayName: 'Build SciPy'
- script: |
set -e
python -u runtests.py -g -j2 -m ${{ parameters.test_mode }} $COVERAGE $USE_WHEEL_BUILD -- -rfEX --durations=10 2>&1 | tee runtests.log
set -euo pipefail
python -u runtests.py -g -j2 -m ${{ parameters.test_mode }} ${COVERAGE:-} ${USE_WHEEL_BUILD:-} -- -rfEX --durations=10 2>&1 | tee runtests.log
tools/validate_runtests_log.py ${{ parameters.test_mode }} < runtests.log
env:
${{ if eq(parameters.coverage, true) }}:
Expand All @@ -149,7 +149,7 @@ steps:
displayName: 'Refguide Check'
- ${{ if and(ne(variables['Build.SourceBranch'], 'refs/heads/master'), eq(parameters.asv_check, true)) }}:
- script: |
set -e
set -euo pipefail
cd benchmarks
python -masv check -E existing
# pyfftw missing should raise an error when running benchmarks with SCIPY_ALLOW_BENCH_IMPORT_ERRORS=0
Expand All @@ -160,7 +160,7 @@ steps:
failOnStderr: true
- ${{ if eq(parameters.coverage, true) }}:
- script: |
set -e
set -euo pipefail
RUN_DIR=`echo build/testenv/lib/python*/site-packages`
# Produce gcov output for codecov to find
find build -name '*.gcno' -type f -exec gcov -pb {} +
Expand Down
2 changes: 1 addition & 1 deletion scipy/_lib/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _lazywhere(cond, arrays, f, fillvalue=None, f2=None):
raise ValueError("Only one of (fillvalue, f2) can be given.")

args = np.broadcast_arrays(cond, *arrays)
cond, arrays = args[0], args[1:]
cond, arrays = args[0], args[1:]
temp = tuple(np.extract(cond, arr) for arr in arrays)
tcode = np.mintypecode([a.dtype.char for a in arrays])
out = np.full(np.shape(arrays[0]), fill_value=fillvalue, dtype=tcode)
Expand Down
4 changes: 2 additions & 2 deletions scipy/fft/_fftlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ def _fhtq(a, u, inverse=False):

# check for singular transform or singular inverse transform
if np.isinf(u[0]) and not inverse:
warn(f'singular transform; consider changing the bias')
warn('singular transform; consider changing the bias')
# fix coefficient to obtain (potentially correct) transform anyway
u = u.copy()
u[0] = 0
elif u[0] == 0 and inverse:
warn(f'singular inverse transform; consider changing the bias')
warn('singular inverse transform; consider changing the bias')
# fix coefficient to obtain (potentially correct) inverse anyway
u = u.copy()
u[0] = np.inf
Expand Down
64 changes: 32 additions & 32 deletions scipy/fft/tests/test_fftlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,55 @@ def f(r, mu):

# test 1: compute as given
ours = fht(a, dln, mu, offset=offset, bias=bias)
theirs = [ -0.1159922613593045E-02, 0.1625822618458832E-02,
-0.1949518286432330E-02, 0.3789220182554077E-02,
0.5093959119952945E-03, 0.2785387803618774E-01,
0.9944952700848897E-01, 0.4599202164586588 ,
0.3157462160881342 , -0.8201236844404755E-03,
-0.7834031308271878E-03, 0.3931444945110708E-03,
-0.2697710625194777E-03, 0.3568398050238820E-03,
-0.5554454827797206E-03, 0.8286331026468585E-03 ]
theirs = [-0.1159922613593045E-02, +0.1625822618458832E-02,
-0.1949518286432330E-02, +0.3789220182554077E-02,
+0.5093959119952945E-03, +0.2785387803618774E-01,
+0.9944952700848897E-01, +0.4599202164586588E+00,
+0.3157462160881342E+00, -0.8201236844404755E-03,
-0.7834031308271878E-03, +0.3931444945110708E-03,
-0.2697710625194777E-03, +0.3568398050238820E-03,
-0.5554454827797206E-03, +0.8286331026468585E-03]
assert_allclose(ours, theirs)

# test 2: change to optimal offset
offset = fhtoffset(dln, mu, bias=bias)
ours = fht(a, dln, mu, offset=offset, bias=bias)
theirs = [ 0.4353768523152057E-04, -0.9197045663594285E-05,
0.3150140927838524E-03, 0.9149121960963704E-03,
0.5808089753959363E-02, 0.2548065256377240E-01,
0.1339477692089897 , 0.4821530509479356 ,
0.2659899781579785 , -0.1116475278448113E-01,
0.1791441617592385E-02, -0.4181810476548056E-03,
0.1314963536765343E-03, -0.5422057743066297E-04,
0.3208681804170443E-04, -0.2696849476008234E-04 ]
theirs = [+0.4353768523152057E-04, -0.9197045663594285E-05,
+0.3150140927838524E-03, +0.9149121960963704E-03,
+0.5808089753959363E-02, +0.2548065256377240E-01,
+0.1339477692089897E+00, +0.4821530509479356E+00,
+0.2659899781579785E+00, -0.1116475278448113E-01,
+0.1791441617592385E-02, -0.4181810476548056E-03,
+0.1314963536765343E-03, -0.5422057743066297E-04,
+0.3208681804170443E-04, -0.2696849476008234E-04]
assert_allclose(ours, theirs)

# test 3: positive bias
bias = 0.8
offset = fhtoffset(dln, mu, bias=bias)
ours = fht(a, dln, mu, offset=offset, bias=bias)
theirs = [ -7.343667355831685 , 0.1710271207817100 ,
0.1065374386206564 , -0.5121739602708132E-01,
0.2636649319269470E-01, 0.1697209218849693E-01,
0.1250215614723183 , 0.4739583261486729 ,
0.2841149874912028 , -0.8312764741645729E-02,
0.1024233505508988E-02, -0.1644902767389120E-03,
0.3305775476926270E-04, -0.7786993194882709E-05,
0.1962258449520547E-05, -0.8977895734909250E-06 ]
theirs = [-7.3436673558316850E+00, +0.1710271207817100E+00,
+0.1065374386206564E+00, -0.5121739602708132E-01,
+0.2636649319269470E-01, +0.1697209218849693E-01,
+0.1250215614723183E+00, +0.4739583261486729E+00,
+0.2841149874912028E+00, -0.8312764741645729E-02,
+0.1024233505508988E-02, -0.1644902767389120E-03,
+0.3305775476926270E-04, -0.7786993194882709E-05,
+0.1962258449520547E-05, -0.8977895734909250E-06]
assert_allclose(ours, theirs)

# test 4: negative bias
bias = -0.8
offset = fhtoffset(dln, mu, bias=bias)
ours = fht(a, dln, mu, offset=offset, bias=bias)
theirs = [ 0.8985777068568745E-05, 0.4074898209936099E-04,
0.2123969254700955E-03, 0.1009558244834628E-02,
0.5131386375222176E-02, 0.2461678673516286E-01,
0.1235812845384476 , 0.4719570096404403 ,
0.2893487490631317 , -0.1686570611318716E-01,
0.2231398155172505E-01, -0.1480742256379873E-01,
0.1692387813500801 , 0.3097490354365797 ,
2.759360718240186 , 10.52510750700458 ]
theirs = [+0.8985777068568745E-05, +0.4074898209936099E-04,
+0.2123969254700955E-03, +0.1009558244834628E-02,
+0.5131386375222176E-02, +0.2461678673516286E-01,
+0.1235812845384476E+00, +0.4719570096404403E+00,
+0.2893487490631317E+00, -0.1686570611318716E-01,
+0.2231398155172505E-01, -0.1480742256379873E-01,
+0.1692387813500801E+00, +0.3097490354365797E+00,
+2.7593607182401860E+00, 10.5251075070045800E+00]
assert_allclose(ours, theirs)


Expand Down
1 change: 0 additions & 1 deletion scipy/integrate/_quad_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ def quad_vec(f, a, b, epsabs=1e-200, epsrel=1e-8, norm='2', cache_size=100e6, li
else:
norm_func = norm_funcs[norm]


parallel_count = 128
min_intervals = 2

Expand Down
1 change: 1 addition & 0 deletions scipy/integrate/_quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class AccuracyWarning(Warning):
# workaround for mypy function attributes see:
# https://github.com/python/mypy/issues/2087#issuecomment-462726600
from typing_extensions import Protocol

class CacheAttributes(Protocol):
cache: Dict[int, Tuple[Any, Any]]
else:
Expand Down
3 changes: 0 additions & 3 deletions scipy/linalg/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ def test_simple_her_actuallysym(self):
x = solve(a, b, assume_a='her', lower=lower)
assert_array_almost_equal(dot(a, x), b)


def test_simple_her(self):
a = [[5, 2+1j], [2-1j, -4]]
for b in ([1j, 0],
Expand All @@ -588,8 +587,6 @@ def test_simple_her(self):
x = solve(a, b, assume_a='her')
assert_array_almost_equal(dot(a, x), b)



def test_nils_20Feb04(self):
n = 2
A = random([n, n])+random([n, n])*1j
Expand Down
4 changes: 2 additions & 2 deletions scipy/linalg/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def get_dependencies(self, file):
def grep_dependencies(self, file, deps):
stdout = self.get_dependencies(file)

rdeps = dict([( dep.encode('latin1'),
re.compile(dep.encode('latin1'))) for dep in deps])
rdeps = dict([(dep.encode('latin1'),
re.compile(dep.encode('latin1'))) for dep in deps])
founds = []
for l in stdout.splitlines():
for k, v in rdeps.items():
Expand Down
3 changes: 1 addition & 2 deletions scipy/ndimage/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,7 @@ def zoom(input, zoom, output=None, order=3, mode='constant', cval=0.0,
if suggest_mode is not None:
warnings.warn(
("It is recommended to use mode = {} instead of {} when "
"grid_mode is True."
).format(suggest_mode, mode)
"grid_mode is True.").format(suggest_mode, mode)
)
mode = _ni_support._extend_mode_to_code(mode)

Expand Down
2 changes: 0 additions & 2 deletions scipy/ndimage/tests/test_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ def test_affine_transform_multi_d_endianness_with_output_parameter(self):
result = out if returned is None else returned
assert_array_almost_equal(result, [1])


def test_affine_transform_output_shape(self):
# don't require output_shape when out of a different size is given
data = numpy.arange(8, dtype=numpy.float64)
Expand All @@ -866,7 +865,6 @@ def test_affine_transform_output_shape(self):
ndimage.affine_transform(
data, [[1]], output=out, output_shape=(12,))


def test_affine_transform_with_string_output(self):
data = numpy.array([1])
out = ndimage.affine_transform(data, [[1]], output='f')
Expand Down
3 changes: 2 additions & 1 deletion scipy/optimize/_group_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
def group_dense(m, n, A):
B = A.T # Transposed view for convenience.

groups = -np.ones(n, dtype=np.intp) #FIXME: use np.full once pythran supports it
# FIXME: use np.full once pythran supports it
groups = -np.ones(n, dtype=np.intp)
current_group = 0

union = np.empty(m, dtype=np.intp)
Expand Down
4 changes: 2 additions & 2 deletions scipy/optimize/_highs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def configuration(parent_package='', top_path=None):
if pathlib.Path(s).parent.name != 'mip']
ext = config.add_extension(
'_highs_wrapper',
sources=[join('cython', 'src', '_highs_wrapper.cxx')] + \
highs_sources + ipx_sources,
sources=([join('cython', 'src', '_highs_wrapper.cxx')] +
highs_sources + ipx_sources),
include_dirs=[
# highs_wrapper
'src',
Expand Down

0 comments on commit 1605c31

Please sign in to comment.