Пример #1
0
                     label='$N=%i, \mu=%.2f$, $\sigma=%.2f$' %
                     (len(outside_dist_dH), NLSSmu, NLSSsigma),
                     color='white')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Histogram of luminosity distance diviation for supernovae of \ncluster origin and not of cluster origin'
)
plt.legend()
plt.show()

within_dist_dH.sort()
outside_dist_dH.sort()

plt.plot(within_dist_dH,
         fun.cumfreq(within_dist_dH),
         label="Cluster Origin, (N=%i)" % len(within_dist_dH),
         color='blue')
plt.plot(outside_dist_dH,
         fun.cumfreq(outside_dist_dH),
         label="Not cluster origin (N=%i)" % len(outside_dist_dH),
         color='green')
emptyNLSS = plt.hist([],
                     range=[-1, 1],
                     alpha=0.5,
                     label='Stat=%.3f \np-val=%.4f' %
                     (ks_2samp(within_dist_dH, outside_dist_dH)[0],
                      ks_2samp(within_dist_dH, outside_dist_dH)[1]),
                     color='white')
plt.legend()
#plt.axis([-0.5, 0.5, 0, 1])
Пример #2
0
Hinmean = sum(Hin) / len(Hin)
Hinerror = fun.stdev(Hin, Hinmean) / np.sqrt(len(Hin))
print('Hubble Constant within distance to cluster: ', Hinmean, ' pm ',
      Hinerror)
Hout = [fun.HubbleLCDM(x[2], fun.D(x[0])) for x in SNeout]
Houtmean = sum(Hout) / len(Hout)
Houterror = fun.stdev(Hout, Houtmean) / np.sqrt(len(Hout))
print('Hubble Constant within distance to cluster: ', Houtmean, ' pm ',
      Houterror)

####CUMFREQ
cin.sort()
cout.sort()

plt.plot(cin,
         fun.cumfreq(cin),
         label="Cluster Origin, (N=%i)" % len(cin),
         color='blue')
plt.plot(cout,
         fun.cumfreq(cout),
         label="Not cluster origin (N=%i)" % len(cout),
         color='green')
emptyNLSS = plt.hist([],
                     range=[-1, 1],
                     alpha=0.5,
                     label='Stat=%.3f \np-val=%.4f' %
                     (ks_2samp(cin, cout)[0], ks_2samp(cin, cout)[1]),
                     color='white')
plt.legend()
#plt.axis([-0.5, 0.5, 0, 1])
plt.xlabel('$\delta d_L$')
Пример #3
0
print(ks_2samp(dHin, dHout))

'''
####H values
Hin = [fun.HubbleLCDM(x[2], fun.D(x[0])) for x in SNein]
Hinmean = sum(Hin)/len(Hin)
Hinerror = fun.stdev(Hin, Hinmean)/np.sqrt(len(Hin))
print('Hubble Constant within distance to cluster: ', Hinmean, ' pm ', Hinerror)
Hout = [fun.HubbleLCDM(x[2], fun.D(x[0])) for x in SNeout]
Houtmean = sum(Hout)/len(Hout)
Houterror = fun.stdev(Hout, Houtmean)/np.sqrt(len(Hout))
print('Hubble Constant within distance to cluster: ', Houtmean, ' pm ', Houterror)
'''

####CUMFREQ
dHin.sort()
dHout.sort()

plt.plot(dHin, fun.cumfreq(dHin), label="Cluster Origin, (N=%i)"%len(dHin), color='blue')
plt.plot(dHout, fun.cumfreq(dHout), label="Not cluster origin (N=%i)"%len(dHout), color='green')
emptyNLSS = plt.hist([], range=[-1,1], alpha=0.5, label='Stat=%.3f \np-val=%.4f'%(ks_2samp(dHin, dHout)[0], ks_2samp(dHin, dHout)[1]), color='white')
plt.legend()
#plt.axis([-0.5, 0.5, 0, 1])
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Cumulative frequency')
plt.title('Cumulative frequency graph for SN of cluster and non-cluster origin')
plt.show()



