Beispiel #1
0
def plot_velocity_spectra(oober, frame, density=0):
    if density == 0:
        field_out = 'velocity'
    elif density == 1:
        field_out = 'velocity-dhalf'
    elif density == 2:
        field_out = 'velocity-dthird'
    if mark_time:
        mark_time('fft %s-velocity' % x)
    filename = spectra_filename(oober, frame, None, field_out)
    k, p = davetools.dpy(filename, ['k', 'power'])
    plt.clf()
    plt.plot(MinK(k), p, marker='*')
    plt.yscale('log')
    plt.xscale('log')
    fname = '%s_%04d_velocity_%s.pdf' % (oober.outname, frame, field_out)
    plt.savefig(fname)
    print(fname)
    return k, p
Beispiel #2
0
def plot_helm(oober, frame, field):
    TheXmultiplier = MinK
    TheX_Lim = (9e-1, 300)
    TheX_Setname = 'k'
    TheY_Setname = 'power'
    TheX_Label = r'$k/k_{\rm{min}}$'
    fieldlist = ['converging-%s' % field, 'solenoidal-%s' % field]
    TheWeight = None
    plt.clf()
    out_power = []
    for n, field in enumerate(fieldlist):
        filename = spectra_filename(oober, frame, None, field)
        k, p = davetools.dpy(filename, ['k', 'power'])
        out_power.append(p)
        plt.plot(MinK(k), p, label=['ud', 'us'][n])

    plt.xscale('log')
    plt.yscale('log')
    fname = '%s_%04d_Helmholtz_%s_ud_us.pdf' % (oober.outname, frame, field)
    plt.legend(loc=0)
    plt.savefig(fname)
    print(fname)
    return k, out_power[0], out_power[1]
Beispiel #3
0
#rhohat = np.ascontiguousarray(rhohat, dtype=np.double)
plt.close('all')
if 1:
    #image the two harmonic spaces
    fig, ax = plt.subplots(1, 2)
    ax0 = ax[0]
    ax1 = ax[1]
    ppp = ax0.pcolormesh(np.abs(rhohat1))
    ppp = ax1.pcolormesh(np.abs(rs['harm']))
    fig.savefig('hats.png')

if 1:
    #plot the shell averaged spaces
    fig, ax = plt.subplots(1, 1)
    ff, empty = shell_average(rhohat1, filename="./spectra_hat.h5")
    k, p = dt.dpy("./spectra_hat.h5", ['k', 'power'])
    p = np.abs(p)
    ok = slice(None)  #k>0
    kok = k[ok] * np.pi * 2

    ax.plot(kok, p[ok] / p[ok].max(), c='k', marker='o', label='Spec_tool')
    the_y = rs['ClBB']
    the_x = rs['lbins'][:-1]
    ax.plot(the_x, the_y / the_y.max(), c='b', marker='o', label='cmbtool')
    ax.legend(loc=0)
    dt.axbonk(ax, xlabel='k', ylabel='rho(||k||)', yscale='log')
    ax.set_xscale('symlog', linthreshx=1)
    ax.set_xlim(0, max([the_x.max(), kok.max()]))

    fig.savefig('shells.png')
"""
Beispiel #4
0
 def read_spectra(self,frame,ax='x'):
     """read 3d spectra"""
     self.vspec=dt.dpy( "%s/DD%04d.products/power_velocity.h5"%(self.simulation.directory,frame) , ['k','power'])
     self.aspec=dt.dpy( "%s/DD%04d.products/power_acceleration.h5"%(self.simulation.directory,frame) , ['k','power'])
     self.dspec=dt.dpy( "%s/DD%04d.products/power_density.h5"%(self.simulation.directory,frame) , ['k','power'])
     self.hspec=dt.dpy( "%s/DD%04d.products/power_magnetic.h5"%(self.simulation.directory,frame) , ['k','power'])