From 2e1d75afbb6f6f5b9ed4da5f2e54419c5d5b00a7 Mon Sep 17 00:00:00 2001 From: Casper van Elteren Date: Thu, 30 Jan 2025 13:53:02 +0100 Subject: [PATCH] Revert "Add baseline comparison to workflow (#45)" This reverts commit fe084563c554a8dfe66eedb94214383dae88b233. --- .github/workflows/build-ultraplot.yml | 60 ++++++++++----------------- ultraplot/ticker.py | 12 ++---- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index a31a901c8..e082dd60c 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -35,41 +35,27 @@ jobs: micromamba activate ultraplot-dev pytest - compare-baseline: - needs: build-ultraplot - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: mamba-org/setup-micromamba@v2.0.4 - with: - environment-file: ./environment.yml - init-shell: bash - create-args: >- - --verbose - python=${{ inputs.python-version }} - cache-environment: true - cache-downloads: false - - - name: Generate baseline from main - shell: bash -el {0} - run: | - mkdir -p baseline - micromamba activate ultraplot-dev - git fetch origin ${{ github.event.pull_request.base.sha }} - git checkout ${{ github.event.pull_request.base.sha }} - pytest --mpl-generate-path=baseline_images - git checkout ${{ github.sha }} # Return to PR branch + # Skip pytest-mpl for now as it removes the RC file + # Future should include it though! See https://github.com/matplotlib/pytest-mpl/issues/236 + # - name: Generate baseline from main + # shell: bash -el {0} + # run: | + # mkdir -p baseline + # micromamba activate ultraplot-dev + # git fetch origin ${{ github.event.pull_request.base.sha }} + # git checkout ${{ github.event.pull_request.base.sha }} + # pytest --mpl-generate-path=baseline_images + # git checkout ${{ github.sha }} # Return to PR branch + # - name: Image Comparison Ultraplot + # shell: bash -el {0} + # run: | + # micromamba activate ultraplot-dev + # pytest --mpl --mpl-baseline-path=baseline_images - - name: Image Comparison Ultraplot - shell: bash -el {0} - run: | - micromamba activate ultraplot-dev - pytest --mpl-generate-path=baseline_images --mpl-default-style $(python -c "import ultraplot as plt; print(plt.config.Configurator())") - - # return the images that failed - - name: Upload comparison failures - if: failure() - uses: actions/upload-artifact@v4 - with: - name: failed-comparisons - path: result_images + # # return the images that failed + # - name: Upload comparison failures + # if: failure() + # uses: actions/upload-artifact@v4 + # with: + # name: failed-comparisons + # path: result_images diff --git a/ultraplot/ticker.py b/ultraplot/ticker.py index fefe13170..670f532ef 100644 --- a/ultraplot/ticker.py +++ b/ultraplot/ticker.py @@ -241,15 +241,9 @@ def tick_values(self, vmin, vmax): # noqa: U100 step = step // i break diff = np.abs(np.diff(locs[: step + 1 : step])) - - if diff.size: - matches = np.where(np.isclose(locs % diff, 0.0))[0] - offset = matches[0] if len(matches) else np.argmin(np.abs(locs)) - else: - offset = np.argmin(np.abs(locs)) - return locs[ - int(offset) % step :: step - ] # even multiples from zero or zero-close + (offset,) = np.where(np.isclose(locs % diff if diff.size else 0.0, 0.0)) + offset = offset[0] if offset.size else np.argmin(np.abs(locs)) + return locs[offset % step :: step] # even multiples from zero or zero-close class DegreeLocator(mticker.MaxNLocator):