Repository navigation
Conversation
Collaborator
Author
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add `bdsf/tessellate.py`, which provides `pytess_simple` and `pytess_roundness` with the same interface and bit-identical results. Instead of computing the distance of every pixel to every generator, the image is divided into blocks, and distance bounds select the generators that can matter for each block. Only for small blocks on tile boundaries are the distances computed, with the same floating point operations as the Fortran code. Remove the Fortran sources, the f2py module from CMake and MANIFEST.in, and `meson` from the build requirements. Add `test/ttessellate.py` to CI and the cibuildwheel tests, and benchmark scripts and results in `benchmark/replace-pytesselate`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Failed runs of `tbdsf_process_image.py` and `run_psf_vary.py` were only reported, and `compare_fits.py` succeeded without any FITS files to compare. Now each failed step is recorded, and the script lists them and exits with status 1. `compare_fits.py` fails if neither directory contains FITS files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gmloose
force-pushed
the
replace-pytesselate
branch
from
November 9, 2026 16:30
4aa8f57 to
2f8629c
Compare
`pytess_simple` and `pytess_roundness` in `bdsf/tessellate.py` are now `tessellate_simple` and `tessellate_roundness`, and `psf_vary.py` uses `from . import tessellate` instead of aliasing it to `_pytess`. The benchmark scripts map the Fortran names to the new ones, and `record_tess.py` works with either version of `psf_vary.py`. Co-Authored-By: Claude Opus 5.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.
Replaces the Fortran extension
_pytesselate(f2py) with a pure-Python module,bdsf/tessellate.py, withtessellate_simpleandtessellate_roundness, which have the same interface aspytess_simpleandpytess_roundness. Inpsf_vary.pyonly the import (from . import tessellate) and the two calls change.How it works
/ (1 / (r * roundpix))with two roundings, first strict minimum, ignoring NaN and distances ≥1e90). The bounds have a relative margin of1e-9, far above the rounding errors. Every pixel gets the same value as in Fortran, bit for bit.roundness: the tile centroids and pixel counts (integer sums, exact) are collected during the first tessellation. The order-dependent sum of the distances to the centroids is done in the order of the Fortran loop (N.bincountadds sequentially). The memory of the first tessellation is reused for the second.n × minteger array (Fortran:minind), so the peak is the output plus small temporaries.Deviations (undefined behaviour in Fortran)
tessellate_roundnesswith fuzzy tessellation (psf_tess_sc='c'): the Fortran code uses the fuzzy result (sums of tile numbers) as array indices, which writes out of bounds. It crashed (munmap_chunk(): invalid pointer,double free or corruption) for both the test image and NGC6048. Here the tile properties are computed from the normal tessellation. PyBDSF doesn't process fuzzy tessellations, and the default is's'.Build
src/fortran/pytess_simple.f,pytess_roundness.fandconstants.h, the f2py module andfind_package(F2PY)from CMake, the sources fromMANIFEST.in, andmesonfrom the build requirements (needed only by f2py)._cbdsm). The unusedsrc/fortran/gaul2gaulbin.fis left alone.Results
On a 20-core i7-12700 with NumPy 2.4.6, against the
_pytesselateof a build ofmaster. All results are identical to Fortran.End-to-end (
run_comparison.sh):test/tbdsf_process_image.pypasses, and all 48 FITS outputs are identical tomaster.psf_vary_do=True: all 44 FITS outputs (includingvolrankand the PSF maps) are identical, for simple and for roundness tessellation. The tessellation takes 0.12 s instead of 1.21 s (simple), and 0.50 s instead of 3.40 s (roundness).Testing
New
test/ttessellate.py, also added to CI and to the cibuildwheeltest-command. It compares, exactly, with a direct transcription of the Fortran loops (itself checked against_pytesselatein 238 cases), with several block sizes:'s'and'c'roundness)seterr(all='raise')benchmark/replace-pytesselate/contains:Details are in its
DESCRIPTION.md.A wheel built from a clean checkout (
pip wheel ., no f2py) containstessellate.pyand no_pytesselate;tmulti_proc.pyandttessellate.pypass with it. On my machine,tbdsf_process_image.pycrashes in_cbdsmwith such a freshly built wheel, but exactly the same happens with a wheel ofmasterbuilt the same way, so it is unrelated.🤖 Generated with Claude Code