Exemplo n.º 1
0
            fluxj_visc_stacked += fluxj_visc_average
            fluxj_grav_stacked += fluxj_grav_average

    fluxj_adv_stacked /= len(filename_list)
    fluxj_visc_stacked /= len(filename_list)
    fluxj_grav_stacked /= len(filename_list)

    # Plotting...
    fig = plt.figure(1, figsize=(7.0, 12.0))

    # First map
    ax1 = fig.add_axes([0.10, 0.77, 0.77, 0.22])
    divider = make_axes_locatable(ax1)
    cax = divider.append_axes("right", size="3%", pad=0.08)

    fluximage = ImageData()
    fluximage.data = fluxj_adv_stacked.T
    fluximage.pixelx = grid.R.shape[0]
    fluximage.pixely = grid.phi.shape[0]

    minval, maxval = -4, 4
    extent = [Rmin, Rmax, 0, 2 * np.pi]
    cmap = cm.get_cmap('jet')
    ax, im = plot_slice(ax1,
                        fluximage,
                        cmap=cmap,
                        vmin=minval,
                        vmax=maxval,
                        extent=extent,
                        scale='linear')
    cbar = plt.colorbar(im, cax=cax)
            fluxj_grav_stacked += fluxj_grav_average


    fluxj_adv_stacked /= len(filename_list)
    fluxj_visc_stacked /= len(filename_list)
    fluxj_grav_stacked /= len(filename_list)

    # Plotting...
    fig = plt.figure(1,figsize=(7.0,12.0))
    
    # First map
    ax1 = fig.add_axes([0.10,0.77,0.77,0.22])
    divider = make_axes_locatable(ax1)
    cax = divider.append_axes("right", size="3%", pad=0.08)
    
    fluximage = ImageData()
    fluximage.data = fluxj_adv_stacked.T
    fluximage.pixelx = grid.R.shape[0]
    fluximage.pixely = grid.phi.shape[0]
    
    minval, maxval = -4, 4
    extent = [Rmin,Rmax,0,2*np.pi]
    cmap = cm.get_cmap('jet')
    ax, im = plot_slice(ax1,fluximage,cmap = cmap, 
                        vmin=minval,vmax=maxval,extent=extent,scale='linear')
    cbar = plt.colorbar(im,cax=cax)
    cbar.set_label(r'$F_{J,{\rm adv}}\,/(\dot{M}_0a_{\rm b}\Omega_{\rm b})$',size=20)

    ax1.set_xticklabels([])
    ticks = [0,np.pi/2,np.pi,1.5 * np.pi, 2 * np.pi ]
    ax1.set_yticks(ticks)
        # compute angular momentum flux maps
        fluxj_grav = dda.compute_angular_momentum_flux_gravity(snap,grid) / Mdot0
        fluxj_visc = dda.compute_angular_momentum_flux_viscosity(snap,grid) / Mdot0
        fluxj_adv = dda.compute_angular_momentum_flux_advection(snap,grid) / Mdot0


        #######################################################################
        # Plotting...
        fig = plt.figure(1,figsize=(7.0,12.0))
        
        # First map
        ax1 = fig.add_axes([0.10,0.77,0.77,0.22])
        divider = make_axes_locatable(ax1)
        cax = divider.append_axes("right", size="3%", pad=0.08)
        
        fluximage = ImageData()
        fluximage.data = fluxj_adv.T
        fluximage.pixelx = grid.X.shape[0]
        fluximage.pixely = grid.Y.shape[0]
        
        minval, maxval = None, None
        extent = [Rmin,Rmax,0,2*np.pi]
        cmap = cm.get_cmap('jet')
        ax, im = plot_slice(ax1,fluximage,normalize=6.0e-4,cmap = cmap, 
                            vmin=minval,vmax=maxval,extent=extent,scale='linear')
        cbar = plt.colorbar(im,cax=cax)
        
        ax1.set_xticklabels([])
        ticks = [0,np.pi/2,np.pi,1.5 * np.pi, 2 * np.pi ]
        ax1.set_yticks(ticks)
        ticklabels = [r'$0$',r'$\frac{1}{2}\pi$',r'$\pi$',r'$\frac{3}{2}\pi$',r'$\pi$']
    outfile = 'averaged_angmomflux_norbits%i-%i_q%.1f_e%.1f_h%.1f_alpha%.1f_eta%.2f.hdf5' % (orbit_range[0],orbit_range[-1],qb,eb,h0,alpha,eta)
    print "Saving HDF5 file:",outfile
    with h5py.File(outfile, 'w') as hf:
        hf.create_dataset("FluxAdvection",  data = fluxj_adv_average)
        hf.create_dataset("FluxViscosity",  data = fluxj_visc_average)
        hf.create_dataset("FluxGravity",  data = fluxj_grav_average)

    # Plotting...
    fig = plt.figure(1,figsize=(7.0,12.0))
    
    # First map
    ax1 = fig.add_axes([0.10,0.77,0.77,0.22])
    divider = make_axes_locatable(ax1)
    cax = divider.append_axes("right", size="3%", pad=0.08)
    
    fluximage = ImageData()
    fluximage.data = fluxj_adv_average.T
    fluximage.pixelx = grid.X.shape[0]
    fluximage.pixely = grid.Y.shape[0]
    
    minval, maxval = None, None
    extent = [Rmin,Rmax,0,2*np.pi]
    cmap = cm.get_cmap('jet')
    ax, im = plot_slice(ax1,fluximage,normalize=6.0e-4,cmap = cmap, 
                        vmin=minval,vmax=maxval,extent=extent,scale='linear')
    cbar = plt.colorbar(im,cax=cax)
    
    ax1.set_xticklabels([])
    ticks = [0,np.pi/2,np.pi,1.5 * np.pi, 2 * np.pi ]
    ax1.set_yticks(ticks)
    ticklabels = [r'$0$',r'$\frac{1}{2}\pi$',r'$\pi$',r'$\frac{3}{2}\pi$',r'$\pi$']
             ms=1.6)
    plt.xlim(0.5 * snap.header.boxsize - 5, 0.5 * snap.header.boxsize + 5)
    plt.ylim(0.5 * snap.header.boxsize - 5, 0.5 * snap.header.boxsize + 5)
    plt.xlabel(r'$x$', size=18)
    plt.ylabel(r'$y$', size=18)
    plt.axes().set_aspect('equal')
    plt.savefig('./accretion_regions.png')
    fig.clf()

    from disk_data_analysis.plotting import plot_slice, ImageData
    import matplotlib.cm as cm

    fig = plt.figure(2, figsize=(12.0, 5.5))
    fig.subplots_adjust(top=0.98, bottom=0.12, left=0.07, right=0.92)

    image = ImageData()
    image.read('../data/density_field_close_000')
    image.interpolateneg()
    image.replaceneg()

    #ax = fig.add_subplot(121)
    ax = fig.add_axes([-0.17, 0.13, 0.85, 0.85])
    minval, maxval = 10**(-4.12), 10**(1.03)
    extent = [77.5, 82.5, 77.5, 82.5]
    ax, im = plot_slice(ax,
                        image,
                        normalize=Sigma_out,
                        vmin=minval,
                        vmax=maxval,
                        extent=extent,
                        scale='log')
    density_average /= len(snap_list)
    torquedensity_average /= len(snap_list)
        
    from disk_data_analysis.plotting import plot_slice, ImageData
    import matplotlib.cm as cm

    # Save image data into HDF5 file
    with h5py.File('averaged_density.hdf5', 'w') as hf:
        hf.create_dataset("Density",  data = density_average)
    
    with h5py.File('averaged_torquedensity.hdf5', 'w') as hf:
        hf.create_dataset("TorqueDensity",  data = torquedensity_average)
    
    
    # Create image data structure for the density field...
    densityimage = ImageData()
    densityimage.data = density_average.T
    densityimage.pixelx = grid.X.shape[0]
    densityimage.pixely = grid.Y.shape[0]

    # ... and plot it   
    fig = plt.figure()
    fig.subplots_adjust(top=0.97,right=0.88,bottom=0.12,left=0.10)
    ax = fig.add_subplot(111)
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.08)

    
    minval,maxval = 10**(-4.9),10**(0.25)
    extent = [74.0,86.0,74.0,86.0]
    ax, im = plot_slice(ax,densityimage,normalize=6.0e-4,vmin=minval,vmax=maxval,extent=extent,scale='log')
