Refactor montage.jl: shared helpers and thin wrappers#1929
Merged
Conversation
…recompilations
- Extract _montage_setup_frame!, _montage_divlines!, _montage_panels_size_str,
_montage_adjust_margins! as shared helpers used by all three montage methods.
- Add thin outer wrappers that convert kw... to Dict immediately, calling typed
inner functions (_montage_images, _montage_cube, _montage_choro) to avoid
kwargs-driven method explosion.
- Replace nothing defaults with concrete sentinels: "" for strings, (0,0) for
grid, Int[] for indices, false for divlines.
- Add type annotations to helper signatures (Dict, String, Bool, Vector{Int}).
- montage(GI) individual-CPT path now uses _montage_adjust_margins! for smart
margin spacing with titles and colorbars.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1929 +/- ##
=========================================
Coverage ? 85.47%
=========================================
Files ? 187
Lines ? 27816
Branches ? 0
=========================================
Hits ? 23777
Misses ? 4039
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
_montage_setup_frame!,_montage_divlines!,_montage_panels_size_str,_montage_adjust_margins!) to deduplicate logic across the threemontagemethods.kw...→Dictimmediately, calling typed inner functions (_montage_images,_montage_cube,_montage_choro) to reduce kwargs-driven recompilations.nothingdefaults with concrete sentinels ("",(0,0),Int[],false) and add type annotations to helper signatures.montage(GI)individual-CPT path now uses_montage_adjust_margins!for smart margin spacing with titles/colorbars.Test plan
montage(G)— 3D cube with shared CPTmontage(G, cmap_mode=:individual, colorbar=true, titles="auto")— individual CPT + margin auto-adjustmentmontage(G, divlines=0.5)— divlinesmontage(G, cmap_mode=:individual, B=:a, colorbar=true)— annotationsmontage(imgs, grid=(2,2), panels_size=5)— image montagemontage(G, Vd=2)— dry run to inspect commands🤖 Generated with Claude Code