bd-j / prospector

Python code for Stellar Population Inference from Spectra and SEDs
http://prospect.readthedocs.io
MIT License
153 stars 71 forks source link

Avoid RuntimeWarning when smoothing with 0 km/s #289

Closed elijahmathews closed 1 year ago

elijahmathews commented 1 year ago

Currently, running smoothspec with sigma set to zero yields a non-fatal RuntimeWarning due to the division by zero encountered in these two lines in smoothspec.

While the division doesn't actually cause issues with the output spectrum (i.e. the input spectrum is returned if sigma is set to zero, albeit interpolated to a new wavelength grid if one is provided), this pull request adds conditional logic that sets R and Rsigma to np.infty in this situation to avoid that division from taking place, and thus avoid the RuntimeWarning from being issued.