pencil.visu.rvid_box
This script contains three functions, whereas plot_box is the only function that needs to be called by the user. One can call plot_box from a Python interpreter after importing rvid_box.py. An example call: plot_box(field=’lnTT’, slice=50, datadir=<path>, unit=’temperature’). The output image will be saved to directory visu/images/.
The details of the three functions are listed as follows:
1) plot_box : the main function to plot cube objects by assembling slice_xy, slice_xy2, slice_xz and slice_yz together, it calls read_slices first then plot.
Arguments:
field — a string variable, indicating which variable to slice.
datadir — a string variable, indicating the path to the data directory.
proc — an integer giving the processor to read a slice from.
- scale — a string variable, the scale of the colorbar; default is regular scale,
can be changed to logarithmic by setting it ‘log’ (the base number is 10).
quiet — a boolean variable, print debug information.
- slice — the sequential integer number of a slice in given period (starting from 0), default is the first slice (slice 0),
can be set to ‘-1’ to generate all slices in given period.
- colorscale — a string variable, color scale for the plot. Default is ‘brbg_r’.
Plotly supports most matplotlib colormaps and you can customize a colorscale on your own. See https://plot.ly/python/colorscales/ for more information.
unit — a string variable, define the unit of the colorbar, shown on its title.
axestitle — a three-tuple indicating the title of x, y and z axis. It is ‘x’, ‘y’, ‘z’ by default.
- viewpoint — a three-tuple indicating the viewpoint of the center of the box (default is (0, 0, 0),
you can change the center in the layout of the figure in function plot()).
- imageformat — a string variable, indicating the format of the output image. Set to ‘png’ by default.
It supports png, jpeg, webp, svg and pdf format.
pcn.read.slices: read the four slices
plot: plot cube objects
Attributes
Functions
|
|
|
Module Contents
- pencil.visu.rvid_box.unwrapped
- pencil.visu.rvid_box.wrapped
- pencil.visu.rvid_box.plot(slice_obj, fields, xyzplane, itt, it, quiet=True, figdir='./images/', imageformat='png', norm='linear', colorscale='brbg_r', cmin=0, cmax=1, dtype='f', viewpoint=(-1.35, -2.1, 0.5), offset=2.0, margin=(20, 20, 30, 0), autosize=False, image_dim=(800, 500), visxyz=[True, True, True], axestitle=('x', 'y', 'z'), xyz=None, cbar_label='', cbar_loc=1.0, cbar_label_pos='right', cbar_thickness=10.0, cbar_borderwidth=None, time=0, textxy=(0, 0), str_unit='', tscale=1.0, isd=3, fontsize=25)
- Parameters:
array (xy2slices --- a numpy)
slice. (data of a xy2)
array
slice.
array
slice.
array
slice.
variable (scale --- a string) – can be changed to logarithmic by setting it ‘log’ (the base number is 10).
scale (scale of the colorbar; default is regular) – can be changed to logarithmic by setting it ‘log’ (the base number is 10).
:param : can be changed to logarithmic by setting it ‘log’ (the base number is 10). :param slice — the sequential integer number of a slice in given period: default is the first slice (slice 0), can be set to ‘-1’ to generate all slices in given period. :type slice — the sequential integer number of a slice in given period: starting from 0 :param colorscale — a string variable: Plotly supports most Matplotlib colormaps and you can customize a colorscale on your own.
See https://plot.ly/python/colorscales/ for more information.
- Parameters:
'brbg_r'. (color scale for the plot. Default is) – Plotly supports most Matplotlib colormaps and you can customize a colorscale on your own. See https://plot.ly/python/colorscales/ for more information.
variable (imageformat --- a string)
colorbar (define the unit of the)
title. (shown on its)
x (axestitle --- a three-tuple indicating the title of)
'x' (y and z axis. It is)
'y'
default. (indicating the format of the output image. Set to 'png' by)
box (viewpoint --- a three-tuple indicating the viewpoint of the center of the) – you can change the center in the layout of the figure in function plot()).
variable
slice. (which variable to)
variable
generated. (the simulation time when the data to be plotted is)
axes. (xyz --- a three-tuple indicating the value range of the three)
variable – It is set to 2 by default, meaning the xy2 slice is located below the box by half of the height of the box.
box. (the offset of xy2 slice below the) – It is set to 2 by default, meaning the xy2 slice is located below the box by half of the height of the box.
variable – It supports png, jpeg, webp, svg and pdf format.
default. – It supports png, jpeg, webp, svg and pdf format.
- pencil.visu.rvid_box.plot_box(slice_obj, fields=['uu1'], datadir='./data/', proc=-1, xyzplane=[], quiet=True, oldfile=False, tstart=0.0, tend=1e+38, islice=-1, imageformat='png', figdir='./images/', colorscale='brbg_r', norm='linear', color_range=None, color_levels=None, viewpoint=(-1.35, -2.1, 0.5), offset=2.0, margin=(20, 20, 30, 0), autosize=False, image_dim=(800, 500), visxyz=[True, True, True], axestitle=('x', 'y', 'z'), xyz=None, cbar_label='$u_x\\,[{\\rm km s}^{-1}]$', cbar_loc=1.0, cbar_label_pos='right', cbar_thickness=10.0, cbar_borderwidth=None, timestamp=False, textxy=(0, 0), tscale=1, str_unit='', isd=2, fontsize=25, unit='unit_velocity', rescale=1.0, par=list())