Exemplo n.º 7
0
        orbit_range[0], orbit_range[-1], qb, eb, h0, alpha, eta)
    print "Saving HDF5 file:", outfile
    with h5py.File(outfile, 'w') as hf:
        hf.create_dataset("FluxAdvection", data=fluxj_adv_average)
        hf.create_dataset("FluxViscosity", data=fluxj_visc_average)
        hf.create_dataset("FluxGravity", data=fluxj_grav_average)

    # Plotting...
    fig = plt.figure(1, figsize=(7.0, 12.0))

    # First map
    ax1 = fig.add_axes([0.10, 0.77, 0.77, 0.22])
    divider = make_axes_locatable(ax1)
    cax = divider.append_axes("right", size="3%", pad=0.08)

    fluximage = ImageData()
    fluximage.data = fluxj_adv_average.T
    fluximage.pixelx = grid.X.shape[0]
    fluximage.pixely = grid.Y.shape[0]

    minval, maxval = None, None
    extent = [Rmin, Rmax, 0, 2 * np.pi]
    cmap = cm.get_cmap('jet')
    ax, im = plot_slice(ax1,
                        fluximage,
                        normalize=6.0e-4,
                        cmap=cmap,
                        vmin=minval,
                        vmax=maxval,
                        extent=extent,
                        scale='linear')
