コード例 #1
0
        axis.hist(scatter[i][1] - scatter[i][0],
                  histtype='step',
                  bins=bins,
                  normed=normed,
                  color='C%d' % (i % 9),
                  label='%0.2e' % mbins[i])
        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]
        #if normed:  x0 = [10, 0, 1]
        #else: x0 = [scatter[i][1].size/10., 0, 1]
        xx, yy, res = dg.fitpdf(scatter[i][1] - scatter[i][0],
                                func,
                                bins=bins,
                                normed=normed,
                                x0=x0)
        axis.plot(xx,
                  func(xx, *res.x),
                  'k--',
                  label='%0.2f, %0.2f' % (res.x[1], res.x[2]))
        tosave.append([msave[i], msave[i + 1], res.x[1], res.x[2]])
        axis.legend()

    ff = mtpath + 'noisehist_ovd_M%02d_gal.png' % (10 * np.log10(M0))
    if Rsm != 3: ff = ff[:-4] + '_R%d.png' % Rsm
    fig.savefig(ff)

    fpath = mtpath + 'hist_ovd_M%02d_gal.txt' % (10 * np.log10(M0))
    if Rsm != 3: fpath = fpath[:-4] + 'R%d.txt' % Rsm
コード例 #2
0
                             mbins, datapR[...])
    tosave = []
    #bins = np.linspace(-0.5, 0.7)
    fig, ax = plt.subplots(4, 4, figsize=(15, 15))
    for i in range(16):
        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,
                  normed=True,
                  color='C%d' % (i % 9),
                  label='%0.2e' % mbins[i])
        xx, yy, res = dg.fitpdf(scatter[i][1] - scatter[i][0],
                                dg.normal,
                                bins=bins,
                                normed=True,
                                x0=[10, 0., 1])
        axis.plot(xx,
                  dg.normal(xx, *res.x),
                  'k--',
                  label='%0.2f, %0.2f' % (res.x[1], res.x[2]))
        tosave.append([msave[i], msave[i + 1], res.x[1], res.x[2]])
        axis.legend()

    ff = mtpath + 'noisehist_ovd_M%02d_na.png' % (10 * np.log10(M0))
    if Rsm != 3: ff = ff[:-4] + '_R%d.png' % Rsm
    fig.savefig(ff)

    fpath = mtpath + 'hist_ovd_M%02d_na.txt' % (10 * np.log10(M0))
    if Rsm != 3: fpath = fpath[:-4] + 'R%d.txt' % Rsm