|
TRUST 1.9.8
HPC thermohydraulic platform
|
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 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 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. |
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. |
Add another mesh to the Visit Plot.
Parameters:
| Name | Type | Description |
|---|---|---|
| mesh | str | name of the mesh |
Methode pour afficher un graphiques.
Parameters:
| Name | Type | Description |
|---|---|---|
| coordinates | array int | Coordinates of plot |
| title | str | title of the plot. |
The vector (variable) is plotted in black
Change argument value.
Parameters:
| Name | Type | Description |
|---|---|---|
| nom | str | Name of the argument.. |
| atribut | str/int/float | The new value of the argument. |
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 |
Return plot coordinates.
Returns: coordonne — array int Coordinates
Display the visit plot in Jupyter.
To get the time of the current iteration
Returns: int — time of the current iteration
Add a photo to the Multiple plot.
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. |
Change the Color of the mesh in red.
Parameters:
| Name | Type | Description |
|---|---|---|
| color | str | color of the mesh ("red","green", "blue", "black" available) |
Turn transparent the mesh.
Advance one time step or iteration.
Normal to the 3D view
Parameters:
| Name | Type | Description |
|---|---|---|
| vector | float array (3 terms) | coordinates [nx, ny, nz] |
Visualize the graph. If environment variable NO_VISIT is set, VisIt plots (visu) are not generated.
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 |
Rotation of the 3D view
Parameters:
| Name | Type | Description |
|---|---|---|
| angle | float array (3 terms) | rotated angles |
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 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) |
Vertical vector to the 3D view
Parameters:
| Name | Type | Description |
|---|---|---|
| coords | float array (3 terms) | Up vector [nx, ny, nz] |
Method for adding command lines to the .py file.
Parameters:
| Name | Type | Description |
|---|---|---|
| string | str | Comand for Visit. |
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 ---— |
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 ---— |
Zoom on 2D plot
Parameters:
| Name | Type | Description |
|---|---|---|
| coords | float array (4 terms) | values of x_min, x_max, y_min, y_max |
Zoom on 3D plot
Parameters:
| Name | Type | Description |
|---|---|---|
| var | float array (3 terms) | Image pan px and py and scale Image zoom |
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
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
Get dimensions of mesh. Warning, it has to launch visit and write the result in a file.
CMethod for getting the number of frames.
Draw a line.
Parameters:
| Name | Type | Description |
|---|---|---|
| a | float array | First point. |
| b | float array | Second point. |
Returns: None
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
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
Draw a point
Parameters:
| Name | Type | Description |
|---|---|---|
| x | float | x coordenate. |
| y | float | y coordenate. |
| z | float | z coordenate. |
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 the visit command in terminal.
Export and saves the .curve file
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 |
No documentation.
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
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
Internal ...