Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change POD default rtol and fix analyze_pickle demo for numpy master #1012

Merged
merged 7 commits into from Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .binder/Dockerfile
Expand Up @@ -5,7 +5,7 @@
# the container, local dev needs it in path from mounted src
# we trick docker into fulfilling both roles via a conditional ONBUILD
# if you want to use the local dev setup, see docker/docker-compose.yml
ARG BASE=pymor/jupyter_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
ARG BASE=pymor/jupyter_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
ARG BUILD_ENV=binder

FROM $BASE as image_binder
Expand Down
78 changes: 39 additions & 39 deletions .ci/gitlab/ci.yml
Expand Up @@ -20,8 +20,8 @@ stages:
except:
- /^staging/.*$/i
variables:
PYPI_MIRROR_TAG: b59ac79e36381fb509ec5a90cfaae5cec4be3a60
CI_IMAGE_TAG: b59ac79e36381fb509ec5a90cfaae5cec4be3a60
PYPI_MIRROR_TAG: d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
CI_IMAGE_TAG: d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
PYMOR_HYPOTHESIS_PROFILE: ci

.pytest:
Expand Down Expand Up @@ -139,7 +139,7 @@ stages:

.sanity_checks:
extends: .test_base
image: pymor/ci_sanity:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/ci_sanity:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
stage: sanity
#******** end definition of base jobs *********************************************************************************#

Expand All @@ -164,18 +164,18 @@ minimal_cpp_demo:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script: ./.ci/gitlab/cpp_demo.bash
mpi 3 6:
extends: .pytest
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -191,9 +191,9 @@ mpi 3 7:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -209,9 +209,9 @@ mpi 3 8:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -227,9 +227,9 @@ notebooks_dir 3 6:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -245,9 +245,9 @@ notebooks_dir 3 7:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -263,9 +263,9 @@ notebooks_dir 3 8:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -281,9 +281,9 @@ pip_installed 3 6:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -299,9 +299,9 @@ pip_installed 3 7:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -317,9 +317,9 @@ pip_installed 3 8:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -335,9 +335,9 @@ vanilla 3 6:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -353,9 +353,9 @@ vanilla 3 7:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -371,9 +371,9 @@ vanilla 3 8:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -389,9 +389,9 @@ numpy_git 3 8:
except:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -407,9 +407,9 @@ oldest 3 6:
except:
- schedules
services:
- name: pymor/pypi-mirror_oldest_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_oldest_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
script:
- |
if [[ "$CI_COMMIT_REF_NAME" == *"github/"* ]]; then
Expand All @@ -426,9 +426,9 @@ ci_weekly 3 6:
only:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.6:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.6:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2

script: ./.ci/gitlab/test_vanilla.bash
ci_weekly 3 7:
Expand All @@ -437,9 +437,9 @@ ci_weekly 3 7:
only:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.7:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.7:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2

script: ./.ci/gitlab/test_vanilla.bash
ci_weekly 3 8:
Expand All @@ -448,9 +448,9 @@ ci_weekly 3 8:
only:
- schedules
services:
- name: pymor/pypi-mirror_stable_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
- name: pymor/pypi-mirror_stable_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
alias: pypi_mirror
image: pymor/testing_py3.8:b59ac79e36381fb509ec5a90cfaae5cec4be3a60
image: pymor/testing_py3.8:d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2

script: ./.ci/gitlab/test_vanilla.bash
submit vanilla 3 6:
Expand Down
7 changes: 6 additions & 1 deletion .ci/gitlab/test_pip_installed.bash
Expand Up @@ -12,7 +12,12 @@ PIP_CLONE_URL="git+${CI_PROJECT_URL}@${CI_COMMIT_SHA}"
# source /tmp/venv/bin/activate
pip install ${PIP_CLONE_URL}
pip uninstall -y pymor
pip install ${PIP_CLONE_URL}#egg=pymor[full]

# this is currently disabled because it erroneously pulls in pyqt5
# pip install ${PIP_CLONE_URL}#egg=pymor[full]
# pip uninstall -y pymor

pip install .[full]
pip uninstall -y pymor
# other requirements are installed from pymor[full]
pip install -r requirements-ci.txt
Expand Down
4 changes: 2 additions & 2 deletions .env
Expand Up @@ -2,6 +2,6 @@ DOCKER_BASE_PYTHON=3.7
PYMOR_TEST_SCRIPT=vanilla
PYPI_MIRROR=stable
PYMOR_TEST_OS=debian_buster
PYPI_MIRROR_TAG=b59ac79e36381fb509ec5a90cfaae5cec4be3a60
CI_IMAGE_TAG=b59ac79e36381fb509ec5a90cfaae5cec4be3a60
PYPI_MIRROR_TAG=d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
CI_IMAGE_TAG=d4cc6ff37b42c8c36d1a4d533399d28fa6c5edb2
PYMOR_HYPOTHESIS_PROFILE=dev
2 changes: 1 addition & 1 deletion src/pymor/algorithms/pod.py
Expand Up @@ -15,7 +15,7 @@


