Beispiel #1
0
def at2018gep(ax):
    """ Bolometric LC of AT2018gep """
    dt, lum, llum, ulum = load_lc()
    ax.errorbar(dt,
                lum,
                yerr=[llum, ulum],
                fmt='s',
                c='k',
                zorder=10,
                label="SN2018gep")
Beispiel #2
0
def plot_18gep():
    """ Plot the bolometric LC of 2018gep """
    dt, lum, llum, ulum = load_lc()
    plt.errorbar(dt,
                 lum,
                 yerr=[llum, ulum],
                 fmt='o',
                 c='#140b34',
                 mfc='#140b34',
                 mec='#140b34',
                 lw=0.5,
                 label="SN2018gep")
Beispiel #3
0
def lum_panel(ax, lines=True):
    """ Panel showing the luminosity evolution """
    dt, lum, llum, ulum = load_lc()

    # choose just the optical points
    opt = np.logical_or(dt < 0.1, np.logical_and(dt > 0.5, dt < 3.22))
    ax.errorbar(dt[opt],
                lum[opt],
                yerr=[llum[opt], ulum[opt]],
                fmt='o',
                c='lightgrey',
                lw=0.5)

    # UV + opt points
    ax.errorbar(dt[~opt],
                lum[~opt],
                yerr=[llum[~opt], ulum[~opt]],
                ms=8,
                fmt='o',
                mec='k',
                mfc='lightgrey',
                lw=0.5,
                c='k',
                label="SN2018gep")

    if lines:
        ax.plot(dt, lum, lw=1, c='k')
    ax.set_ylabel(r'$L_\mathrm{bol}$ (erg/s)', fontsize=16)
    ax.set_yscale('log')
    ax2 = ax.twinx()
    ax2.set_ylabel(r"$(L_\odot$)", fontsize=16, rotation=270, labelpad=15.0)
    y_f = lambda y_i: y_i / 3.839E33
    ymin, ymax = ax.get_ylim()
    ax2.set_ylim((y_f(ymin), y_f(ymax)))
    ax2.plot([], [])
    ax2.set_yscale('log')
    ax.tick_params(axis='both', labelsize=16)
    ax2.tick_params(axis='both', labelsize=16)
Beispiel #4
0
def print_table():
    # Load the bolometric light curve
    dt, lum, llum, ulum = load_lc()

    # Load the radius
    dt, rad, lrad, urad = load_radius()

    # Load the temperature
    dt, temp, ltemp, utemp = load_temp()

    # Table of measurements
    dtprint = np.array([round_sig(val, 2) for val in dt])

    lprint = np.array([round_sig(val, 2) for val in lum / 3.839E43])
    lprint = np.array([round_sig(val, 2) for val in lum / 3.839E43])
    ulprint = np.array(
            [np.round(val,ndec(lprint[ii])) \
            for ii,val in enumerate(ulum/3.839E43)])
    llprint = np.array(
            [np.round(val,ndec(lprint[ii])) \
            for ii,val in enumerate(llum/3.839E43)])

    rprint = np.array([round_sig(val, 2) for val in rad / 1.496E13])
    urprint = np.array(
            [np.round(val,ndec(rprint[ii])) \
            for ii,val in enumerate(urad/1.496E13)])
    lrprint = np.array(
            [np.round(val,ndec(rprint[ii])) \
            for ii,val in enumerate(lrad/1.496E13)])

    tprint = np.array([round_sig(val, 2) for val in temp / 1E3])
    utprint = np.array(
            [np.round(val,ndec(tprint[ii])) \
            for ii,val in enumerate(utemp/1E3)])
    ltprint = np.array(
            [np.round(val,ndec(tprint[ii])) \
            for ii,val in enumerate(ltemp/1E3)])

    outputf = open("physevol_tab.txt", "w")
    outputf.write("\\begin{table}[] \n")
    outputf.write("\centering \n")
    outputf.write(
        "\caption{Physical evolution of AT2018gep from blackbody fits.\
            Uncertainties represent the 16-to-84 percentile range from a\
            Monte Carlo simulation with 600 trials.} \n")
    outputf.write("\\begin{tabular}{lrrr} \n")
    outputf.write("\hline \n")
    outputf.write(
        "$\Delta t$ & $L (10^{10} L_\odot)$ & $R$ (AU) & $T$ (kK) \\\ \n")
    outputf.write("\hline")

    for ii, l in enumerate(lprint):
        t = tprint[ii]
        ut = utprint[ii]
        lt = ltprint[ii]
        if tprint[ii] >= 10:
            t = int(t)
            ut = int(ut)
            lt = int(lt)
        linestr = "$%s$ & $%s^{%s}_{%s}$ & $%s^{%s}_{%s}$ & $%s^{%s}_{%s}$ \\\ \n" % (
            dtprint[ii], l, "+%s" % ulprint[ii], "-%s" % llprint[ii],
            int(rprint[ii]), "+%s" % int(urprint[ii]),
            "-%s" % int(lrprint[ii]), t, "+%s" % ut, "-%s" % lt)
        outputf.write(linestr)

    outputf.write("\hline \n")
    outputf.write("\end{tabular} \n")
    outputf.write("\label{tab:physevol} \n")
    outputf.write("\end{table} \n")

    outputf.close()
Beispiel #5
0
    # integrate A(z)dz from 0 to x
    a = np.array([quad(az, 0, xval, args=(y,))[0] for xval in x])
    aerr = np.array([quad(az, 0, xval, args=(y,))[1] for xval in x])

    # integrate B(z)dz from 0 to x
    b = np.array([quad(bz, 0, xval, args=(s, y))[0] for xval in x])
    berr = np.array([quad(bz, 0, xval, args=(s, y))[1] for xval in x])

    lum = mni_g * np.exp(-x**2) * ((eps_ni-eps_co)*a + eps_co*b)
    return lum


if __name__=="__main__":
    # Load the bolometric light curve
    dt, lum, llum, ulum = load_lc()

    # Plot a sample Ni light curve, say M_Ni = 0.1 solar masses
    mni0 = 0.3 # solar masses
    tdiff0 = 10 # days

    #kappa = 0.1 # cm2/g

    # Plot
    fig,ax = plt.subplots(1,1,figsize=(7,5))
    ax.errorbar(
            dt, lum, yerr=[llum, ulum], fmt='o', 
            mec='k', mfc='k', ms=5, c='k')

    # Various models
    dt_plot = np.linspace(0.1, 40, 1000)
Beispiel #6
0
def func(t, Ee, te, alpha):
    """ Takes t in sec, Ee in erg, te in sec """
    lum = Ee * (alpha - 1) / (te * (1 + t / te)**alpha)
    return lum


def logfunc(t, Ee, te, alpha):
    """ Takes t in 10^4 sec, Ee in 10^51 erg, te in 10^4 sec """
    loglum = 51 + np.log10(Ee) + np.log10(alpha-1) \
             - 4 - np.log10(te) - alpha*np.log10(1+t/te)
    return loglum


if __name__ == "__main__":
    dt_all, lum_all, llum, ulum = load_lc()

    # Ignore the first point
    dt = dt_all[1:]
    lum = lum_all[1:]

    dt_sec = dt * 86400

    # sample lum from its distribution where sigma = 20% of lum
    npts = len(dt)
    ndraw = 10

    # Make ndraw new versions of a new lum array, repopulated with the lum
    # from the Gaussian dist with STD of ulum

    lum_new = np.zeros((npts, ndraw))