def apply_extinction(self, A_v, R_v=3.1): wgood = (self.wave > 91) & (self.wave < 6000) self.wave = self.wave[wgood] self.flambda = self.flambda[wgood] ext = extinction.reddening(self.wave * 10, a_v=A_v, r_v=R_v, model="f99") self.flambda /= ext self.needs_new_interp = True
def apply_extinction(self, A_v, R_v=3.1): ## applies the extinction parameters, taken from phoSim input catalog. wgood = (self.wave > 91) & (self.wave < 6000) self.wave=self.wave[wgood] self.flambda=self.flambda[wgood] ext = extinction.reddening(self.wave*10, a_v=A_v, r_v=R_v, model='f99') self.flambda /= ext self.needs_new_interp=True
def redden(SED, a_v, r_v, model): """ Returns a new SED with the specified extinction applied. Note that this will truncate the wavelength range to lie between 91 nm and 6000 nm where the extinction correction law is defined. Catsim SED has bluelimit 16nm, so make sure we don't use high z ## Do not use redshifts higher than 1.4 !!!!!!!!! """ return SED * (lambda w: 1 if np.any(w < 125) else 1 / extinction.reddening( w * 10, a_v=a_v, r_v=r_v, model=model))