Repository navigation
Add color export (PLY/3MF), synthetic data mode, vectorize fix_orientation - #4
Merged
Merged
Conversation
Moredread
force-pushed
the
claude/apply-review-patch-B5Voh
branch
from
May 1, 2026 09:04
e44fa33 to
1c7841e
Compare
…ation * Output format selected by extension: .stl (geometry only, unchanged numpy-stl path), .ply (per-vertex color via trimesh, native PLY support), .3mf (per-vertex color via lib3mf using the Materials Extension - one ColorGroup entry per vertex, referenced per-corner from each triangle). Note: trimesh's own 3MF exporter currently drops vertex colors silently, so the 3MF path uses lib3mf directly. Verified by inspecting the resulting <m:colorgroup> XML. * New --synthetic flag generates a low-l Gaussian random field with a red C_l ~ 1/(l+1)^2 spectrum scaled to ~100 uK RMS. Lets the whole pipeline run end-to-end without the 1 GB Planck FITS file - useful for CI, demos, and offline iteration. Reproducible via --seed. * fix_orientation() vectorized with np.cross + np.einsum over all faces at once. Bit-identical output to the previous loop, ~73x faster at nside=128 (8.5s -> 0.12s on a typical machine). * Mesh construction split into build_displaced_sphere() and build_faces() so each step is unit-testable in isolation. Output dispatch lives in save() with a small per-format helper each. * New tests cover: synthetic generator shape/seed/amplitude, outward-normal invariant after fix_orientation, PLY round-trips per-vertex color, 3MF contains <m:colorgroup> with one entry per vertex, STL still works, unknown extension raises. Update uv.lock for new trimesh and lib3mf dependencies Sync lockfile to match the dependencies added in the previous commit for PLY and 3MF colored output. Add GitHub Actions CI for synthetic tests Runs tests/test_color_and_synthetic.py on Python 3.10/3.11/3.12 using uv. test_end2end.py is excluded because it requires the 1 GB Planck FITS file. Fix e2e tests and enable them in CI The e2e tests in tests/test_end2end.py had three problems: 1. The temp fixture used tempfile.mkstemp() with no suffix, so the new extension-based dispatch in save() rejected the path with ValueError. Fixed by passing suffix=".stl" (and closing the leaked fd while we're here). 2. test_vertex_number_is_correct_for_nside_default compared normals.shape[0] (= triangle count, ~2*npix for a closed convex hull) against npix. Now compares unique vertex count. 3. test_vertex_number_is_correct_for_nside_from_parameter built a set() of ndarray rows, which raises TypeError: unhashable type. Also only looked at v0, missing vertices that aren't a face's first corner. Now collects v0+v1+v2 and dedups as tuples. All four e2e tests now pass under --synthetic, so they no longer need the 1 GB FITS file and are included in CI. Add Planck and IRSA attributions to README Co-Authored-By: Claude <noreply@anthropic.com>
Moredread
force-pushed
the
claude/apply-review-patch-B5Voh
branch
from
May 1, 2026 09:08
1c7841e to
b49d7ee
Compare
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.
Output format selected by extension: .stl (geometry only, unchanged
numpy-stl path), .ply (per-vertex color via trimesh, native PLY
support), .3mf (per-vertex color via lib3mf using the Materials
Extension - one ColorGroup entry per vertex, referenced per-corner
from each triangle).
Note: trimesh's own 3MF exporter currently drops vertex colors
silently, so the 3MF path uses lib3mf directly. Verified by inspecting
the resulting <m:colorgroup> XML.
New --synthetic flag generates a low-l Gaussian random field with a
red C_l ~ 1/(l+1)^2 spectrum scaled to ~100 uK RMS. Lets the whole
pipeline run end-to-end without the 1 GB Planck FITS file - useful
for CI, demos, and offline iteration. Reproducible via --seed.
fix_orientation() vectorized with np.cross + np.einsum over all faces
at once. Bit-identical output to the previous loop, ~73x faster at
nside=128 (8.5s -> 0.12s on a typical machine).
Mesh construction split into build_displaced_sphere() and
build_faces() so each step is unit-testable in isolation. Output
dispatch lives in save() with a small per-format helper each.
New tests cover: synthetic generator shape/seed/amplitude,
outward-normal invariant after fix_orientation, PLY round-trips
per-vertex color, 3MF contains <m:colorgroup> with one entry per
vertex, STL still works, unknown extension raises.