print('Ellapsed time:', time.time() - t0) #****************** #3D plotting #****************** lims = np.array([-100, 100]) weight = 1. ax_kw = { 'projection': '3d', 'xlim': lims, 'ylim': lims, 'zlim': lims, 'azim': 30, 'elev': 13 } canvas3d = Plot_model.Canvas3d(ax_kw=ax_kw) ax = canvas3d.ax sp = canvas3d.scatter_random( grid, prop['dens_H2'] / 1e6, weight, GRID_unit=u.au, power=0, NRand=10000, prop_min=1.0, #function arguments marker='+', cmap='jet', s=3, edgecolors='none', vmin=1e7, norm=colors.LogNorm()) #Scatter kwargs
#****************** #3D plotting #****************** lims = np.array([-70, 70]) weight = 1e10 ax_kw = { 'projection': '3d', 'xlim': lims, 'ylim': lims, 'zlim': lims, 'azim': -50, 'elev': 30 } ax3 = fig.add_axes([0.03, 0.53, 0.43, 0.43], **ax_kw) canvas3d = Plot_model.Canvas3d(fig=fig, ax=ax3) sp = canvas3d.scatter_random( grid, density / 1e6, weight, GRID_unit=u.au, power=0, NRand=10000, prop_min=1.0, #function arguments marker='+', cmap='jet', s=3, edgecolors='none', vmin=1e6, norm=colors.LogNorm()) #Scatter kwargs cbar = plt.colorbar(sp)
#------------------------------------ tag = 'ctsphere_HII' weight = dens_e """ Plot_model.scatter3D(GRID, density.total, weight, power=0, NRand = 4000, colordim = density.total / 1e6 / 1e5, axisunit = u.au, cmap = 'winter', marker = 'o', colorlabel = r'$n_{\rm e}$ [cm$^{-3}$] x $10^5$', output = '3Ddens_%s.png'%tag, show = True) Plot_model.scatter3D(GRID, density.total, weight, power=0, NRand = 4000, colordim = temperature.total, axisunit = u.au, cmap = 'winter', marker = 'o', colorlabel = r'$T_{\rm e}$ [Kelvin]', output = '3Dtemp_%s.png'%tag, show = True) """ fig = plt.figure(figsize=(6.4,4.8)) #ax = plt.axes(projection='3d') lims = np.array([-sizex,sizex]) / u.au canvas3d = Plot_model.Canvas3d(fig=fig, ax_kw={'xlim': lims, 'ylim': lims, 'zlim': lims, 'azim': -50, 'elev': 30}) ax = canvas3d.ax #generated with fig.add_axes from matplotlib. All the matplotlib functions are therefore available on ax. sp = canvas3d.scatter_random(GRID, density.total/1e6/1e5, weight/1e6/1e5, GRID_unit=u.au, power=0, NRand=4000, prop_min=1.0, #function arguments marker = 'o', cmap = 'winter', s = 3, edgecolors = 'none', vmin = None, vmax = None, norm = None) #Scatter kwargs #ax.scatter(3000,0,0, c=[dens_e*1.2/1e6], norm=colors.Normalize(density.total.min()/1e6, vmax=density.total.max()/1e6), cmap=sp.cmap) x,y,z = GRID.XYZ ind_rand = np.random.choice(np.arange(len(x)), size=10) vel = np.zeros((3,10)) + 1000*np.sin([np.linspace(0,2*np.pi,10) for i in range(3)])#np.random.random(size=(3,10)) vp = canvas3d.vectors(x[ind_rand], y[ind_rand], z[ind_rand], vel[0], vel[1], vel[2], GRID_unit=u.au, length=1.0, linewidths=2, color='k') cbar = plt.colorbar(sp) cbar.ax.set_ylabel(r'$n_{e^-}$ ($\times$ 10$^5$) cm$^{-3}$') ax.set_xlabel('X') ax.set_ylabel('Y')
colorlabel=r'$T_{\rm e}$ [K]', output='3Dtemp_%s.png' % tag, show=True) #******************************************** #CUSTOMISABLE PLOTS USING Plot_model.Canvas3d #******************************************** fig = plt.figure(figsize=(8, 6)) #ax = plt.axes(projection='3d') lims = (-3000, 3000) #DENSITY canvas3d = Plot_model.Canvas3d(fig=fig, ax_kw={ 'xlim': lims, 'ylim': lims, 'zlim': lims, 'azim': 50, 'elev': 10 }) ax = canvas3d.ax #generated with fig.add_axes from matplotlib, hence all the matplotlib functions are available sp = canvas3d.scatter_random( GRID, density.total, weight, GRID_unit=u.au, power=0.4, NRand=4000, prop_color=density.total / 1e6, prop_min=1e2, #function arguments marker='.', cmap='nipy_spectral',
print('Output columns', lime.columns) #******- #TIMING #******- print ('Ellapsed time: %.3fs' % (time.time() - t0)) print ('-------------------------------------------------\n-------------------------------------------------\n') #******************************************* #3D PLOTTING # The scatter points are randomly # tracing the hydrogen (H) density. # The colormap is associated to the # molecular hydrogen (H2) density in cgs #******************************************* weight = 10*mean_dens canvas3d = Plot_model.Canvas3d(ax_kw={'azim': -50, 'elev': 50}) ax = canvas3d.ax sp = canvas3d.scatter_random(GRID, prop['dens_H'], weight, prop_color = prop['dens_H2']/1e6, GRID_unit=sfu.pc, power=0.5, NRand=20000, prop_min=None, #function arguments marker = 'o', s = 3, cmap = 'nipy_spectral_r', edgecolors = 'none', vmin = 1.0, vmax = None, norm = colors.LogNorm()) #Scatter kwargs cbar = plt.colorbar(sp) cbar.ax.set_ylabel(r'$\rm n_{H_2} [\rm cm^{-3}]$') ax.set_xlabel('X (pc)') ax.set_ylabel('Y') ax.set_zlabel('Z') plt.savefig('3Dpoints_snap.png')#, dpi=200) plt.show()
#-------------------- #Plot for TEMPERATURE #-------------------- Pm.scatter3D(GRID, density, weight, colordim = temperature, NRand = 4000, axisunit = u.au, colorscale = 'log', cmap = 'brg', colorlabel = r'${\rm log}_{10}(T$ $[K])$', output = 'global_grid_temp.png', vmin = 2) """ #****************** #3D plotting #****************** lims = np.array([-100, 100]) weight = 1.0 ax_kw = { 'projection': '3d' } #, 'xlim': lims, 'ylim': lims, 'zlim': lims, 'azim': -50, 'elev': 30} canvas3d = Pm.Canvas3d(ax_kw=ax_kw) sp = canvas3d.scatter_random( GRID, density, weight, GRID_unit=u.au, power=0, NRand=10000, prop_min=1.0, #function arguments marker='+', cmap='jet', s=3, edgecolors='none', vmin=1, norm=colors.LogNorm()) #Scatter kwargs cbar = plt.colorbar(sp)