|
TRUST 1.9.8
HPC thermohydraulic platform
|
Victor Banon Garcia CEA Saclay - DM2S/STMF/LGLS Mars 2021 - Stage 6 mois
We provide here a python package that can be used to graph and plot TRUSt data within jupyterlab. This work is based on the files package (a TRUST package that reads the son files).
Graph is a class to plot .son file
Constructor: Graph(self, title=..., subtitle=..., nX=..., nY=..., size=..., label_size=..., title_size=..., legend_size=...)
Constructor of the class Graph.
Parameters:
| Name | Type | Description |
|---|---|---|
| title | str | title of the Graph |
| subtitle | str | title of the first subplot. |
| nX | int | number of plot in the x axe (default=1) |
| nY | int | number of plot in the Y axe (default=1) |
| size | [float,float] | Image's size (x,y) of the plot (default=[12,10]) |
Method to add a curve to the plot from a point probe.
Parameters:
| Name | Type | Description |
|---|---|---|
| x | float array | x coordinates. |
| y | float array | data to plot. |
| marker | str | symbol of the ploted line (default="-") |
| label | str | label of the curve. |
| title | str | title of the curve. |
| xIndice | int | first coordinates of the subplot list |
| yIndice | int | second coordinates of the subplot list |
| kwargs | dictionary | additional properties available in matplotlib.pyplot.plot |
Method to add a curve to the plot from a point probe.
Parameters:
| Name | Type | Description |
|---|---|---|
| x | float array | x coordinates. |
| y | float array | data to plot. |
| xerr, yerr | float or array-like, shape(N,) or shape(2, N), optional | |
| marker | str | symbol of the ploted line (default="-") |
| label | str | label of the curve. |
| title | str | title of the curve. |
| xIndice | int | first coordinates of the subplot list |
| yIndice | int | second coordinates of the subplot list |
| kwargs | dictionary | additional properties available in matplotlib.pyplot.plot |
Method to add a plot/subplot.
Parameters:
| Name | Type | Description |
|---|---|---|
| coordonee | str | Adress of the file. |
| title | str | Title of the plot. |
Method to add a curve to the plot from a point probe.
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | Adress of the file. |
| marker | str | symbol of the ploted line (default="-") |
| compo | str | component we want to plot (for vector fields) (default=0) |
| label | str | title of the curve . |
| func | function | function to apply to data before plot (ex: computation of error) |
| kwargs | dictionary | additional properties available in matplotlib.pyplot.plot |
Method to add a curve to the plot from a dt_ev file.
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | Adress of the file. |
| marker | str | symbol of the ploted line. |
| var | str | coordinate we want to plot (default="residu=max|Ri|") | | start | float | Time start. | | end | float | Time end. | | label | str | title of the curve . | | kwargs | dictionary | additional properties available in matplotlib.pyplot.plot |
Method to add a curve to the plot from a segment of probes.
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | Adress of the file. |
| time | double | time of the parameter. If None, it equals to zero. |
| marker | str | symbol of the ploted line (default="-") |
| label | str | title of the curve. |
| compo | str | component we want to plot (for vector fields) (default=0) |
| func | function Y = func(X,Y) | function to apply to data before plot (ex: computation of error) |
| funcX | function X = funcX(X) | function to apply to xcoordinates before plot |
| transpose | bool | if True, transpose axis |
| kwargs | dictionary | additional properties available in matplotlib.pyplot.plot |
Method to add a data into the board.
Parameters:
None
Returns: The coordinates of the subplot.
Method to change labels.
Parameters:
| Name | Type | Description |
|---|---|---|
| x_label | str | Label of x. |
| y_label | str | Label of y. |
| kwargs | dictionary | additional properties available in matplotlib.pyplot.subplot |
Method to change labels.
Parameters:
**kwargs : option of matplotlib.pyplot.legend
xscale : str The axis scale type to apply to the x-axis (default="linear") yscale : str The axis scale type to apply to the y-axis (default="linear")
Method to visualize all the data.
Parameters:
| Name | Type | Description |
|---|---|---|
| xmin | float | Minimun of the ploted interval of x. |
| xmax | float | Maximum of the ploted interval of x. |
| ymin | float | Minimun of the ploted interval of y. |
| ymax | float | Maximum of the ploted interval of y. |
| coordonee | — | coordinates in the subplotlist. |
Class to plot a Table.
Constructor: Table(self, columns)
Constructor of the class Tableau.
Parameters:
| Name | Type | Description |
|---|---|---|
| columns | str | Name of the columns. |
Method to add a row to the board.
Parameters:
| Name | Type | Description |
|---|---|---|
| ligne | list | Row of the board. |
| name | str | Name of the board. |
Method to add a data into the board.
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | Adress of the file |
| name | str | Name of the row. |
Method to add a data into the board.
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | Adress of the file |
| name | str | Name of the row. |
Method to add title to the board.
Parameters:
| Name | Type | Description |
|---|---|---|
| title | str | caption to ass. |
Method to sum data in a column.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | str | Name of the column. |
Method to display an image from the BUILD_DIRECTORY in the notebook
Parameters:
| Name | Type | Description |
|---|---|---|
| image_file | str | path to the image file, either absolute (must be inside BUILD_DIRECTORY) or relative to BUILD_DIRECTORY |
Method for loading files. Wraps np.loadtxt
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | name of the file we want to save. |
| index_column | int | Index of the first column (default=0) |
| nb_column | int | Number of columns loaded (default=None) |
| transpose | bool | if we transpose the matrix (default=True) |
| dtype | str | type of the data (default="float") |
| skiprows | int | initial lines skip when reading (default=0) |
| kwargs | dictionary | additional properties available in numpy.loadtxt() options |
Returns: matrix — array matrix.
Method for loading files (wrap pandas.read_csv() function).
Parameters:
| Name | Type | Description |
|---|---|---|
| data | str | name of the file we want to save. |
| comment | char, default = "#" | Character indicating that the remainder of line should not be parsed. |
| delim_whitespace | bool, default = True. Deprecated since version 2.2.0 -> Use sep="\s+" instead. | Specifies whether or not whitespace (e.g. ' ' or ' ') will be used as the sep delimiter. |
| kwargs | dictionary | additional properties available in pandas.read_csv() options |
Returns: pandas Dataframe