Exception is raised for spectra containing highly absorbed systems
Closed this issue · 4 comments
fake_spectra/fake_spectra/spectra.py
Line 845 in 2f67fe8
Hello,
I know you (Simeon) have set the line below to avoid having any 0 in the log in the conversion back to tau :
fake_spectra/fake_spectra/spectra.py
Line 842 in 2f67fe8
But, I am sure it still fails if we have any absorber with NHI > 10**19.0 . The absorber is just too large that even after smoothing with spec_res
we still have some pixels with flux = 0 . Since the spectral resolution smoothing is only needed to be applied to the flux (observable), I suggest to remove this from get_tau()
. People can call spec_utils.res_corr()
if they need.
You mean just remove:
#Correct for the spectrograph resolution in flux space.
#We need to cap the optical depth to avoid divide-by-zero
if self.spec_res > 0:
tau[np.where(tau > 700)] = 700
corrflux = spec_utils.res_corr(np.exp(-tau), self.dvbin, self.spec_res)
flux = corrflux
if np.any(corrflux <= 0):
raise Exception
tau = - np.log(corrflux)
from get_tau? And then people can do it themselves? That is a good idea, can you send a PR?
Exactly! The whole spc_res convolution in this function. Then people will call spec_utils.res_corr()
which works only with flux and is safe.
Sure, I'll send the PR.
That is very sensible, thanks!