def weighted_yields_pre_explosion(self,mp,sefiles,sefiles_hout,endcycle,mass_cut,isotopes):
'''
Marcos routine adapted, calc pre SN yields
explosion cycle is endcycle, at which pre SN yield is taken from
'''
import utils as u
cycle=endcycle
first_cycle=sefiles.se.cycles[0]
#mass_cut=1.60
mass_last_cycle=sefiles_hout.get(cycle,"mass")
idx_mcut=int(np.where(mass_last_cycle>mass_cut)[0][0])
# I take the max mass coord
mass_limit=mass_last_cycle[-1]
# I calculate average_mass_frac_decay
sefiles_hout.average_iso_abund_marco([mass_cut,mass_limit],cycle,True,2)
E_i_pre_15=array(mp.average_mass_frac_decay)*(mass_limit-mass_cut)
#follwoing needed for isotope identification,must be stable
# define back_ind presn
back_ind_pre=u.back_ind
yields=[]
iniabus=[]
prod_facs=[]
for i in range(len(isotopes)):
other_name_scheme=isotopes[i].split("-")[0].upper()+(5-len(isotopes[i])+1)*" "+isotopes[i].split("-")[1]
if other_name_scheme not in u.stable:
print "error: Chosen isotope is not stable:",other_name_scheme
return 1
idx_iso=back_ind_pre[other_name_scheme]
yield_decayed=E_i_pre_15[idx_iso]
yields.append(yield_decayed)
iniabu_1=sefiles.get(0,isotopes[i])
print "iniabu for exp",iniabu_1
iniabus.append(iniabu_1)
total_yield= yield_decayed
total_prod_factor= total_yield/ ((mass_limit-mass_cut)*iniabu_1)
prod_facs.append(total_prod_factor)
print total_yield, total_prod_factor
ini_star_mass=sefiles.get("mini")
iniabus=np.array(iniabus)*(ini_star_mass)#-end_star_mass)
return np.array(prod_facs),isotopes,yields,iniabus
评论列表
文章目录