コード例 #1
0
ファイル: ShockMod.py プロジェクト: niyuanqi/SNAP
def CSMViErr(p, t, L, L_err, z, DM, Mej, Eej):
    from Cosmology import wave_0, bands
    from LCFitting import earlyFit
    #CSM component p0=epoch (in rest frame), p1=Mext, p2=Rext
    V_pred = np.array([CSMFit(ti, wave_0[bands['V']], z, DM, Mej, Eej,
                              p[1], p[2], p[0]) for ti in t[0]])
    I_pred = np.array([CSMFit(ti, wave_0[bands['i']], z, DM, Mej, Eej,
                              p[1], p[2], p[0]) for ti in t[1]])
    #Power law component 
    V_pred = np.array(V_pred) + earlyFit(t[0], p[3]*(1.+z), p[4], p[6])
    I_pred = np.array(I_pred) + earlyFit(t[1], p[3]*(1.+z), p[5], p[7]) 
    #Error
    V_err = (V_pred - L[0])/L_err[0]
    I_err = (I_pred - L[1])/L_err[1]
    return np.concatenate([V_err, I_err],axis=0)
コード例 #2
0
ファイル: ShockMod.py プロジェクト: niyuanqi/SNAP
def ShockCoolingViErr(p, t, L, L_err, z, DM, Mej):
    from Cosmology import wave_0, bands
    from LCFitting import earlyFit
    #Shock cooling component p0=epoch (in rest frame), p1=R8
    #Fix t5=0.1 temperature, because assume late time
    V_pred = np.array([ShockCoolingFit(ti, wave_0[bands['V']], z, DM, Mej,
                              p[1], 0.1, p[0]) for ti in t[0]])
    I_pred = np.array([ShockCoolingFit(ti, wave_0[bands['i']], z, DM, Mej,
                              p[1], 0.1, p[0]) for ti in t[1]])
    #Power law component, p2=epoch (in rest frame) 
    V_pred = np.array(V_pred) + earlyFit(t[0], p[2]*(1.+z), p[3], p[5])
    I_pred = np.array(I_pred) + earlyFit(t[1], p[2]*(1.+z), p[4], p[6]) 
    #Error
    V_err = (V_pred - L[0])/L_err[0]
    I_err = (I_pred - L[1])/L_err[1]
    return np.concatenate([V_err, I_err],axis=0)
コード例 #3
0
ファイル: ShockMod.py プロジェクト: niyuanqi/SNAP
def kasenViErr(p, t, L, L_err, z, DM, m_c, e_51):
    from Cosmology import wave_0, bands
    from LCFitting import earlyFit
    #Kasen component p0=epoch (in rest frame), p1=a13, p2=theta
    V_pred = np.array([KasenFit(ti, p[1], 1.0, wave_0[bands['V']], z,
                                m_c, e_51, DM, p[0])
                       for ti in t[0]])*Kasen_isocorr(p[2])
    I_pred = np.array([KasenFit(ti, p[1], 1.0, wave_0[bands['i']], z,
                                m_c, e_51, DM, p[0])
                       for ti in t[1]])*Kasen_isocorr(p[2])
    #Power law component
    V_pred = np.array(V_pred) + earlyFit(t[0], p[3]*(1.+z), p[4], p[6]) 
    I_pred = np.array(I_pred) + earlyFit(t[1], p[3]*(1.+z), p[5], p[7]) 
    #Error
    V_err = (V_pred - L[0])/L_err[0]
    I_err = (I_pred - L[1])/L_err[1]
    return np.concatenate([V_err, I_err],axis=0)
コード例 #4
0
ファイル: Ni56Mod.py プロジェクト: niyuanqi/SNAP
def NiSTMultiErr(p, t, L, L_err, z, DM, taus, Mej, Ek):
    from Cosmology import wave_0, bands
    from LCFitting import earlyFit
    #Ni shell component p0=epoch (in rest frame), p1=t_s, p2=a_s, p3=tau_s
    B_pred = predNiSmod(t[0], wave_0[bands['B']], z, DM, p[3] * taus[0], Mej,
                        Ek, p[1], p[2], p[0])
    V_pred = predNiSmod(t[1], wave_0[bands['V']], z, DM, p[3] * taus[1], Mej,
                        Ek, p[1], p[2], p[0])
    I_pred = predNiSmod(t[2], wave_0[bands['i']], z, DM, p[3] * taus[2], Mej,
                        Ek, p[1], p[2], p[0])
    #Power law component
    B_pred = B_pred + earlyFit(t[0], p[4] * (1. + z), p[5], p[8])
    V_pred = V_pred + earlyFit(t[1], p[4] * (1. + z), p[6], p[9])
    I_pred = I_pred + earlyFit(t[2], p[4] * (1. + z), p[7], p[10])
    #Error
    B_err = (B_pred - L[0]) / L_err[0]
    V_err = (V_pred - L[1]) / L_err[1]
    I_err = (I_pred - L[2]) / L_err[2]
    err = np.concatenate([B_err, V_err, I_err], axis=0)
    return np.array(err, dtype=float)
コード例 #5
0
ファイル: ShockMod.py プロジェクト: niyuanqi/SNAP
def kasenPowMultiErr(p, t, L, L_err, z, DM, m_c, e_51, sep, angle):
    from Cosmology import wave_0, bands
    from LCFitting import earlyFit
    #Kasen component p0=epoch (in rest frame), p1=a13, p2=theta
    B_pred = np.array([KasenFit(ti, sep, 1.0, wave_0[bands['B']], z,
                                m_c, e_51, DM, p[0])
                       for ti in t[0]])*Kasen_isocorr(angle)
    V_pred = np.array([KasenFit(ti, sep, 1.0, wave_0[bands['V']], z,
                                m_c, e_51, DM, p[0])
                       for ti in t[1]])*Kasen_isocorr(angle)
    I_pred = np.array([KasenFit(ti, sep, 1.0, wave_0[bands['i']], z,
                                m_c, e_51, DM, p[0])
                       for ti in t[2]])*Kasen_isocorr(angle)
    #Power law component, p3=epoch
    B_pred = np.array(B_pred) + earlyFit(t[0], p[1]*(1.+z), p[2], p[5]) 
    V_pred = np.array(V_pred) + earlyFit(t[1], p[1]*(1.+z), p[3], p[6]) 
    I_pred = np.array(I_pred) + earlyFit(t[2], p[1]*(1.+z), p[4], p[7]) 
    #Error
    B_err = (B_pred - L[0])/L_err[0]
    V_err = (V_pred - L[1])/L_err[1]
    I_err = (I_pred - L[2])/L_err[2]
    return np.concatenate([B_err, V_err, I_err],axis=0)