refactor: dedupe FootprintPlotter, import from cs_util#186
Open
cailmdaley wants to merge 1 commit intodevelopfrom
Open
refactor: dedupe FootprintPlotter, import from cs_util#186cailmdaley wants to merge 1 commit intodevelopfrom
cailmdaley wants to merge 1 commit intodevelopfrom
Conversation
The FootprintPlotter class was duplicated between sp_validation and cs_util, with the sp_validation copy stale (missing vmin, milky way, extent enforcement). Delete the local copy and re-export cs_util's version for API compatibility. Bump the cs_util dep to >=0.1.9 to guarantee the import resolves. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Live smoke test passed inside the shapepipe container (Python 3.12, cs_util 0.1.9): Re-export is transparent; same class object is returned, |
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
FootprintPlotterwas duplicated betweensp_validation.plotsandcs_util.plots, with the local copy stale relative to the canonical cs_util version. Delete the sp_validation copy and re-export cs_util's class so the public surface (from sp_validation.plots import FootprintPlotter) is unchanged.What diverged
The sp_validation copy was missing improvements that had landed in cs_util:
vminkwarg onplot_area/_regionsdraw_milky_waycallset_autorescale(False)+set_extent(extend)enforcementBoth versions share the same
__init__signature(nside_coverage=32, nside_map=2048)and the same public methods (create_hsp_map,plot_area,plot_region,plot_all_regions,plot_footprint_as_hp,hp_pixel_centers). cs_util's API is a superset; nothing removed.Backward compatibility
FootprintPlotteris re-imported at module top level insp_validation/plots.py, so every existing import path keeps working:from sp_validation.plots import FootprintPlotter— still worksfrom sp_validation.cosmo_val import FootprintPlotter— still works (via cosmo_val's own re-import)from sp_validation.plots import *— still picks it upCaller audit
Grepped the repo for
FootprintPlotter; every caller was inspected:src/sp_validation/cosmo_val.py:1011—FootprintPlotter()+create_hsp_map+plot_region(hsp_map, fp._regions[region], outpath=...). Compatible.notebooks/demo_create_footprint_mask.py:95— same usage viacosmo_val.FootprintPlotter(). Compatible.notebooks/cosmo_val/catalog_paper_plot/plot_gaia_sky.py:100,138—FootprintPlotter(nside_coverage=32, nside_map=2048)andplot_area(..., vmax=...).vmaxis still a keyword arg in cs_util's signature. Compatible.No caller passes
vmaxto__init__(the stale class didn't accept it either); no caller assumesautorescale=True; no caller reads_regions[*]expecting the absence ofvmin.Visual deltas to expect
Callers will now see the cs_util improvements on footprint plots: the Milky Way overlay, axis labels, and enforced extents. Color scaling will start at
vmin=0rather than matplotlib auto, which matches the implicit previous behavior for count maps.Other changes
pyproject.toml: bumpedcs_util>=0.1.5tocs_util>=0.1.9to guarantee the import resolves.Test plan
cosmo_val.CosmoVal.plot_footprintsand confirm NGC/SGC/fullsky plots render.notebooks/cosmo_val/catalog_paper_plot/plot_gaia_sky.pyend-to-end.from sp_validation.plots import FootprintPlotterandfrom sp_validation.cosmo_val import FootprintPlotterresolve to the cs_util class.Generated with Claude Code (Opus 4.7, 1M context).