From e35806485af0882bc951b6307ec92264e7e0b0c4 Mon Sep 17 00:00:00 2001 From: Juan Cabanela Date: Thu, 17 Aug 2023 08:34:50 -0500 Subject: [PATCH] Fix issue #157 with setting ccd_data to float before flagging with NaN. --- stellarphot/photometry/photometry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stellarphot/photometry/photometry.py b/stellarphot/photometry/photometry.py index 46c2e338..eb5b030a 100644 --- a/stellarphot/photometry/photometry.py +++ b/stellarphot/photometry/photometry.py @@ -249,7 +249,9 @@ def single_image_photometry(ccd_image, sourcelist, camera, observatory_location, "SKIPPING THIS IMAGE!") return None, None - # Set high pixels to NaN + # Set high pixels to NaN (make sure ccd_image.data is a float array first) + if ccd_image.data.dtype != np.float: + ccd_image.data = ccd_image.data.astype(np.float) ccd_image.data[ccd_image.data > max_adu] = np.nan # Extract necessary values from sourcelist structure