Ejemplo n.º 1
0
def residual(data, dataerr, redshift, h, m, de):
    def integrand(z, m, de):  ##Integral in luminosity distance equation
        return 1 / np.sqrt((m * (1 + z)**3) + de)

    resid = 0
    for i in range(len(data)):
        integral = quad(integrand, 0, redshift[i], args=(m, de))
        d = (fun.c * (1 + redshift[i])) / h * integral[0]
        model = fun.dmod(d) + 20
        resid = resid + (data[i] -
                         model)**2 / dataerr[i]**2  ##Sum of each residual

    return resid
Ejemplo n.º 2
0
small_H = fun.HMpc(np.array(smallred), np.array(smalldist))
small_dH = fun.dHMpc(np.array(smallred), np.array(smalldist),
                     np.array(smalldisterror))

Allred = [x[0] for x in All]
Alldist = [x[1] for x in All]
Alldisterror = [x[2] for x in All]
AllRA = [x[3] for x in All]
Alldec = [x[4] for x in All]

minres = 100000
largeH = 0
i = 0
while i < 1000:
    h = 65 + i / 100
    res = fun.residual(fun.dmod(largedist), fun.dmod(largedisterror), largered,
                       h, 0.2807, 0.7193)
    if res < minres:
        minres = res
        largeH = h
    i += 1

largebestH = 73.7
smallbestH = 64.1

redshiftrange = np.linspace(minredshift, maxredshift, 10)
largeH = [fun.c * x / largebestH for x in redshiftrange]
smallH = [fun.c * x / smallbestH for x in redshiftrange]

##Graph for redshift vs distance
plt.figure()
Ejemplo n.º 3
0
SGCdec = [x[4] for x in SN_SGC]
SGC_H = fun.HMpc(np.array(SGCred), np.array(SGCdist))
SGC_dH = fun.dHMpc(np.array(SGCred), np.array(SGCdist), np.array(SGCdisterror))

Allred = [x[0] for x in All]
Alldist = [x[1] for x in All]
Alldisterror = [x[2] for x in All]
AllRA = [x[3] for x in All]
Alldec = [x[4] for x in All]

minres = 100000
NGCH = 0
i = 0
while i < 1000:
    h = 65 + i / 100
    res = fun.residual(fun.dmod(NGCdist), fun.dmod(NGCdisterror), NGCred, h,
                       0.2807, 0.7193)
    if res < minres:
        minres = res
        NGCH = h
    i += 1

redshiftrange = np.linspace(minredshift, maxredshift, 10)
NGCH = [fun.c * x / 68.41 for x in redshiftrange]
SGCH = [fun.c * x / 66.9 for x in redshiftrange]

##Graph for redshift vs distance
plt.figure()
plt.errorbar(NGCred,
             NGCdist,
             yerr=NGCdisterror,