From e691d7b5146ebbca83a20c9426a8775c69c04562 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 6 May 2026 08:54:08 -0400 Subject: [PATCH 1/3] Only use wave_unit or flux_unit when requested. --- sbpy/spectroscopy/sources.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sbpy/spectroscopy/sources.py b/sbpy/spectroscopy/sources.py index d17ec662..063a0501 100644 --- a/sbpy/spectroscopy/sources.py +++ b/sbpy/spectroscopy/sources.py @@ -141,7 +141,14 @@ def from_file(cls, filename, wave_unit=None, flux_unit=None, else: fn = filename - spec = read_spec(fn, wave_unit=wave_unit, flux_unit=flux_unit) + # flux_unit and wave_unit were deprecated for FITS files in synphot 1.4; + # only use them if requested + read_kwargs = {} + if wave_unit is not None: + read_kwargs["wave_unit"] = wave_unit + read_kwargs["flux_unit"] = flux_unit + + spec = read_spec(fn, **read_kwargs) i = np.isfinite(spec[1] * spec[2]) source = synphot.SourceSpectrum( synphot.Empirical1D, points=spec[1][i], lookup_table=spec[2][i], From 4bd9aae7fb4201f4b591ad01e05b6c89a75390ea Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 6 May 2026 08:54:48 -0400 Subject: [PATCH 2/3] Respect cache parameter --- sbpy/spectroscopy/sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbpy/spectroscopy/sources.py b/sbpy/spectroscopy/sources.py index 063a0501..fd2d3463 100644 --- a/sbpy/spectroscopy/sources.py +++ b/sbpy/spectroscopy/sources.py @@ -137,7 +137,7 @@ def from_file(cls, filename, wave_unit=None, flux_unit=None, # URL cache because synphot.SourceSpectrum.from_file does not if _is_url(filename): - fn = download_file(filename, cache=True) + fn = download_file(filename, cache=cache) else: fn = filename From 6515bd22c4e4c7c84e16c706a6821a1fd45f27b8 Mon Sep 17 00:00:00 2001 From: "Michael S. P. Kelley" Date: Wed, 6 May 2026 09:01:44 -0400 Subject: [PATCH 3/3] Fix change log entry --- CHANGES.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index f5bc53d4..54d36046 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,17 @@ sbpy.photometry - Added Rubin Observatory's LSSTCam filter set to `bandpass()`. [#431] +Bug Fixes +--------- + +sbpy.spectroscopy +^^^^^^^^^^^^^^^^^ + +- Avoid deprecation warning on flux_unit and wave_unit keyword arguments in + `sbpy.spectroscopy.sources.SpectralSource.from_file` when using synphot's + read_fits_spec. [#447] + + v0.6.0 (2025-12-02) ===================