Skip to content

1.5: fix Size_Inner_Difference in Delboeuf/Ebbinghaus, repair the README workflow - #23

Open
DominiqueMakowski wants to merge 6 commits into
masterfrom
dev
Open

DominiqueMakowski wants to merge 6 commits into
masterfrom
dev

Conversation

@DominiqueMakowski

Copy link
Copy Markdown
Member

Bugfix release. Two independent fixes, one commit each.

Size_Inner_Difference was not a difference of areas

Delboeuf and Ebbinghaus both reported a wrong value from get_parameters():

np.pi * (size_bigger / 2) ** 2 / np.pi * (size_min / 2) ** 2

Since * and / associate left to right this evaluates as (pi * a**2 / pi) * b**2 — the product
of the two squared radii, which is not an area difference and does not even have the units of one. It
returned 0.000244140625 for two circles of identical size.

It is now the signed difference between the areas of the two inner circles, positive when the left one
is larger — which is what the docstring in both classes always described. Signed rather than absolute
follows that wording and matches Angle_Difference in RodFrame, the only other difference-style key
in the package. (An area ratio was the other candidate reading, but it works out to exactly
1 + abs(difference), so it would just restate Difference.)

Ebbinghaus was affected because it reuses _delboeuf_parameters_sizeinner() and never overwrites the
key. A scan of every other *_parameters.py found no further instances of this pattern — these two
were the only ones.

Also fixes the entry's name in both class docstrings, where it was listed as Sine_Inner_Difference.

Covered by a new regression test over both illusions, checked to fail against the old expression.

⚠️ This changes user-facing output. Anything that logged Size_Inner_Difference will report
different numbers. The old value was never meaningful, so nothing correct can have depended on it, but
it may appear in existing analysis columns.

The Render README workflow could not run

It failed at Install Python with a bundled-PAT rate-limit error from remotes::install_github().
rstudio/reticulate is alive and the URL in the error resolves fine, so this was never a moved
repository — an unauthenticated install_github() just gets rate limited on shared runners. reticulate
now comes from CRAN; the development version was not needed.

Two further blockers sat behind that one, which the run never got far enough to hit:

  • README.Rmd imports pyllusion in 26 chunks, but the workflow installed only Pillow and scipy. It now
    pip-installs the package itself.
  • README.Rmd called reticulate::use_python() on a hard-coded Windows path belonging to one
    contributor's machine. That call is now skipped when CI is set or the path is missing, and the
    workflow points reticulate at its own interpreter via RETICULATE_PYTHON.

Plus: install_miniconda() replaced with actions/setup-python, unused dplyr dropped, job moved to
ubuntu-latest with public RSPM, contents: write granted for the commit step, an explicit push
refspec instead of a bare git push origin, and regenerated figures in docs/img committed alongside
README.md.

Not verified end to end — it only runs on a push that touches README.Rmd, and there is no R in the
environment this was written in, so the render itself is untested.

Note on releasing

1.4 is already on PyPI, so this bumps __version__ to 1.5. Since the publish workflow runs on every
push to master with skip-existing, merging this will publish 1.5 — worth holding until you want
that, or dropping the version bump and doing it separately.

🤖 Generated with Claude Code

DominiqueMakowski and others added 2 commits September 19, 2026 10:46
`Size_Inner_Difference` was computed as

    np.pi * (size_bigger / 2) ** 2 / np.pi * (size_min / 2) ** 2

which, since * and / associate left to right, evaluates as
`(pi * a**2 / pi) * b**2` -- the product of the two squared radii, not a
difference of areas. It reported 0.000244140625 for two circles of
identical size, and never had the units of an area.

