trustutils.visitutils¶
trustutils.visitutils.tools_for_visit¶
Victor Banon Garcia & Morad Ben Tayeb CEA Saclay - DM2S/STMF/LGLS Mars 2021 - Stage 6 mois
We provide here a python package that can be used to execute visit commands from python script. This package can be used with jupyter and stats package.
- class trustutils.visitutils.tools_for_visit.Show(filename='', plottype='', name='', nX=1, nY=1, plotmesh=True, iteration=-1, empty=False, size=10, title='', subtitle='', max=None, min=None, active=True, visitLog=False, verbose=0, show=True)¶
Bases:
objectClass Show, which allow to use visit command in a python environment If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.
- add(filename, plottype, name, xIndice=0, yIndice=0, iteration=-1, title='', plotmesh=True, max=None, min=None)¶
Add a plot.
- Parameters:
filename (str) – The .lata file we want to plot its mesh with visit.
plottype (str) – The plottype we want (Pseudocolor, vector, …)
name (str) – The name of the field associated to its localization and mesh such as in VisIt.
xIndice (int) – Indice of the x axe.
yIndice (int) – Indice of the y axe.
plotmesh (bool) – If true plot the mesh asociate with .lata file.
iteration (int) – Time frame or iteration of the plot.
size (int) – Size of the image.
max (float) – Maximum value ploted.
min (float) – Minimum value ploted.
- addField(filename=None, plottype=None, name=None, plotmesh=True, min=None, max=None)¶
Method for adding a Field to a plot.
- Parameters:
filename (str) – The .lata file we want to plot its mesh with visit.
plottype (str) – The plottype we want (Pseudocolor, vector, …)
name (str) – The name of the field.
plotmesh (bool) – If true plot the mesh asociate with .lata file (default=True)
min (float) – Minimum value ploted.
max (float) – Maximum value ploted.
- addMesh(mesh)¶
Add another mesh to the Visit Plot.
- Parameters:
mesh (str) – name of the mesh
- addPlot(coordinates, title='')¶
Methode pour afficher un graphiques.
- Parameters:
coordinates (array int) – Coordinates of plot
title (str) – title of the plot.
- blackVector()¶
The vector (variable) is plotted in black
- change(nom, atribut)¶
Change argument value.
- Parameters:
nom (str) – Name of the argument..
atribut (str/int/float) – The new value of the argument.
- checkProbe(sonFile, sizePoint=10, color='black')¶
Method used to plot the probes.
- Parameters:
son (str) – adress of the son file (probe).
sizePoint (float) – size of the point
color – color of the point
- coordinates()¶
Return plot coordinates.
- Returns:
coordonne – Coordinates
- Return type:
array int
- executeVisitCmds()¶
Display the visit plot in Jupyter.
- insert()¶
Add a photo to the Multiple plot.
- iteration(iteration=0)¶
Increase the time step.
- Parameters:
iteration (int) – choice of the time frame or iteration
- lineout(a, b)¶
Draw a line.
- Parameters:
a (array float) – The first point of the segment.
b (array float) – The last point of the segment.
- meshColor(color='red')¶
Change the Color of the mesh in red.
- Parameters:
color (str) – color of the mesh (“red”,”green”, “blue”, “black” available)
- meshTrans()¶
Turn transparent the mesh.
- nextIteration()¶
Advance one time step or iteration.
- normal3D(vector=[])¶
Normal to the 3D view
- Parameters:
vector (float array (3 terms)) – coordinates [nx, ny, nz]
- plot(show=True)¶
Visualize the graph. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.
- point(x, y, z=0)¶
Draw a point.
- Parameters:
x (float) – coordinates z
y (float) – coordinates z
z (float) – coordinates z
- rotation3D(angle=[])¶
Rotation of the 3D view
- Parameters:
angle (float array (3 terms)) – rotated angles
- slice(origin=[0, 0, 0], normal=[1, 0, 0], var=None, all=0, type_op='slice')¶
slice through the point origin in the direction normale.
- Parameters:
origin (float array) – coordinates of the origin point
normal (float array) – coordinates of the normale
var ("x", "y" or "z") – to impose the normal to the var axis
- up3D(coords=[])¶
Vertical vector to the 3D view
- Parameters:
coords (float array (3 terms)) – Up vector [nx, ny, nz]
- visitCommand(string)¶
Method for adding command lines to the .py file. :param string: Comand for Visit. :type string: str
- visuHistogram(lmin, lmax, numBins)¶
Option of the histogram
- Parameters:
min (float) – minimum of x range
max (float) – maximum of x range
numBins (int) – number of Bins
Results
------
- visuOptions(operator=[])¶
To apply visu Options
- Parameters:
operators (list of possible) –
no_axes: disables the plotting of the axis.
no_triad: disables the plotting of the triad
no_bounding_box: disables the plotting of the bounding box.
no_databaseinfo: disables the plotting of the info about the database.
no_legend: disables the plotting of the legend.
Results
------
- zoom2D(coords=[])¶
Zoom on 2D plot
- Parameters:
coords (float array (4 terms)) – values of x_min, x_max, y_min, y_max
- zoom3D(var=[])¶
Zoom on 3D plot
- Parameters:
var (float array (3 terms)) – Image pan px and py and scale Image zoom
- trustutils.visitutils.tools_for_visit.VisItDisabled()¶
- class trustutils.visitutils.tools_for_visit.export_lata_base(filename, plottype, name, saveFile, frame=-1)¶
Bases:
objectClass to export profile or fields from lata files.
- addPlot(plottype, name, iteration)¶
Add a new field to the plot.
- Parameters:
plottype (str) – The plot type we want (Pseudocolor, Vector, …).
name (str) – The name of the field.
iteration (int) – number of the time frame or iteration
- Return type:
None
- getDimensions()¶
Get dimensions of mesh. Warning, it has to launch visit and write the result in a file.
- getFrames()¶
CMethod for getting the Frames.
- lineout(a, b)¶
Draw a line.
- Parameters:
a (float array) – First point.
b (float array) – Second point.
- Return type:
None
- maximum(file='Max', iteration=-1)¶
Extract Max of data from a .lata file
- Parameters:
file (str) – Name of the file (concatenate with saveFile) to register the max value.
iteration (int) – number of the time frame or iteration (default=-1)
- Return type:
None
- minimum(file='Min', iteration=-1)¶
Extract Min of data from a .lata file
- Parameters:
file (str) – Name of the file (concatenate with saveFile) to register the min value.
iteration (int) – number of the time frame or iteration (default=-1)
- Return type:
None
- point(x, y, z=0)¶
Draw a point
- Parameters:
x (float) – x coordenate.
y (float) – y coordenate.
z (float) – z coordenate.
- query(start_point, end_point, num_samples=10, mode='Lineout')¶
Extract a section of data from a .lata file
- Parameters:
start_point (float array) – First point
end_point (float array) – Second point
num_samples (float array) – First point
mode (str) – Type of section
- Return type:
None
- run()¶
Run the visit command in terminal.
- save(type='Curve2D')¶
Export and saves the .curve file
- setFrame(iteration=-1)¶
To set frame in visit
- Parameters:
iteration (int) – If iteration = -1, the last frame chosen, else it select the frame in visit
- trustutils.visitutils.tools_for_visit.saveFile(file, plottype, name, iteration, active=False)¶
Save files for testing non-regression.
- Parameters:
file (str) – The .lata file we want to plot its mesh with visit.
plottype (str) – The plot type we want (Pseudocolor, Vector, …)
name (str) – The name of the field.
iteration (int) – number of the time frame or iteration
- Return type:
None
- trustutils.visitutils.tools_for_visit.setFrame(self, iteration=-1)¶
To set frame in visit
- Parameters:
iteration (int) – If iteration = -1, the last frame chosen, else it select the frame in visit.
- trustutils.visitutils.tools_for_visit.showField(filename, plottype, name, plotmesh=True, title='', iteration=-1, size=10, max=None, min=None)¶
Methods to plot a field from a .lata file. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.
- Parameters:
filename (str) – The .lata file we want to plot its mesh with visit.
plottype (str) – The plottype we want (Pseudocolor, vector, …)
name (str) – The name of the field with localisation and name of the mesh such as read in VisIt.
plotmesh (bool) – display the mesh (default=True)
title (str) – title of the plot.
iteration (int) – number of the time frame or iteration (default=-1)
size (int) – Size of the image.
max (float) – Maximum value ploted.
min (float) – Minimum value ploted.
- Return type:
a Visit plot
- trustutils.visitutils.tools_for_visit.showMesh(filename, mesh='dom')¶
Methods to plot the mesh from a .lata file. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.
- Parameters:
filename (str) – The .lata file we want to plot its mesh with visit.
mesh (str) – name of the mesh (default=”dom”)
- Return type:
a Visit plot
- trustutils.visitutils.tools_for_visit.visitTmpFile_(justFile=False)¶
Internal …