1.5: fix Size_Inner_Difference in Delboeuf/Ebbinghaus, repair the README workflow - #23
Open
DominiqueMakowski wants to merge 6 commits into
Open
DominiqueMakowski wants to merge 6 commits into
DominiqueMakowski wants to merge 6 commits into
Conversation
`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>
There was a problem hiding this comment.
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
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 pushfailures 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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Bugfix release. Two independent fixes, one commit each.
Size_Inner_Differencewas not a difference of areasDelboeufandEbbinghausboth reported a wrong value fromget_parameters():Since
*and/associate left to right this evaluates as(pi * a**2 / pi) * b**2— the productof the two squared radii, which is not an area difference and does not even have the units of one. It
returned
0.000244140625for 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_DifferenceinRodFrame, the only other difference-style keyin the package. (An area ratio was the other candidate reading, but it works out to exactly
1 + abs(difference), so it would just restateDifference.)Ebbinghauswas affected because it reuses_delboeuf_parameters_sizeinner()and never overwrites thekey. A scan of every other
*_parameters.pyfound no further instances of this pattern — these twowere 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.
Size_Inner_Differencewill reportdifferent 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/reticulateis alive and the URL in the error resolves fine, so this was never a movedrepository — an unauthenticated
install_github()just gets rate limited on shared runners. reticulatenow 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.Rmdimports pyllusion in 26 chunks, but the workflow installed only Pillow and scipy. It nowpip-installs the package itself.
README.Rmdcalledreticulate::use_python()on a hard-coded Windows path belonging to onecontributor's machine. That call is now skipped when
CIis set or the path is missing, and theworkflow points reticulate at its own interpreter via
RETICULATE_PYTHON.Plus:
install_miniconda()replaced withactions/setup-python, unuseddplyrdropped, job moved toubuntu-latestwith public RSPM,contents: writegranted for the commit step, an explicit pushrefspec instead of a bare
git push origin, and regenerated figures indocs/imgcommitted alongsideREADME.md.Not verified end to end — it only runs on a push that touches
README.Rmd, and there is no R in theenvironment 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 everypush to
masterwithskip-existing, merging this will publish 1.5 — worth holding until you wantthat, or dropping the version bump and doing it separately.
🤖 Generated with Claude Code