From 2c1b4dd357cf4aae07bbd473bfbb2f31b63cc90c Mon Sep 17 00:00:00 2001 From: Jeremy Kubica <104161096+jeremykubica@users.noreply.github.com> Date: Wed, 13 Dec 2023 10:04:41 -0500 Subject: [PATCH] Suppress a single warning --- src/kbmod/work_unit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kbmod/work_unit.py b/src/kbmod/work_unit.py index ff4a3016..15eaaf5f 100644 --- a/src/kbmod/work_unit.py +++ b/src/kbmod/work_unit.py @@ -2,9 +2,11 @@ from astropy.io import fits from astropy.table import Table +from astropy.utils.exceptions import AstropyWarning from astropy.wcs import WCS import numpy as np from pathlib import Path +import warnings from kbmod.configuration import SearchConfiguration from kbmod.search import ImageStack, LayeredImage, PSF, RawImage @@ -60,7 +62,11 @@ def from_fits(cls, filename): config = SearchConfiguration.from_hdu(hdul["kbmod_config"]) # Read in the global WCS from extension 0 if the information exists. - global_wcs = extract_wcs(hdul[0]) + # We filter the warning that the image dimension does not match the WCS dimension + # since the primary header does not have an image. + with warnings.catch_warnings(): + warnings.simplefilter("ignore", AstropyWarning) + global_wcs = extract_wcs(hdul[0]) # Read the size and order information from the primary header. num_images = hdul[0].header["NUMIMG"]