@defaults('rtol', 'atol', 'l2_err', 'method', 'orth_tol')
def pod(A, product=None, modes=None, rtol=4e-8, atol=0., l2_err=0.,
def pod(A, product=None, modes=None, rtol=1e-7, atol=0., l2_err=0.,
method='method_of_snapshots', orth_tol=1e-10):
"""Proper orthogonal decomposition of `A`.

Expand Down
2 changes: 1 addition & 1 deletion src/pymor/algorithms/svd_va.py
Expand Up @@ -15,7 +15,7 @@


@defaults('rtol', 'atol', 'l2_err')
def method_of_snapshots(A, product=None, modes=None, rtol=4e-8, atol=0., l2_err=0.):
def method_of_snapshots(A, product=None, modes=None, rtol=1e-7, atol=0., l2_err=0.):
"""SVD of a |VectorArray| using the method of snapshots.

Viewing the |VectorArray| `A` as a `A.dim` x `len(A)` matrix, the
Expand Down
16 changes: 8 additions & 8 deletions src/pymordemos/analyze_pickle.py
Expand Up @@ -115,8 +115,8 @@ def analyze_pickle_histogram(args):
axHisty = plt.axes(rect_histy)

# scatter plot
total_min = min(min(ests), min(errs)) * 0.9
total_max = max(max(ests), max(errs)) * 1.1
total_min = min(np.min(ests), np.min(errs)) * 0.9
total_max = max(np.max(ests), np.max(errs)) * 1.1
axScatter.set_xscale('log')
axScatter.set_yscale('log')
axScatter.set_xlim([total_min, total_max])
Expand All @@ -137,15 +137,15 @@ def analyze_pickle_histogram(args):
axHisty.set_yticklabels([])
axHistx.set_xlim(axScatter.get_xlim())
axHisty.set_ylim(axScatter.get_ylim())
axHistx.set_ylim([0, max(max(x_hist), max(y_hist))])
axHisty.set_xlim([0, max(max(x_hist), max(y_hist))])
axHistx.set_ylim([0, max(np.max(x_hist), np.max(y_hist))])
axHisty.set_xlim([0, max(np.max(x_hist), np.max(y_hist))])

plt.show()

elif hasattr(rom, 'estimate'):

total_min = min(ests) * 0.9
total_max = max(ests) * 1.1
total_min = np.min(ests) * 0.9
total_max = np.max(ests) * 1.1

hist, bin_edges = np.histogram(ests, bins=_bins(total_min, total_max))
plt.bar(bin_edges[1:], hist, width=bin_edges[:-1] - bin_edges[1:], color='blue')
Expand All @@ -157,8 +157,8 @@ def analyze_pickle_histogram(args):

elif args['--detailed']:

total_min = min(ests) * 0.9
total_max = max(ests) * 1.1
total_min = np.min(ests) * 0.9
total_max = np.max(ests) * 1.1

hist, bin_edges = np.histogram(errs, bins=_bins(total_min, total_max))
plt.bar(bin_edges[1:], hist, width=bin_edges[:-1] - bin_edges[1:], color='blue')
Expand Down
7 changes: 3 additions & 4 deletions src/pymortests/algorithms/basic.py
Expand Up @@ -196,14 +196,13 @@ def test_almost_equal_incompatible(vector_arrays):

@given(pyst.base_vector_arrays(count=2))
@settings(deadline=None)
def test_project_array(bases):
U = bases[0][:-2]
basis = bases[1]
def test_project_array(arrays):
U, basis = arrays
U_p = project_array(U, basis, orthonormal=False)
onb = gram_schmidt(basis)
U_p2 = project_array(U, onb, orthonormal=True)
err = relative_error(U_p, U_p2)
tol = 3e-10
tol = np.finfo(np.float64).eps * np.linalg.cond(basis.gramian()) * 100.
assert np.all(err < tol)


Expand Down
2 changes: 1 addition & 1 deletion src/pymortests/strategies.py
Expand Up @@ -382,7 +382,7 @@ def base_vector_arrays(draw, count=1, dtype=None, max_dim=100):
length = space.dim

# this lets hypothesis control np's random state too
random = draw(hyst.randoms())
random = draw(hyst.random_module())
renefritze marked this conversation as resolved.
Show resolved Hide resolved
# scipy performs this check although technically numpy accepts a different range
assume(0 <= random.seed < 2**32 - 1)
random_correlation = random_correlation_gen(random.seed)
Expand Down