def get_KaKy2016_model(table, **kwargs): if not 'mej' in table.colnames: # calc the mass of ejecta table['mej'] = calc_meje(table['q'], table['chi_eff'], table['c'], table['mb'], table['mns']) # calc the velocity of ejecta table['vej'] = calc_vave(table['q']) # Throw out smaples where the mass ejecta is less than zero. mask = (table['mej'] > 0) table = table[mask] if len(table) == 0: return table # Log mass ejecta table['mej10'] = np.log10(table['mej']) # Initialize columns timeseries = np.arange(table['tini'][0], table['tmax'][0]+table['dt'][0], table['dt'][0]) table['t'] = [np.zeros(timeseries.size)] table['lbol'] = [np.zeros(timeseries.size)] table['mag'] = [{}] # Loop over samples for isample in range(len(table)): table['t'][isample], table['lbol'][isample], table['mag'][isample] = calc_lc(table['tini'][isample], table['tmax'][isample], table['dt'][isample], table['mej'][isample], table['vej'][isample], table['vmin'][isample], table['th'][isample], table['ph'][isample], table['kappa'][isample], table['eps'][isample], table['alp'][isample], table['eth'][isample]) return table
from gwemlightcurves.EjectaFits.Di2018 import calc_meje, calc_vej # calc the mass of ejecta samples['mej'] = calc_meje(samples['m1'], samples['c1'], samples['m2'], samples['mb2']) # calc the velocity of ejecta samples['vej'] = calc_vej(samples['m1'], samples['c1'], samples['m2'], samples['c2']) elif opts.cbc_type == "BHNS": samples['chi_eff'] = 1.0 from gwemlightcurves.EjectaFits.KaKy2016 import calc_meje, calc_vave # calc the mass of ejecta samples['mej'] = calc_meje(samples['q'], samples['chi_eff'], samples['c1'], samples['mb1'], samples['m1']) # calc the velocity of ejecta samples['vej'] = calc_vave(samples['q']) # HACK: multiply by 10 to get full ejecta samples['mej'] = samples['mej'] * 10.0 idx = np.where(samples['mej'] > 0.1)[0] samples['mej'][idx] = 0.1 print(np.min(samples['mej']), np.max(samples['mej'])) if opts.nsamples > 0: samples = samples.downsample(Nsamples=opts.nsamples) #add default values from above to table samples['tini'] = tini samples['tmax'] = tmax
q = m2 / m1 mc = data_out["mc"] m1, m2 = np.mean(m1), np.mean(m2) chi_eff = 0.0 c1, c2 = 0.147, 0.147 mb1, mb2 = lightcurve_utils.EOSfit(m1, c1), lightcurve_utils.EOSfit( m2, c2) th = 0.2 ph = 3.14 if m1 > 3: from gwemlightcurves.EjectaFits.KaKy2016 import calc_meje, calc_vave mej = calc_meje(q, chi_eff, c2, mb2, m2) vej = calc_vave(q) else: from gwemlightcurves.EjectaFits.DiUj2017 import calc_meje, calc_vej mej = calc_meje(m1, mb1, c1, m2, mb2, c2) vej = calc_vej(m1, c1, m2, c2) filename = os.path.join(plotDir, 'truth_mej_vej.dat') fid = open(filename, 'w+') fid.write('%.5f %.5f\n' % (mej, vej)) fid.close() if m1 > 3: filename = os.path.join(plotDir, 'truth.dat') fid = open(filename, 'w+') fid.write('%.5f %.5f %.5f %.5f %.5f\n' % (q, chi_eff, c2, mb2, m2))