welltestpy.data.Variable

class Variable(name, value, symbol='x', units='-', description='no description')[source]

Bases: object

Class for a variable.

This is a class for a physical variable which is either a scalar or an array.

It has a name, a value, a symbol, a unit and a descrition string.

Parameters
  • name (str) – Name of the Variable.

  • value (int or float or numpy.ndarray) – Value of the Variable.

  • symbole (str, optional) – Name of the Variable. Default: "x"

  • units (str, optional) – Units of the Variable. Default: "-"

  • description (str, optional) – Description of the Variable. Default: "no description"

Attributes
info

str: Info about the Variable.

label

str: String containing: symbol in units.

scalar

bool: State if the variable is of scalar type.

value

int or float or numpy.ndarray: Value.

Methods

__call__([value])

Call a variable.

save([path, name])

Save a variable to file.

__call__(value=None)[source]

Call a variable.

Here you can set a new value or you can get the value of the variable.

Parameters
Returns

value – Value of the Variable.

Return type

int or float or numpy.ndarray

save(path='', name=None)[source]

Save a variable to file.

This writes the variable to a csv file.

Parameters
  • path (str, optional) – Path where the variable should be saved. Default: ""

  • name (str, optional) – Name of the file. If None, the name will be generated by "Var_"+name. Default: None

Notes

The file will get the suffix ".var".

property info

Info about the Variable.

Type

str

property label

symbol in units.

Type

str

Type

String containing

property scalar

State if the variable is of scalar type.

Type

bool

property value

Value.

Type

int or float or numpy.ndarray