Exemplo n.º 8
0
if __name__ == '__main__':

    #binary and disk properties
    qb = float(sys.argv[1])
    eb = float(sys.argv[2])
    h0 = simset.h
    alpha = simset.alpha
    eta = float(sys.argv[3])
    snap_num = int(sys.argv[4])

    snap_path = simset.find_simulation(qb, eb, h0, alpha, eta)

    fig = plt.figure(2, figsize=(12.0, 5.5))
    fig.subplots_adjust(top=0.98, bottom=0.12, left=0.07, right=0.92)

    image = ImageData()
    image.read(snap_path + 'density_field_%03i' % snap_num)
    image.interpolateneg()
    image.replaceneg()

    ax = fig.add_subplot(111)
    minval, maxval = 10**(-4.12), 10**(1.03)
    extent = [77.5, 82.5, 77.5, 82.5]
    ax, im = plot_slice(ax,
                        image,
                        normalize=Sigma_out,
                        vmin=minval,
                        vmax=maxval,
                        extent=extent,
                        scale='log')
    ax.set_xlabel(r'$x/a_{\rm b}$', size=22)
Exemplo n.º 9
0
if __name__ == '__main__':

    #binary and disk properties
    qb=float(sys.argv[1])
    eb=float(sys.argv[2])
    h0=simset.h
    alpha=simset.alpha
    eta = float(sys.argv[3])
    snap_num = int(sys.argv[4])
    
    snap_path = simset.find_simulation(qb,eb,h0,alpha,eta)

    fig = plt.figure(2,figsize = (12.0,5.5))
    fig.subplots_adjust(top=0.98,bottom=0.12,left=0.07,right=0.92)
    
    image = ImageData()
    image.read(snap_path+'density_field_%03i' % snap_num)
    image.interpolateneg()
    image.replaceneg()

    ax = fig.add_subplot(111)
    minval,maxval = 10**(-4.12),10**(1.03)
    extent = [77.5,82.5,77.5,82.5]
    ax,im = plot_slice(ax,image,normalize=Sigma_out,
                       vmin=minval,vmax=maxval,extent=extent,scale='log')
    ax.set_xlabel(r'$x/a_{\rm b}$',size=22)
    ax.set_ylabel(r'$y/a_{\rm b}$',size=22)
    ax.set_aspect('equal')


    ticklabels = ["%i" % (t - 0.5 * snap.header.boxsize)  for t in ax.get_xticks()]
Exemplo n.º 10
0
    # Divide by the total number of snapshots added
    density_average /= len(snap_list)
    torquedensity_average /= len(snap_list)

    from disk_data_analysis.plotting import plot_slice, ImageData
    import matplotlib.cm as cm

    # Save image data into HDF5 file
    with h5py.File('averaged_density.hdf5', 'w') as hf:
        hf.create_dataset("Density", data=density_average)

    with h5py.File('averaged_torquedensity.hdf5', 'w') as hf:
        hf.create_dataset("TorqueDensity", data=torquedensity_average)

    # Create image data structure for the density field...
    densityimage = ImageData()
    densityimage.data = density_average.T
    densityimage.pixelx = grid.X.shape[0]
    densityimage.pixely = grid.Y.shape[0]

    # ... and plot it
    fig = plt.figure()
    fig.subplots_adjust(top=0.97, right=0.88, bottom=0.12, left=0.10)
    ax = fig.add_subplot(111)
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.08)

    minval, maxval = 10**(-4.9), 10**(0.25)
    extent = [74.0, 86.0, 74.0, 86.0]
    ax, im = plot_slice(ax,
                        densityimage,
    plt.plot(snap.gas.POS[str_region,0],snap.gas.POS[str_region,1],'.',color='orange',ms=1.6)
    plt.xlim(0.5 * snap.header.boxsize - 5, 0.5 * snap.header.boxsize + 5)
    plt.ylim(0.5 * snap.header.boxsize - 5, 0.5 * snap.header.boxsize + 5)
    plt.xlabel(r'$x$',size=18)
    plt.ylabel(r'$y$',size=18)
    plt.axes().set_aspect('equal')
    plt.savefig('./accretion_regions.png')
    fig.clf()

    from disk_data_analysis.plotting import plot_slice, ImageData
    import matplotlib.cm as cm
    
    fig = plt.figure(2,figsize = (12.0,5.5))
    fig.subplots_adjust(top=0.98,bottom=0.12,left=0.07,right=0.92)
    
    image = ImageData()
    image.read('../data/density_field_close_000')
    image.interpolateneg()
    image.replaceneg()
    
    #ax = fig.add_subplot(121)
    ax = fig.add_axes([-0.17,0.13,0.85,0.85])
    minval,maxval = 10**(-4.12),10**(1.03)
    extent = [77.5,82.5,77.5,82.5]
    ax,im = plot_slice(ax,image,normalize=Sigma_out,
                       vmin=minval,vmax=maxval,extent=extent,scale='log')
    ax.set_xlabel(r'$x/a_{\rm b}$',size=22)
    ax.set_ylabel(r'$y/a_{\rm b}$',size=22)
    ax.set_aspect('equal')