sfh['t2'] = 10.**sfh['t2'] sfh['sfr'][0] *= 1 - (sfh['t1'][0]/sfh['t2'][0]) sfh[0]['t1'] = 0. mtot = ((sfh['t2'] - sfh['t1']) * sfh['sfr']).sum() # choose lookback times to generate lookback_time = [0, 1e8] # generate a high temporal resolution SFH, with bursts if f_burst > 0 lt, sfr, tb = bsp.burst_sfh(sfh=sfh, fwhm_burst=fwhm_burst, f_burst=f_burst, contrast=contrast) # get the interpolation weights. This does not have to be run in # general (it is run interior to bursty_sps) unless you are # debugging or for plotting purposes aw = bsp.sfh_weights(lt, sfr, 10**sps.ssp_ages, lookback_time=lookback_time) # get the intrinsic spectra at the lookback_times specified. wave, spec, mstar, _ = bsp.bursty_sps(lt, sfr, sps, lookback_time=lookback_time) # get reddened spectra, Calzetti foreground screen wave, red_spec, _, lir = bsp.bursty_sps(lt, sfr, sps, lookback_time=lookback_time, dust_curve=attenuation.calzetti, av=1, dav=0) # get reddened spectra, SexA differntial extinction plus SMC dav = sexAmodel(davmax=1.0, ages=10**sps.ssp_ages) wave, red_spec, _, lir = bsp.bursty_sps(lt, sfr, sps, lookback_time=lookback_time, dust_curve=attenuation.smc, av=1, dav=dav) # Get intrinsic spectrum including an age metallicity relation def amr(ages, **extras): """This should take an array of ages (linear years) and return an array
sfh["t2"] = 10.0 ** sfh["t2"] sfh["sfr"][0] *= 1 - (sfh["t1"][0] / sfh["t2"][0]) sfh[0]["t1"] = 0.0 mtot = ((sfh["t2"] - sfh["t1"]) * sfh["sfr"]).sum() # choose lookback times to generate lookback_time = [0, 1e8] # generate a high temporal resolution SFH, with bursts if f_burst > 0 lt, sfr, tb = bsp.burst_sfh(sfh=sfh, fwhm_burst=fwhm_burst, f_burst=f_burst, contrast=contrast) # get the interpolation weights. This does not have to be run in # general (it is run interior to bursty_sps) unless you are # debugging or for plotting purposes aw = bsp.sfh_weights(lt, sfr, 10 ** sps.ssp_ages, lookback_time=lookback_time) # get the intrinsic spectra at the lookback_times specified. wave, spec, mstar, _ = bsp.bursty_sps(lt, sfr, sps, lookback_time=lookback_time) # get reddened spectra, Calzetti foreground screen wave, red_spec, _, lir = bsp.bursty_sps( lt, sfr, sps, lookback_time=lookback_time, dust_curve=attenuation.calzetti, av=1, dav=0 ) # get reddened spectra, SexA differntial extinction plus SMC dav = sexAmodel(davmax=1.0, ages=10 ** sps.ssp_ages) wave, red_spec, _, lir = bsp.bursty_sps( lt, sfr, sps, lookback_time=lookback_time, dust_curve=attenuation.smc, av=1, dav=dav ) # Get intrinsic spectrum including an age metallicity relation def amr(ages, **extras): """This should take an array of ages (linear years) and return an array of metallicities (units of log(Z/Z_sun) """
av, dav = 0.1, 0.1 #read the binned sfh, put in linear units sfh = utils.load_angst_sfh(filen) sfh['t1'] = 10.**sfh['t1'] sfh['t2'] = 10.**sfh['t2'] sfh['sfr'][0] *= 1 - (sfh['t1'][0]/sfh['t2'][0]) sfh[0]['t1'] = 0. mtot = ((sfh['t2'] - sfh['t1']) * sfh['sfr']).sum() #convert into a high resolution sfh, with *no* intrabin sfr variations lt, sfr, fb = bsp.burst_sfh(fwhm_burst=0.05, f_burst=0., contrast=1., sfh=sfh, bin_res=20.) # Get the attenuated spectra # and IR luminosities wave, spec, mass, lir = bsp.bursty_sps(lt, sfr, sps, lookback_time=t_lookback, av=av, dav=dav, nsplit=30) for j, jt in enumerate(t_lookback): pl.plot(wave, spec[j,:] * wave * bsp.to_cgs, label = '{0} @ {1}'.format(objname[i], tl[j])) # Project onto filters to get # absolute magnitudes mags = observate.getSED(wave, spec * bsp.to_cgs, filterlist = filterlist) # Get the intrinsic spectrum and project onto filters wave, spec, mass, _ = bsp.bursty_sps(lt, sfr, sps, lookback_times=t_lookback, av=None, dav=None) mags_int = observate.getSED(wave, spec * bsp.to_cgs, filterlist = filterlist) pl.xlim(1e3, 1e4)
sfh[0]['t1'] = 0. mtot = ((sfh['t2'] - sfh['t1']) * sfh['sfr']).sum() #convert into a high resolution sfh, with *no* intrabin sfr variations lt, sfr, fb = bsp.burst_sfh(fwhm_burst=0.05, f_burst=0., contrast=1., sfh=sfh, bin_res=20.) # Get the attenuated spectra # and IR luminosities wave, spec, mass, lir = bsp.bursty_sps(lt, sfr, sps, lookback_time=t_lookback, av=av, dav=dav, nsplit=30) for j, jt in enumerate(t_lookback): pl.plot(wave, spec[j, :] * wave * bsp.to_cgs, label='{0} @ {1}'.format(objname[i], tl[j])) # Project onto filters to get # absolute magnitudes mags = observate.getSED(wave, spec * bsp.to_cgs, filterlist=filterlist) # Get the intrinsic spectrum and project onto filters wave, spec, mass, _ = bsp.bursty_sps(lt, sfr,