Skip to content

Commit

Permalink
Updated minimum python version and test outputs (#221)
Browse files Browse the repository at this point in the history
* updated minimum python version and test outputs

* upload results images

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updating figures

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
dfm and pre-commit-ci[bot] committed Mar 5, 2023
1 parent cff8d1a commit 9ea2436
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 41 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]
nox-session: ["tests"]
include:
- os: macos-latest
Expand All @@ -42,20 +42,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.nox-session }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.nox-session }}-
- name: Cache nox session files
uses: actions/cache@v3
with:
path: .nox
key: ${{ runner.os }}-nox-${{ matrix.nox-session }}-${{ hashFiles('**/noxfile.py') }}
restore-keys: |
${{ runner.os }}-nox-${{ matrix.nox-session }}-
- name: Cache pre-commit environments
if: ${{ matrix.nox-session == 'lint' }}
uses: actions/cache@v3
Expand All @@ -70,6 +56,12 @@ jobs:
python -m pip install -U nox
- name: Run tests
run: python -m nox --non-interactive -s ${{ matrix.nox-session }}
- name: Upload generated images on failure
uses: actions/upload-artifact@v3
if: ${{ failure() && matrix.nox-session == 'tests' }}
with:
name: images-${{ matrix.os }}-${{ matrix.python-version }}
path: ./result_images

release:
if: ${{ inputs.prerelease || startsWith(github.ref, 'refs/tags/') }}
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "corner"
description = "Make some beautiful corner plots"
authors = [{ name = "Dan Foreman-Mackey", email = "foreman.mackey@gmail.com" }]
readme = "README.md"
requires-python = ">=3.6"
requires-python = ">=3.9"
license = { text = "BSD 2-Clause License" }
classifiers = [
"Operating System :: OS Independent",
Expand All @@ -20,7 +20,7 @@ dependencies = ["matplotlib>=2.1"]
"Bug Tracker" = "https://github.com/dfm/corner.py/issues"

[project.optional-dependencies]
test = ["pytest"]
test = ["pytest", "arviz>=0.9", "scipy"]
arviz = ["arviz>=0.9"]
docs = ["arviz>=0.9", "sphinx>=1.7.5", "pandoc", "myst-nb", "sphinx-book-theme", "ipython"]

Expand Down
Binary file added tests/baseline_images/test_corner/bins.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/baseline_images/test_corner/bins_log.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/baseline_images/test_corner/smooth1.png
Binary file not shown.
Binary file removed tests/baseline_images/test_corner/smooth1_log.png
Binary file not shown.
Binary file not shown.
Binary file modified tests/baseline_images/test_hist2d/backgroundSolarized.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 11 additions & 15 deletions tests/test_corner.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_basic():
baseline_images=["basic_log"], remove_text=True, extensions=["png"]
)
def test_basic_log():
fig = _run_corner(exp_data=True, axes_scale="log")
_run_corner(exp_data=True, axes_scale="log")


@image_comparison(
Expand Down Expand Up @@ -185,32 +185,32 @@ def test_overplot_log():


@image_comparison(
baseline_images=["smooth1"], remove_text=True, extensions=["png"]
baseline_images=["bins"], remove_text=True, extensions=["png"]
)
def test_smooth1():
_run_corner(bins=50)
def test_bins():
_run_corner(bins=25)


@image_comparison(
baseline_images=["smooth1_log"], remove_text=True, extensions=["png"]
baseline_images=["bins_log"], remove_text=True, extensions=["png"]
)
def test_smooth1_log():
_run_corner(exp_data=True, axes_scale="log", bins=50)
def test_bins_log():
_run_corner(exp_data=True, axes_scale="log", bins=25)


@pytest.mark.skipif(not scipy_installed, reason="requires scipy for smoothing")
@image_comparison(
baseline_images=["smooth2"], remove_text=True, extensions=["png"]
baseline_images=["smooth"], remove_text=True, extensions=["png"]
)
def test_smooth2():
def test_smooth():
_run_corner(bins=50, smooth=1.0)


@pytest.mark.skipif(not scipy_installed, reason="requires scipy for smoothing")
@image_comparison(
baseline_images=["smooth2_log"], remove_text=True, extensions=["png"]
baseline_images=["smooth_log"], remove_text=True, extensions=["png"]
)
def test_smooth2_log():
def test_smooth_log():
_run_corner(exp_data=True, axes_scale="log", bins=50, smooth=1.0)


Expand Down Expand Up @@ -322,10 +322,6 @@ def test_extended_overplotting():
[4 * nsamples // 5, ndim]
)
mean = 4 * np.random.rand(ndim)
data2 = mean[None, :] + np.random.randn(ndim * nsamples // 5).reshape(
[nsamples // 5, ndim]
)
samples = np.vstack([data1, data2])

value1 = mean
# This is the empirical mean of the sample:
Expand Down
9 changes: 0 additions & 9 deletions tests/test_hist2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ def test_backgroundSolarized():
pl.style.use("default")


@image_comparison(
baseline_images=["backgroundSeaborn"], remove_text=True, extensions=["png"]
)
def test_backgroundSeaborn():
pl.style.use("seaborn")
_run_hist2d("backgroundSeaborn")
pl.style.use("default")


@image_comparison(
baseline_images=["backgroundColor"], remove_text=True, extensions=["png"]
)
Expand Down

0 comments on commit 9ea2436

Please sign in to comment.