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
Exemple #2
0
            m1, m2 = lightcurve_utils.mc2ms(data_out["mc"], eta)
            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+')