Skip to content

Commit b9c9887

Browse files
committed
check wavelength exists
1 parent dd049c4 commit b9c9887

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/pst/observables.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ def _check_spectra(self, spectra, default_unit=u.Lsun / u.angstrom / u.cm**2):
329329
if spectra.unit.is_equivalent(u.W / (u.m**2 * u.m)):
330330
return spectra
331331
elif spectra.unit.is_equivalent(u.W / (u.m**2 * u.Hz)):
332+
if self.wavelength is None:
333+
raise AttributeError("Attribute `self.wavelength` must be defined"
334+
+ " to convert spectra to Flam units.")
332335
return spectra.to(default_unit, equivalencies=u.spectral_density(self.wavelength))
333336
else:
334337
raise ValueError(

0 commit comments

Comments
 (0)