Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
SFR_norm = (coeffs_norm*tab_temp['sfr']).sum()*u.solMass/u.yr
SFRv = SFR_norm / Lv_norm
mass_var = ((rms_norm*tab_temp['mass'])**2).sum()
Lv_var = ((rms_norm*tab_temp['Lv'])**2).sum()
SFR_var = ((rms_norm*tab_temp['sfr'])**2).sum()
MLv_var = MLv**2 * (mass_var/mass_norm.value**2 + Lv_var/Lv_norm.value**2)
MLv_rms = np.sqrt(MLv_var)
SFRv_var = SFRv**2 * (SFR_var/SFR_norm.value**2 + Lv_var/Lv_norm.value**2)
SFRv_rms = np.sqrt(SFRv_var)
vband = S.ObsBandpass('v')
vbandz = S.ArrayBandpass(vband.wave*(1+z), vband.throughput)
best_templ = utils.SpectrumTemplate(templ['wave'], templ['full'])
fnu = best_templ.integrate_filter(vbandz)*(u.erg/u.s/u.cm**2/u.Hz)
dL = cosmology.luminosity_distance(z).to(u.cm)
Lnu = fnu*4*np.pi*dL**2
pivotV = vbandz.pivot()*u.Angstrom
nuV = (const.c/pivotV).to(u.Hz)
Lv = (nuV*Lnu).to(u.L_sun)
mass = MLv*Lv
SFR = SFRv*Lv
sps = {'Lv':Lv, 'MLv':MLv, 'MLv_rms':MLv_rms, 'SFRv':SFRv, 'SFRv_rms':SFRv_rms, 'templ':best_templ}
return sps