Hin = [fun.HubbleLCDM(x[2], fun.D(x[0])) for x in SNein]
Hinmean = sum(Hin)/len(Hin)
Hinerror = fun.stdev(Hin, Hinmean)/np.sqrt(len(Hin))
print('Hubble Constant within distance to cluster: ', Hinmean, ' pm ', Hinerror)
Hout = [fun.HubbleLCDM(x[2], fun.D(x[0])) for x in SNeout]
Houtmean = sum(Hout)/len(Hout)
Houterror = fun.stdev(Hout, Houtmean)/np.sqrt(len(Hout))
print('Hubble Constant within distance to cluster: ', Houtmean, ' pm ', Houterror)
'''

####CUMFREQ
dHin.sort()
dHout.sort()

plt.plot(dHin,
         fun.cumfreq(dHin),
         label="Cluster Origin, (N=%i)" % len(dHin),
         color='blue')
plt.plot(dHout,
         fun.cumfreq(dHout),
         label="Not cluster origin (N=%i)" % len(dHout),
         color='green')
emptyNLSS = plt.hist([],
                     range=[-1, 1],
                     alpha=0.5,
                     label='Stat=%.3f \np-val=%.4f' %
                     (ks_2samp(dHin, dHout)[0], ks_2samp(dHin, dHout)[1]),
                     color='white')
plt.legend()
#plt.axis([-0.5, 0.5, 0, 1])
plt.xlabel('% Deviation from expected distance')
Пример #5
0
                      alpha=0.5,
                      label='$N=%i, \mu=%.2f$, $\sigma=%.2f$' %
                      (len(small_dH), smallmu, smallsigma),
                      color='white')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Histogram of deviation from expected distance for small and its corresponding dipole supernovae'
)
plt.legend()
plt.show()

large_dH.sort()
small_dH.sort()

plt.plot(large_dH, fun.cumfreq(large_dH), label="Maximal H0", color='blue')
plt.plot(small_dH, fun.cumfreq(small_dH), label="Minimal H0", color='red')
emptyNLSS = plt.hist(
    [],
    range=[-0.3, 0.3],
    alpha=0.5,
    label='Stat=%.3f \np-val=%.4f' %
    (ks_2samp(large_dH, small_dH)[0], ks_2samp(large_dH, small_dH)[1]),
    color='white')
plt.xlabel('$\delta d_L$')
plt.ylabel('Frequency')
plt.title(
    'Cumulative frequency for the deviations \nof SNe found in the area of maximal and minimal expansion.'
)
plt.legend()
plt.show()
Пример #6
0
                    alpha=0.5,
                    label='$N=%i, \mu=%.2f$, $\sigma=%.2f$' %
                    (len(SGC_dH), SGCmu, SGCsigma),
                    color='white')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Histogram of deviation from expected distance for SGC and its corresponding dipole supernovae'
)
plt.legend()
plt.show()

NGC_dH.sort()
SGC_dH.sort()

plt.plot(NGC_dH, fun.cumfreq(NGC_dH), label="NGC", color='blue')
plt.plot(SGC_dH, fun.cumfreq(SGC_dH), label="SGC", color='red')
emptyNLSS = plt.hist(
    [],
    range=[-0.3, 0.3],
    alpha=0.5,
    label='Stat=%.3f \np-val=%.4f' %
    (ks_2samp(NGC_dH, SGC_dH)[0], ks_2samp(NGC_dH, SGC_dH)[1]),
    color='white')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Cumulative frequency for the deviations in the SGC and its corresponding dipole.'
)
plt.legend()
plt.show()
Пример #7
0
sys.path.insert(0, 'C:\Python34\masters\graphs')
import functions as fun

##Create two Gaussian distributions of random numbers, differing
##only in a standard deviation of 0.2.
dist1 = np.random.normal(0, 1, 500)
dist2 = np.random.normal(0, 0.8, 2000)

print(ks_2samp(dist1, dist2))  ##Perform a KS test

dist1.sort()  ##Sort the two distributions from low to high to create
dist2.sort()  ##a cumulative frequency plot

##Plotting
plt.plot(dist1, fun.cumfreq(dist1), label="Distribution 1", color='blue')
plt.plot(dist2, fun.cumfreq(dist2), label="Distribution 2", color='red')
emptyNLSS = plt.hist([],
                     range=[-0.3, 0.3],
                     alpha=0.5,
                     label='Stat=%.3f \np-val=%.4f' %
                     (ks_2samp(dist1, dist2)[0], ks_2samp(dist1, dist2)[1]),
                     color='white')
plt.xlabel('Value')
plt.ylabel('Cumulative Frequency')
plt.legend()
plt.show()

##Empirical p-value determination
bothdist = np.append(dist1, dist2)  ##Parent distribution
trials = 10000
Пример #8
0
                    label='$N=%i, \mu=%.2f$, $\sigma=%.2f$' %
                    (len(SGC_dH), SGCmu, SGCsigma),
                    color='white')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Histogram of deviation from expected distance for supernovae\n from maximal and minimal accelerating regions'
)
plt.legend()
plt.show()

NGC_dH.sort()
SGC_dH.sort()

plt.plot(NGC_dH,
         fun.cumfreq(NGC_dH),
         label="Maximal acceleration",
         color='blue')
plt.plot(SGC_dH,
         fun.cumfreq(SGC_dH),
         label="Minimal acceleration",
         color='red')
plt.xlabel('% Deviation from expected distance')
plt.ylabel('Frequency')
plt.title(
    'Cumulative frequency for the for supernovae\n from maximal and minimal accelerating regions'
)
plt.legend()
plt.show()

#########EQUITORIAL COORDINATE
Пример #9
0
while i < len(NGCred):
    NGC_dH.append((fun.D(fun.HubbleIntegrate(NGCred[i])) - NGCdist[i]) /
                  fun.D(fun.HubbleIntegrate(NGCred[i])))
    i += 1
i = 0
while i < len(SGCred):
    SGC_dH.append((fun.D(fun.HubbleIntegrate(SGCred[i])) - SGCdist[i]) /
                  fun.D(fun.HubbleIntegrate(SGCred[i])))
    i += 1

print(ks_2samp(NGC_dH, SGC_dH))

NGC_dH.sort()
SGC_dH.sort()

plt.plot(NGC_dH, fun.cumfreq(NGC_dH), label="Maximal expansion", color='blue')
plt.plot(SGC_dH, fun.cumfreq(SGC_dH), label="Minimal expansion", color='red')
emptyNLSS = plt.hist(
    [],
    range=[-0.3, 0.3],
    alpha=0.5,
    label='Stat=%.3f \np-val=%.4f' %
    (ks_2samp(NGC_dH, SGC_dH)[0], ks_2samp(NGC_dH, SGC_dH)[1]),
    color='white')
plt.xlabel('$\delta d_L$')
plt.ylabel('Cumulative Frequency')
plt.title(
    'Cumulative frequency for the deviations in the\n maximal and minimal rate of expansion'
)
plt.legend()
plt.show()