It is now the signed difference between the areas of the two inner
circles, positive when the left one is larger, which is what the
docstring in both classes has always described ("Difference in areas of
the left and right inner circles"). Signed rather than absolute follows
that wording and matches RodFrame's Angle_Difference, the only other
difference-style key in the package.

Ebbinghaus was affected too: it reuses _delboeuf_parameters_sizeinner()
and never overwrites the key. A scan of the other *_parameters.py files
found no further instances of this pattern.

Also corrects the entry's name in both class docstrings, where it was
listed as `Sine_Inner_Difference`.

Adds a regression test covering both illusions, verified to fail against
the old expression. Version bumped to 1.5 since 1.4 is already published
and this changes user-facing output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The workflow failed at "Install Python" with

    Using bundled GitHub PAT. Please add your own PAT using gitcreds::gitcreds_set()
    Error: Failed to install 'unknown package' from GitHub:
      cannot open URL '.../repos/rstudio/reticulate/contents/DESCRIPTION?ref=HEAD'

rstudio/reticulate is alive and that path resolves fine, so this is not a
moved repository: an unauthenticated remotes::install_github() falls back
to the bundled PAT and gets rate limited on shared runners. reticulate is
now installed from CRAN, which needs no token; the development version
was never needed here.

Two further blockers behind that one, which the run never reached:

- README.Rmd imports pyllusion in 26 chunks, but the workflow only
  installed Pillow and scipy, so every chunk would have failed. It now
  installs the package itself via pip, which brings in its dependencies.
- README.Rmd called reticulate::use_python() on a hard-coded Windows path
  belonging to a specific contributor's machine, which does not exist on
  a runner. That call is now skipped when CI is set or the path is
  missing, and the workflow points reticulate at its own interpreter
  through RETICULATE_PYTHON.

Also replaces install_miniconda() with actions/setup-python (much faster
and no conda needed), drops the unused dplyr dependency, moves the job to
ubuntu-latest with public RSPM for binary R packages, grants the
contents:write permission the commit step needs, pushes with an explicit
refspec rather than a bare `git push origin`, and commits regenerated
figures in docs/img alongside README.md.

Not verified end to end: it needs a push to run, and there is no R in
this environment to render README.Rmd locally.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 19, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The workflow must stop masking git push failures before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Bugfix release correcting inner-circle area differences for Delboeuf/Ebbinghaus and repairing the README rendering workflow.

Changes:

  • Fixes signed area-difference calculations and documentation.
  • Adds regression coverage and bumps the version to 1.5.
  • Updates CI dependency installation and Python configuration.
  • Critical finding: the workflow masks git push failures with || echo.
File Description
tests/​__init__.py Adds regression coverage.
README.Rmd Makes Python selection CI-safe.
pyllusion/​Ebbinghaus/​Ebbinghaus.py Updates parameter documentation.
pyllusion/​Delboeuf/​Delboeuf.py Updates parameter documentation.
pyllusion/​Delboeuf/​delboeuf_parameters.py Corrects area-difference calculation.
pyllusion/​__init__.py Bumps package version to 1.5.
NEWS.rst Documents the fixes and release changes.
.github/​workflows/​readme.yml Reworks the README rendering workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/readme.yml Outdated
DominiqueMakowski and others added 3 commits September 19, 2026 11:00
README.md had been hand-edited to cite the published paper (Makowski et
al., 2021, Perception), but README.Rmd still carried the pre-publication
2020 "Retrieved from GitHub" citation. Nobody noticed because the render
workflow had been broken, so the source was never rebuilt over the
hand-edit.

Repairing the workflow made it run, and the re-render duly replaced the
published citation with the stale one. Fixing it at the source, which is
where it belongs, since README.md is generated and hand-edits to it get
overwritten.

Copied verbatim from the pre-render README.md rather than retyped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Addresses Copilot's review on #23. The push was guarded with
`|| echo "Nothing to push"`, which would report a green run even when
the push failed for a real reason -- bad auth, branch protection, or a
non-fast-forward -- leaving the regenerated README and figures unpushed
while the job claimed success.

The guard was never needed: a push with nothing to send exits 0
(verified: "Everything up-to-date", exit 0). The only case that genuinely
needed handling was `git commit` failing when the render changed nothing,
so that is now tested for explicitly with `git diff --staged --quiet` and
both the commit and the push run unguarded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants