TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
trustutils.jupyter.plot

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

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])

add

add(self, x, y, marker=..., label=..., title=..., xIndice=..., yIndice=..., **kwargs)

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

addErrorBar

addErrorBar(self, x, y, yerr=..., xerr=..., marker=..., label=..., title=..., xIndice=..., yIndice=..., **kwargs)

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

addPlot

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

Method to add a plot/subplot.

Parameters:

Name Type Description
coordonee str Adress of the file.
title str Title of the plot.

addPoint

addPoint(self, data, marker=..., compo=..., label=..., func=..., **kwargs)

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

addResidu

addResidu(self, data, marker=..., var=..., start=..., end=..., label=..., **kwargs)

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 |


addSegment

addSegment(self, data, time=..., marker=..., label=..., compo=..., func=..., funcX=..., transpose=..., **kwargs)

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

coordonee

coordonee(self)

Method to add a data into the board.

Parameters:

None

Returns: The coordinates of the subplot.


label

label(self, x_label, y_label, **kwargs)

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

legend

legend(self, **kwargs)

Method to change labels.

Parameters:

**kwargs : option of matplotlib.pyplot.legend


scale

scale(self, xscale=..., yscale=...)

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")


visu

visu(self, xmin=..., xmax=..., ymin=..., ymax=...)

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.

Table

Class to plot a Table.

Constructor: Table(self, columns)

Constructor of the class Tableau.

Parameters:

Name Type Description
columns str Name of the columns.

addLine

addLine(self, ligne, name)

Method to add a row to the board.

Parameters:

Name Type Description
ligne list Row of the board.
name str Name of the board.

load

load(self, data, name)

Method to add a data into the board.

Parameters:

Name Type Description
data str Adress of the file
name str Name of the row.

loadPoint

loadPoint(self, data, name)

Method to add a data into the board.

Parameters:

Name Type Description
data str Adress of the file
name str Name of the row.

setTitle

setTitle(self, title)

Method to add title to the board.

Parameters:

Name Type Description
title str caption to ass.

sum

sum(self, name)

Method to sum data in a column.

Parameters:

Name Type Description
name str Name of the column.

Functions

displayImageFile

displayImageFile(image_file)

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

loadText

loadText(data, index_column=..., nb_column=..., transpose=..., dtype=..., skiprows=..., **kwargs)

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.


read_csv

read_csv(data, **kwargs)

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