Exemple #1
0
def dump_SF2(Rmag, SF2, outname):

    dx = 1. / 128
    bins = np.arange(0.5 * dx, 2, dx)
    binner = rb.rb2(Rmag / 128, SF2, bins=bins)
    ax.plot(binner[1], binner[2])
    dpy_save(outname, {
        'R': binner[1],
        'SF2L': binner[2]
    },
             fields=['R', 'SF2L'])
    fig.savefig('plots_to_sort/thing2.png')
    plt.close(fig)
Exemple #2
0
def binnedplot(fig, ax, Rmag, SF2):
    dx = 1. / 128
    bins = np.arange(0.5 * dx, 2, dx)
    #reload(rb)
    binner = rb.rb2(Rmag / 128, SF2, bins=bins)
    rbins = binner[1]
    SF2bins = binner[2]
    ax.plot(rbins, SF2bins)

    ok = np.logical_and(rbins > 0, SF2bins > 0)
    ok = np.logical_and(ok, np.isnan(SF2bins) == False)
    ok = np.logical_and(ok, rbins < 0.5)

    if 0:
        X, Y = binner[1][ok], binner[2][ok]
        pfit = np.polyfit(np.log10(X), np.log10(Y), 1)
        logx = np.log10(X)
        ax.plot(X, 10**(logx * pfit[0] + pfit[1]), c='k')
    if 1:
        X, Y = binner[1][ok], binner[2][ok]
        pfit = np.polyfit(X, Y, 1)
        logx = np.log10(X)
        ax.plot(X, (X * pfit[0] + pfit[1]), c='k')
    SF2L = [[], [], []]
    Things = []
    R[0], SF2L[0] = dpy(dl.sf_path + '/SF2_L_subset_2_u05.h5',
                        ['Rmag', 'SF2_L'])
    R[1], SF2L[1] = dpy(dl.sf_path + '/SF2_L_subset_2_u10.h5',
                        ['Rmag', 'SF2_L'])
    R[2], SF2L[2] = dpy(dl.sf_path + '/SF2_L_subset_2_u11.h5',
                        ['Rmag', 'SF2_L'])
    SCALE = 128**6
    SCALE = 1 / 128**3
    import radial_binner as rb
    reload(rb)
    for n in range(3):
        #bins = np.linspace(0,128,129)/128
        bins = np.linspace(0, 64, 65) / 64
        bin_edge, bin_center, values = rb.rb2(R[n] / 128, SF2L[n], bins=bins)
        bin_center, values = clean(bin_center, values)
        Things.append([bin_center, values])

SCALE = 128**6
SCALE = 1 / 128**3

if 1:
    import sf2
    reload(sf2)
    for nrun, this_run in enumerate([run1, run2, run3]):
        if 'msf' not in dir() or True:
            msf = sf2.make_sf(this_run.this_looper, 0)
            rbins, SS = msf.bin_sf2()
            SS /= 2 * np.pi
        #plot(this_run,0, my_sf2=[rbins,SS])
Exemple #4
0
        im1=rho.sum(axis=1)
        im2=AC.sum(axis=1)

    ax1.imshow(im1)
    ax2.imshow(im2)

    #ax1.plot(rmag[33,33:],  AC[33,33:],c='k')
    ACstripe = AC[33,33:]
    ax3.plot(  ACstripe,c='k',label='slice')
    r1 = np.arange(31)/32 #rmag[33,33:]
    y = 2.0*(np.arccos(r1)- r1*np.sqrt(1.0-r1**2))/np.pi;
    #y = radius*(radius*np.arccos(r1/radius)- r1*np.sqrt(1.0-r1**2/radius**2))/np.pi/128
    ax3.plot( y,c='g',label='ann')

    import radial_binner as rb
    ACbins,ACcen,ACvals = rb.rb2(rmag, AC,nbins=33)
    ax3.plot(ACcen,ACvals,c='r', label='binned')
    dr = ACbins[1:]-ACbins[:-1]

    L = np.sum(ACvals*dr)/ACvals[0]
    rect=patches.Rectangle((0,0),L,ACvals[0],facecolor=[0.2]*3)
    ax3.add_patch(rect)
    print("L = %0.2f R = %0.2f"%(L,radius))

    bins,cen,vals = rb.rb2(rmag, rho/rho.max())
    ax3.plot(cen,vals,c='m')

    ax3.legend(loc=0)
    fig.savefig('plots_to_sort/AC1.png')

if 0: