Exemplo n.º 1
0
colors = ['r', 'b', 'g', 'y', 'm', 'orange', 'brown', 'k']
normed = True

mms = [1e6, 1e7, 1e8, 1e9, 1e10]

for M0 in mms:
    print('For M0 = %0.2e' % M0)

    #mbins = np.linspace(np.log10(M0)-1, min(10, np.log10(M0) + 4), 10)[::-1]
    #mbins = 10**mbins

    mbins = np.logspace(7, 10, 16)[::-1]
    msave = [mbins[0] * 100] + list(mbins)

    scatter = dg.gridscatter(datapR[...] / (datapR[...].mean() + M0),
                             predictR[...] / (predictR[...].mean() + M0),
                             mbins, datapR[...])
    tosave = []
    #bins = np.linspace(-0.5, 0.7)
    fig, ax = plt.subplots(4, 4, figsize=(15, 15))

    for i in range(16):
        #Asymmettric
        mean, std = (scatter[i][1] -
                     scatter[i][0]).mean(), (scatter[i][1] -
                                             scatter[i][0]).std()
        bins = np.linspace(mean - 3 * std, mean + 3 * std)
        #bins = np.linspace(-(4*ii+5)/(i+1), (3*ii+5)/(i+1))
        axis = ax.flatten()[i]
        axis.hist(scatter[i][1] - scatter[i][0],
                  histtype='step',
Exemplo n.º 2
0
print('Data generated')

colors = ['r', 'b', 'g', 'y', 'm', 'orange', 'brown', 'k']

###########################################

mbins = np.logspace(10, 13, 16)[::-1]
msave = [mbins[0] * 100] + list(mbins)
print('mbins -- ', mbins)

func = dg.normal
normed = True

####
scatter = dg.gridscatter(datapR[...], predictR[...], mbins, datamR[...])

tosave = []
fig, ax = plt.subplots(4, 4, figsize=(16, 16))
for i in range(ax.size):
    axis = ax.flatten()[i]
    mean, std = (scatter[i][1] - scatter[i][0]).mean(), (scatter[i][1] -
                                                         scatter[i][0]).std()
    bins = np.linspace(mean - 3 * std, mean + 3 * std)
    #if normed: x0 = [1/(bins[-1]-bins[0]), mean, std]
    if normed:
        x0 = [1 / (bins[-1] - bins[0]), mean, std]
        #if normed: x0 = [scatter[i][0].size, mean, std]
    else:
        x0 = [scatter[i][0].size, mean, std]
Exemplo n.º 3
0
####

mms = [1e6, 1e7, 1e8, 1e9, 1e10]
for ii, M0 in enumerate(mms[::-1]):
    print('For M0 = %0.2e' % M0)

    #mbins = np.linspace(np.log10(M0)-1, min(10, np.log10(M0) + 2), 16)[::-1]
    mbins = np.logspace(7, 10, 16)[::-1]
    #mbins = 10**mbins
    msave = [mbins[0] * 100] + list(mbins)
    print(mbins)
    normed = False

    normp, normd = predictR.cmean(), datapR.cmean()
    scatter = dg.gridscatter(np.log((datapR[...] + M0) / (normd)),
                             np.log((predictR[...] + M0) / (normp)), mbins,
                             datapR[...])
    #scatter = dg.gridscatter(datapR[...]/(datapR[...].mean()+M0), predictR[...]/(predictR[...].mean()+M0), mbins, datapR[...])
    tosave = []
    #bins = np.linspace(-0.5, 0.7)
    fig, ax = plt.subplots(4, 4, figsize=(15, 15))

    for i in range(16):
        #Asymmettric
        mean, std = (scatter[i][1] -
                     scatter[i][0]).mean(), (scatter[i][1] -
                                             scatter[i][0]).std()
        bins = np.linspace(mean - 3 * std, mean + 3 * std)
        #bins = np.linspace(-(4*ii+5)/(i+1), (3*ii+5)/(i+1))
        axis = ax.flatten()[i]
        axis.hist(scatter[i][1] - scatter[i][0],
Exemplo n.º 4
0
mbins = np.logspace(10, 13, 16)[::-1]
msave = [mbins[0] * 100] + list(mbins)
print('mbins -- ', mbins)

####

mms = [1e10, 1e11, 1e12]
for M0 in mms:
    print('For M0 = %0.2e' % M0)
    #normp, normd = predictR.cmean(), datapR.cmean()
    #scatter = dg.gridscatter(np.log((datapR[...]+M0)/(normd)), np.log((predictR[...]+M0)/(normp)), mbins, datapR[...])
    normd, normp = np.log((datapR[...] + M0)).mean(), np.log(
        (predictR[...] + M0)).mean()
    scatter = dg.gridscatter(
        np.log((datapR[...] + M0)) / normd,
        np.log((predictR[...] + M0)) / normp, mbins, datapR[...])

    tosave = []
    #bins = np.linspace(-0.5, 0.7)
    fig, ax = plt.subplots(4, 4, figsize=(15, 15))
    for i in range(16):
        mean, std = (scatter[i][1] -
                     scatter[i][0]).mean(), (scatter[i][1] -
                                             scatter[i][0]).std()
        bins = np.linspace(mean - 3 * std, mean + 3 * std)
        #bins = np.linspace(-10/(i+1), 10/(i+1))
        axis = ax.flatten()[i]
        axis.hist(scatter[i][1] - scatter[i][0],
                  histtype='step',
                  bins=bins,