WCS/catalog refactor, photometry and zeropoint reliability, and FITS header fixes#83
Merged
Conversation
- Introduced `validate_existing_wcs_header` function to check for valid celestial WCS in FITS headers, ensuring required keywords are present and usable. - Added `--skip-external-astrometry` option to command-line arguments, allowing users to bypass astrometry.net and Gaia if a valid WCS is already defined in the header. - Updated `test_for_dependencies` to conditionally check for astrometry.net based on the new option. - Enhanced `align_images` and `image_proc` functions to support the new external astrometry skipping behavior, including appropriate logging and header validation. - Added unit tests for the new WCS validation functionality to ensure robustness and correctness.
- Updated the `utilities.py` module to re-export catalog-related functions for better organization and backward compatibility. - Refactored `absphot.py` and `solve_wcs.py` to utilize the new catalog functions, enhancing clarity and maintainability. - Introduced new command-line options for fine WCS alignment, allowing users to specify the reference catalog and skip alignment if desired. - Updated tests to reflect changes in function names and ensure robust coverage for the new alignment process. - Enhanced documentation to include new functions and options related to fine alignment.
- Introduced `fix_deprecated_wcs_header_cards` function to normalize WCS-related FITS header cards, addressing deprecated keywords like `RADECSYS` and `MJD-OBS`. - Updated the `import_image` method in the `GMOS` class to utilize the new header normalization function, preventing warnings during WCS parsing. - Enhanced sky frame processing logic to handle varying numbers of frames more robustly, ensuring proper median calculation and masking. - Added unit tests for the new header normalization functionality to ensure correctness and prevent regressions.
- Introduced a new `PhotometryError` exception to handle cases where photometry fails due to insufficient star detection or S/N threshold issues. - Updated the `do_phot` and `photloop` functions to raise `PhotometryError` with informative messages when no stars are detected or when photometry cannot be completed. - Enhanced logging to provide detailed feedback during photometry attempts, including the S/N thresholds tried and the reasons for failure. - Refactored the `find_zeropoint` function to improve error handling when the APPPHOT extension is missing from the FITS file. - Added unit tests to ensure proper handling of missing APPPHOT scenarios and validate the new error messages.
- Introduced `_normalize_daofind_catalog` function to ensure compatibility with different versions of photutils by mapping `x_centroid` and `y_centroid` to `xcentroid` and `ycentroid`. - Enhanced error handling in `get_star_catalog` to raise `PhotometryError` when no stars are detected. - Added unit tests for the new normalization function to validate behavior across various input scenarios, including legacy column names and missing centroid columns.
- Improved the `PhotometryError` exception handling to provide clearer messages for various failure scenarios in photometry. - Updated the `do_phot` and `photloop` functions to ensure informative error reporting when star detection fails or photometry cannot be completed. - Enhanced logging capabilities to give detailed feedback during photometry attempts, including S/N thresholds and reasons for failure. - Refactored the `find_zeropoint` function to better manage errors related to missing APPPHOT extensions in FITS files. - Added unit tests to validate the new error handling and logging improvements.
- Enhanced the `photometry.py` module to support both photutils 1.x and 2.x by conditionally importing `PSFPhotometry` and providing a fallback to `BasicPSFPhotometry`. - Improved the `_normalize_daofind_catalog` function to handle deprecated column names and ensure compatibility with different photutils versions. - Added defensive checks in `extract_aperture_stats` and `get_star_catalog` to manage variations in star catalog outputs. - Updated unit tests to validate the new functionality and ensure proper handling of legacy and current column names.
…ndling - Updated the `extract_aperture_stats` and `get_star_catalog` functions to enhance compatibility with varying star catalog outputs. - Improved error handling in the `do_phot` and `photloop` functions to provide clearer messages for photometry failures. - Added unit tests to validate the changes and ensure robust handling of different input scenarios.
- Added `.coverage` to the `.gitignore` file to prevent coverage report files from being tracked in the repository.
…bility - Updated `do_phot` and `photloop` functions to provide clearer error messages for photometry failures. - Refactored `extract_aperture_stats` and `get_star_catalog` functions to improve compatibility with varying star catalog outputs. - Added unit tests to validate the changes and ensure robust handling of different input scenarios.
- Updated `extract_fwhm_from_epsf` to work with ePSF-like arrays instead of EPSFModel, enhancing compatibility with photutils 3.x. - Introduced helper functions `_apstats_attr` and `_apstats_float` to streamline attribute access and type coercion for `ApertureStats`. - Enhanced `_make_psf_residual_image` to support both photutils 2.x and 3.x keyword names for residual image generation. - Refactored `extract_aperture_stats` to utilize the new helper functions for improved clarity and maintainability.
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
This release merges
devintomainwith pipeline hardening across WCS, catalogs, photometry, and absolute photometric calibration.WCS & astrometry
--skip-external-astrometryto bypass astrometry.net when WCS is already usable.--fine-align-catalogand related CLI options.RADECSYS→RADESYS,MJD-OBS/DATE-OBS) to avoid astropy WCS warnings; apply on GMOS extension load.Catalogs
potpyri/utils/catalogs.pyas shared Vizier/catalog logic for WCS alignment and zeropoint fitting; slim downutilities.pyre-exports.Photometry & zeropoint
PhotometryErrorand clearer logging inphotloop/do_photwhen star detection or PSF photometry fails (no silent exit withoutAPPPHOT).DAOStarFinderx_centroid/y_centroidcolumns; improve compatibility across photutils versions.absphot.find_zeropointwhenAPPPHOTis missing or incomplete; returnbooland emit actionable log messages instead of raisingKeyError.Tests
test_binspec_frb_stack_photometry.py) for photometry + zeropoint on a real stack (skips if local FITS absent).Test plan
pytest tests/test_wcs.py tests/test_photometry.py tests/test_absphot.py tests/test_instruments.pypytest tests/test_calibration.py(GMOS calibration integration)POTPYRI_FRB_STACK_TEST=/path/to/FRB20260213A.r.ut260322.2.11.stk.fits pytest tests/test_binspec_frb_stack_photometry.py -vmain_pipelineon a small BINOSPEC or GMOS dataset through photometry and zeropoint steps--skip-external-astrometryand--fine-align-catalogbehave as expected on stacks with pre-existing WCSNotes
examples/remain gitignored (local-only).