pencil.visu =========== .. py:module:: pencil.visu .. autoapi-nested-parse:: Visualization routines. Submodules ---------- .. toctree:: :maxdepth: 1 /code/sourcePython/pencil/visu/animate_interactive/index /code/sourcePython/pencil/visu/animate_multislices/index /code/sourcePython/pencil/visu/animate_slices/index /code/sourcePython/pencil/visu/animate_slices_compareruns/index /code/sourcePython/pencil/visu/animate_slices_maketomovie/index /code/sourcePython/pencil/visu/box3d/index /code/sourcePython/pencil/visu/example_run_pv_plotter/index /code/sourcePython/pencil/visu/example_run_pv_volume_plotter/index /code/sourcePython/pencil/visu/internal/index /code/sourcePython/pencil/visu/lic/index /code/sourcePython/pencil/visu/lic_internal/index /code/sourcePython/pencil/visu/pv_plotter/index /code/sourcePython/pencil/visu/pv_plotter_utils/index /code/sourcePython/pencil/visu/pv_volume_plotter/index /code/sourcePython/pencil/visu/rvid_box/index Attributes ---------- .. autoapisummary:: pencil.visu.pc_print Functions --------- .. autoapisummary:: pencil.visu.animate_interactive pencil.visu.animate_multislices pencil.visu.animate_slices_compareruns pencil.visu.make_movie pencil.visu.animate_slices pencil.visu.lic Package Contents ---------------- .. py:data:: pc_print .. py:function:: animate_interactive(data, t=None, dim_order=(0, 1, 2), fps=10.0, title=None, x_label='x', y_label='y', font_size=24, color_bar=0, colorbar_label=None, sloppy=True, fancy=False, range_min=None, range_max=None, extent=[-1, 1, -1, 1], shade=False, azdeg=0, altdeg=65, arrows_x=None, arrows_y=None, arrows_res_x=10, arrows_res_y=10, arrows_pivot='mid', arrows_width=0.002, arrows_scale=5, arrows_color='black', plot_arrows_grid=False, movie_file=None, bitrate=1800, keep_images=False, figsize=(8, 7), dpi=300, **kwimshow) Assemble a 2D animation from a 3D array. call signature:: animate_interactive(data, t=None, dim_order=(0, 1, 2), fps=10.0, title=None, x_label='x', y_label='y', font_size=24, color_bar=0, colorbar_label=None, sloppy=True, fancy=False, range_min=None, range_max=None, extent=[-1, 1, -1, 1], shade=False, azdeg=0, altdeg=65, arrows_x=None, arrows_y=None, arrows_res_x=10, arrows_res_y=10, arrows_pivot='mid', arrows_width=0.002, arrows_scale=5, arrows_color='black', plot_arrows_grid=False, movie_file=None, bitrate=1800, keep_images=False, figsize=(8, 7), dpi=300, **kwimshow) Assemble a 2D animation from a 3D array. *data* has to be a 3D array of shape [nt, nx, ny] and who's time index has the same dimension as *t*. The time index of *data* as well as its x and y indices can be changed via *dim_order*. Keyword arguments: *dim_order*: Ordering of the dimensions in the data array (t, x, y). *fps*: Frames per second of the animation. *title*: Title of the plot. *x_label*: Label of the x-axis. *y_label*: Label of the y-axis. *font_size*: Font size of the title, x and y label. The size of the x- and y-ticks is 0.5*font_size and the colorbar ticks' font size is 0.5*font_size. *color_bar*: [ 0 | 1 ] Determines how the colorbar changes: (0 - no cahnge; 1 - adapt extreme values). *colorbar_label*: Label of the color bar. *sloppy*: [ True | False ] If True the update of the plot lags one frame behind. This speeds up the plotting. *fancy*: [ True | False ] Use fancy font style. *range_min*, *range_max*: Range of the colortable. *extent*: [ None | (left, right, bottom, top) ] Limits for the axes (domain). *shade*: [ False | True ] If True plot a shaded relief instead of the usual colormap. Note that with this option cmap has to be specified like cmap = plt.cm.hot instead of cmap = 'hot'. Shading cannot be used with the color_bar = 0 option. *azdeg*, *altdeg*: Azimuth and altitude of the light source for the shading. *arrows_x*: Data containing the x-component of the arrows. *arrows_y*: Data containing the y-component of the arrows. *arrows_res_xY*: Plot every arrows_res_xY arrow in x and y. *arrows_pivot*: [ 'tail' | 'middle' | 'tip' ] The part of the arrow that is used as pivot point. *arrows_width*: Width of the arrows. *arrows_scale*: Scaling of the arrows. *arrows_color*: Color of the arrows. *plot_arrows_grid*: [ False | True ] If 'True' the grid where the arrows are aligned to is shown. *movie_file*: [ None | string ] The movie file where the animation should be saved to. If 'None' no movie file is written. Requires 'ffmpeg' to be installed. *bitrate*: Bitrate of the movie file. Set to higher value for higher quality. *keep_images*: [ False | True ] If 'True' the images for the movie creation are not deleted. *figsize*: Size of the figure in inches. *dpi*: Dots per inch of the frame. **kwimshow: Remaining arguments are identical to those of pylab.imshow. Refer to that help. .. py:function:: animate_multislices(field=['uu1'], datadir='data/', proc=-1, extension='xz', format='native', tmin=0.0, tmax=1e+38, amin=0.0, amax=1.0, transform='plane[0]', oldfile=False, outfile='') read a list of 2D slice files, combine them, and assemble an animation. Options: field --- list of variables to slice datadir --- path to data directory proc --- an integer giving the processor to read a slice from extension --- which plane of xy,xz,yz,Xz. for 2D this should be overwritten. format --- endian. one of little, big, or native (default) tmin --- start time tmax --- end time amin --- minimum value for image scaling amax --- maximum value for image scaling transform --- insert arbitrary numerical code to combine the slices outfile --- if set, write the slice values in the text file .. py:function:: animate_slices_compareruns(field='uu1', datadir1='data/', datadir2='data/', proc=-1, extension='xz', format='native', tmin=0.0, tmax=1e+38, wait=0.0, amin=0.0, amax=1.0, transform='', oldfile=False, makemovie=False) read 2D slice files from two different runs note that the runs must have same precision and sizes Options: field --- which variable to slice datadir1 --- path to data directory of first simulation datadir2 --- path to data directory of second imulation proc --- an integer giving the processor to read a slice from extension --- which plane of xy,xz,yz,Xz. for 2D this should be overwritten. format --- endian. one of little, big, or native (default) tmin --- start time tmax --- end time amin --- minimum value for image scaling amax --- maximum value for image scaling transform --- insert arbitrary numerical code to modify the slice wait --- pause in seconds between animation slices makemovie --- assemble an animation if makemovie option is set .. py:function:: make_movie(field='uu1', datadir='data/', proc=-1, extension='xz', format='native', tmin=0.0, tmax=1e+38, amin=0.0, amax=1.0, transform='', oldfile=False, norm=None, save=None, figsize=(16, 4), fps=12) read 2D slice files and assemble an animation in a mpg movie. Quickly written from the example at http://matplotlib.sourceforge.net/faq/howto_faq.html Options: field --- which variable to slice datadir--- path to data directory proc --- an integer giving the processor to read a slice from extension --- which plane of xy,xz,yz,Xz. for 2D this should be overwritten. format --- endian. one of little, big, or native (default) tmin --- start time tmax --- end time amin --- minimum value for image scaling amax --- maximum value for image scaling transform --- insert arbitrary numerical code to modify the slice norm --- scales calar data save --- directory to save file figsize --- tuple containing the size of the figure fps --- Frames per seconds for the video .. py:function:: animate_slices(field='uu1', datadir='data/', proc=-1, extension='xz', format='native', tmin=0.0, tmax=1e+38, wait=0.0, amin=0.0, amax=1.0, transform='', oldfile=False) read 2D slice files and assemble an animation. Options: field --- which variable to slice datadir --- path to data directory proc --- an integer giving the processor to read a slice from extension --- which plane of xy,xz,yz,Xz. for 2D this should be overwritten. format --- endian. one of little, big, or native (default) tmin --- start time tmax --- end time amin --- minimum value for image scaling amax --- maximum value for image scaling transform --- insert arbitrary numerical code to modify the slice wait --- pause in seconds between animation slices .. py:function:: lic(vectorfield, filepath='.', filename='tmp', cmap='bone', kernellen=31, DPI=300, SIZE=(1024, 1024), PNG=True, EPS=False, PDF=False, FIG_BACKGROUND='white', DEBUG=True) Plotting a vector field in Line Integral Convolution style. :param vectorfield: put vectorfield here, shape is: [Nx, Ny, 2] :param filepath: where to store imapge :param filename: image name :param cmap: put colormap here :param kernellen: ??? whats this good for? :param DPI: set dpi :param size: in inches