TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
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.

Show

Class Show, which allow to use visit command in a python environment If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.

Constructor: Show(self, filename=..., plottype=..., name=..., nX=..., nY=..., plotmesh=..., meshName=..., iteration=..., empty=..., size=..., title=..., subtitle=..., max=..., min=..., active=..., visitLog=..., verbose=..., show=...)

Constructeur

Parameters:

Name Type Description
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)
meshName To force the name of the mesh if it cannot be found automatically
iteration int Time frame or iteration of the plot.
empty bool If True returns a empty plot (default=False)
size int Size of the image.
title str title of the plot.
subtitle str title of the first subplot.
max float Maximum value ploted.
min float Minimum value ploted.
show bool Show the image

Returns: None

add

add(self, filename, plottype, name, xIndice=..., yIndice=..., iteration=..., title=..., plotmesh=..., meshName=..., max=..., min=...)

Add a plot.

Parameters:

Name Type Description
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.
meshName str To force the name of the mesh if it cannot be found automatically
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

addField(self, filename=..., plottype=..., name=..., plotmesh=..., meshName=..., min=..., max=...)

Method for adding a Field to a plot.

Parameters:

Name Type Description
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)
meshName str To force the name of the mesh if it cannot be found automatically
min float Minimum value ploted.
max float Maximum value ploted.

addMesh

addMesh(self, mesh)

Add another mesh to the Visit Plot.

Parameters:

Name Type Description
mesh str name of the mesh

addPlot

addPlot(self, coordinates, title=...)

Methode pour afficher un graphiques.

Parameters:

Name Type Description
coordinates array int Coordinates of plot
title str title of the plot.

blackVector

blackVector(self)

The vector (variable) is plotted in black


change

change(self, nom, atribut)

Change argument value.

Parameters:

Name Type Description
nom str Name of the argument..
atribut str/int/float The new value of the argument.

checkProbe

checkProbe(self, sonFile, sizePoint=..., color=...)

Method used to plot the probes.

Parameters:

Name Type Description
son str adress of the son file (probe).
sizePoint float size of the point
color color of the point

coordinates

coordinates(self)

Return plot coordinates.

Returns: coordonne — array int Coordinates


executeVisitCmds

executeVisitCmds(self)

Display the visit plot in Jupyter.


getIterationTime

getIterationTime(self)

To get the time of the current iteration

Returns: int — time of the current iteration


insert

insert(self)

Add a photo to the Multiple plot.


lineout

lineout(self, a, b)

Draw a line.

Parameters:

Name Type Description
a array float The first point of the segment.
b array float The last point of the segment.

meshColor

meshColor(self, color=...)

Change the Color of the mesh in red.

Parameters:

Name Type Description
color str color of the mesh ("red","green", "blue", "black" available)

meshTrans

meshTrans(self)

Turn transparent the mesh.


nextIteration

nextIteration(self)

Advance one time step or iteration.


normal3D

normal3D(self, vector=...)

Normal to the 3D view

Parameters:

Name Type Description
vector float array (3 terms) coordinates [nx, ny, nz]

plot

plot(self, show=...)

Visualize the graph. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.


point

point(self, x, y, z=...)

Does nothing, must not be used. (but should draw a point one day)

Parameters:

Name Type Description
x float coordinates z
y float coordinates z
z float coordinates z

rotation3D

rotation3D(self, angle=...)

Rotation of the 3D view

Parameters:

Name Type Description
angle float array (3 terms) rotated angles

setIteration

setIteration(self, iteration=...)

To set frame in visit

Parameters:

Name Type Description
iteration int If iteration = -1, the last frame chosen, else it select the frame in visit

slice

slice(self, origin=..., normal=..., var=..., all=..., type_op=...)

slice through the point origin in the direction normale.

Parameters:

Name Type Description
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
all int An optional integer argument that tells the function to apply the operator attributes to all plots containing the specified operator if the value of the argument is non-zero.
type_op string 'slice' for normal behavior or 'slice2d' for 2d projection (uses SetProject2d(1) from visit)

up3D

up3D(self, coords=...)

Vertical vector to the 3D view

Parameters:

Name Type Description
coords float array (3 terms) Up vector [nx, ny, nz]

visitCommand

visitCommand(self, string)

Method for adding command lines to the .py file.

Parameters:

Name Type Description
string str Comand for Visit.

visuHistogram

visuHistogram(self, lmin, lmax, numBins)

Option of the histogram

Parameters:

Name Type Description
min float minimum of x range
max float maximum of x range
numBins int number of Bins Results ---—

visuOptions

visuOptions(self, operator=...)

To apply visu Options

Parameters:

Name Type Description
list of possible operators - 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

zoom2D(self, coords=...)

Zoom on 2D plot

Parameters:

Name Type Description
coords float array (4 terms) values of x_min, x_max, y_min, y_max

zoom3D

zoom3D(self, var=...)

Zoom on 3D plot

Parameters:

Name Type Description
var float array (3 terms) Image pan px and py and scale Image zoom

export_lata_base

Class to export profile or fields from lata files.

Constructor: export_lata_base(self, filename, plottype, name, saveFile, frame=...)

Reset the class

Parameters:

Name Type Description
filename str The .lata file we want to plot its mesh with visit.
plottype str The plot type we want. For example, "Pseudocolor".
name str The name of the field.
saveFile str Path to the new (.curve, .okc, ...) file created
frame int Current frame selected.

Returns: None

addPlot

addPlot(self, plottype, name, iteration)

Add a new field to the plot.

Parameters:

Name Type Description
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

Returns: None


getDimensions

getDimensions(self)

Get dimensions of mesh. Warning, it has to launch visit and write the result in a file.


getNbIterations

getNbIterations(self)

CMethod for getting the number of frames.


lineout

lineout(self, a, b)

Draw a line.

Parameters:

Name Type Description
a float array First point.
b float array Second point.

Returns: None


maximum

maximum(self, file=..., iteration=...)

Extract Max of data from a .lata file

Parameters:

Name Type Description
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)

Returns: None


minimum

minimum(self, file=..., iteration=...)

Extract Min of data from a .lata file

Parameters:

Name Type Description
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)

Returns: None


point

point(self, x, y, z=...)

Draw a point

Parameters:

Name Type Description
x float x coordenate.
y float y coordenate.
z float z coordenate.

query

query(self, start_point, end_point, num_samples=..., mode=...)

Extract a section of data from a .lata file

Parameters:

Name Type Description
start_point float array First point
end_point float array Second point
num_samples float array First point
mode str Type of section

Returns: None


run

run(self)

Run the visit command in terminal.


save

save(self, type=...)

Export and saves the .curve file


setIteration

setIteration(self, iteration=...)

To set frame in visit

Parameters:

Name Type Description
iteration int If iteration = -1, the last frame chosen, else it select the frame in visit

Functions

VisItDisabled

VisItDisabled()

No documentation.


showField

showField(filename, plottype, name, plotmesh=..., meshName=..., title=..., iteration=..., size=..., max=..., min=...)

Methods to plot a field from a .lata file. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.

Parameters:

Name Type Description
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.
meshName str To force the name of the mesh if it cannot be found automatically
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.

Returns: a Visit plot


showMesh

showMesh(filename, mesh=...)

Methods to plot the mesh from a .lata file. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.

Parameters:

Name Type Description
filename str The .lata file we want to plot its mesh with visit.
mesh str name of the mesh (default="dom")

Returns: a Visit plot


visitTmpFile_

visitTmpFile_(justFile=...)

Internal ...