Skip to content

Commit 0463a66

Browse files
committed
Only use wave_unit or flux_unit when requested.
1 parent cfa603d commit 0463a66

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sbpy/spectroscopy/sources.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,14 @@ def from_file(cls, filename, wave_unit=None, flux_unit=None,
141141
else:
142142
fn = filename
143143

144-
spec = read_spec(fn, wave_unit=wave_unit, flux_unit=flux_unit)
144+
# flux_unit and wave_unit were deprecated for FITS files in synphot 1.4;
145+
# only use them if requested
146+
read_kwargs = {}
147+
if wave_unit is not None:
148+
read_kwargs["wave_unit"] = wave_unit
149+
read_kwargs["flux_unit"] = flux_unit
150+
151+
spec = read_spec(fn, **read_kwargs)
145152
i = np.isfinite(spec[1] * spec[2])
146153
source = synphot.SourceSpectrum(
147154
synphot.Empirical1D, points=spec[1][i], lookup_table=spec[2][i],

0 commit comments

Comments
 (0)