Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def apply_extinction(self, ext_type, EBmV):
""" Return a new SED instance with the extinction curve
applied at the same redshift as the template.
Allowed extinction laws are:
MW
SMC
LMC
starburst
See the extinction module for more information.
"""
import extinction as ext
ecurve = dict(MW= ext.MW_Cardelli89 ,
SMC=ext.SMC_Gordon03 ,
LMC=ext.LMC_Gordon03 ,
starburst=ext.starburst_Calzetti00
)
sed = self.copy()
sed.z0fl[:] = sed.z0fl_noextinct
tau = ecurve[ext_type](self.z0wa, EBmV=EBmV).tau
sed.z0fl *= np.exp(-tau)
sed.EBmV = EBmV
sed.redshift_to(sed.z)
return sed