From 8b9605ff896d7bd6f38025869debf846f375ba5a Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 15 Jun 2026 13:10:52 -0700 Subject: [PATCH] Guard contrast-reserve calc for sizeless objects pydeepskylog.contrast_reserve() logs logger.error(...) and returns (does not raise) when an object diameter is None, so the surrounding except (ValueError, TypeError, InvalidParameterError) cannot suppress it. object_details.update_object_info() calls it per redraw with diameter=None for objects that have a magnitude but no usable size, producing steady ERROR-level log spam (~1-2/sec on that object's detail screen) that bypasses the root=ERROR log filter. Skip the call when either diameter is None (the library cannot compute it anyway) and leave the contrast line blank -- the same end result as before (contrast was ultimately set to "" on the None return), minus the error. Co-Authored-By: Claude Opus 4.8 (1M context) --- python/PiFinder/ui/object_details.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/python/PiFinder/ui/object_details.py b/python/PiFinder/ui/object_details.py index ba0782d19..0492d4e28 100644 --- a/python/PiFinder/ui/object_details.py +++ b/python/PiFinder/ui/object_details.py @@ -255,15 +255,23 @@ def update_object_info(self): else: diameter1 = diameter2 = None - self.contrast = pds.contrast_reserve( - sqm=sqm, - telescope_diameter=self.config_object.equipment.active_telescope.aperture_mm, - magnification=magnification, - surf_brightness=None, - magnitude=magnitude, - object_diameter1=diameter1, - object_diameter2=diameter2, - ) + if diameter1 is None or diameter2 is None: + # No usable object size: pydeepskylog can't compute a + # contrast reserve without diameters — it logs an ERROR + # and *returns* (doesn't raise), so the except below + # can't suppress it. Skip the call and leave the + # contrast line blank. + self.contrast = "" + else: + self.contrast = pds.contrast_reserve( + sqm=sqm, + telescope_diameter=self.config_object.equipment.active_telescope.aperture_mm, + magnification=magnification, + surf_brightness=None, + magnitude=magnitude, + object_diameter1=diameter1, + object_diameter2=diameter2, + ) except (ValueError, TypeError, InvalidParameterError) as e: # mag_str / size are not always plain numbers: double stars # carry component mags like "7.0/9.5", asterisms a size like