tools.UI_Tables module

Tool for use the multiparamter equation of state of several fluids to high accuracy property calculations.

The module can use several libraries as calculation procedures:

  • The internal mEoS library

  • CoolProp

  • RefProp

The fluids availables depend of library used, for the internal library are:

All functionality are integrate in pychemqt main program, accesible in main menu Tools/MEoS. Furthermore these equations of state are available to use in process stream properties calculation.

UITables

Configuration

First at all it’s necessary configure the tool, only it’s mandatory to define the fluid to calculate, reference state and propertie shown are configurable too

Fluid

In a open project we must first define the fluid to calculate properties, Tools/MEoS/Fluid. When we have defined a fluid the name appear in this menu option.

mEos Fluid

In this dialog we can choose the EoS to use, and if there several options, the method to calculate the viscosity or thermal conductivity.

Reference

We can define the reference state for entropy and enthalpy zero point, Tools/MEoS/Reference. We can choose between any of standard reference states or define a custom.

mEos Reference

Properties

In table generation the properties to show and the order can be configured here, Tools/MEoS/Properties.

mEos Reference

The properties available depend of backend used in library.

Furthermore, for configure the library to use and several parameters for plot generation, use the options Tools/MEoS/Configure, or use the tab in main program Preferences dialog.

Usage

Table

It’s possible use a table to calculate specific properties or to calculate any serie or states, saturation, isoproperties… In all cases it’s possible configure the numeric format, convert values to other unit magnitude or export the data to csv.

Plot

There are direct access to get the usual diagram as T-s, P-h, h-s and more. This plot are generated using the default configuration, but can be edited later by right click over it. The editing option included:

  • Configure legend in plot

  • Add/Delete isolines

  • Add/Delete individual point of isolines

  • Configure line style and annotation for isolines

  • Get tabulated data of lines

The resulting plot can be saved to file as png image.

The plot support too mouse click interaction to get properties of selected point.

The procedure of plot data calculation could be very slow, specialy with native library and using high quality definition, for that reason the calculated data are saved in hard-disk to speed-up loading in next execution or other graph generation, that files in .pkl format are saved in main program configuration folder.

API reference

The module include all UI related functionality of module
  • plugin: Implement common functionality used in menu and dialog

  • Menu: QMenu to add to mainwindow mainmenu

  • Dialog: QDialog with all meos functionality

Dialogs for configuration:
  • reference.Ui_ReferenceState: Dialog to select reference state

  • reference.Ui_Properties: Dialog for select and sort shown properties in tables

  • prefMEOS.ColorMapCombo: Custom QComboBox to choose a matplotlib colormap

  • prefMEOS.Isolinea: Widget to configure isolines for mEoS

  • prefMEOS.Widget: mEoS parameter configuration dialog

  • prefMEOS.Dialog: Dialog tool for standalone use

Dialogs for fluid selection:
Library function for plugin
Plot functionality:
Table functionality:

The calculation library itself is in the lib.meos module with the compounds implemented in lib.mEoS

tools.UI_Tables.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
class tools.UI_Tables.plugin[source]

Bases: object

Common functionality to add to menu and dialog in main window

Methods

LineList(name, Preferences[, fluid])

Return a list with the values of isoline name to plot

addTable(fluidos, title)

Add table with properties to mainwindow fluidos: List with fluid instances title: Text title for window table

addTableSpecified()

Add blank table to mainwindow to calculata point data

calculatePlot(fluid)

Calculate data for plot fluid: class of meos fluid to calculate

checkProperties()

Add default properties to configuration automatic when choose fluid or reference state and properties are not defined

configure()

Direct access to configuration

plot(x, y[, xscale, yscale, z, mesh, typemesh])

Create a plot x: property for axes x y: property for axes y xscale: scale for axis x yscale: scale for axis y z: property for axis z, optional to 3D plot

plot2D()

Add a generic 2D plot to project

plot3D()

Add a generic 3D plot to project

showChooseFluid()

Show dialog to choose/view fluid

showIsoproperty()

Show dialog to define input for isoproperty table calculations

showProperties()

Show dialog to choose/sort properties to show in tables

showReference()

Show dialog to choose reference state, use for enthalpy and entropy zero state Don't implemented yet

showSaturation()

Show dialog to define input for a two-phase saturation table

_txt()[source]

Common widget names fTxt: Fluid name, dynamic by configuration refTxt: Reference state name, dynamic by configuration propTxt: Properties option name, fixed confTxt: Configure option name, fixed

_menuCalculate()[source]

QMenu for table actions

_menuPlot()[source]

QMenu for plot actions

showChooseFluid()[source]

Show dialog to choose/view fluid

showReference()[source]

Show dialog to choose reference state, use for enthalpy and entropy zero state Don’t implemented yet

checkProperties()[source]

Add default properties to configuration automatic when choose fluid or reference state and properties are not defined

showProperties()[source]

Show dialog to choose/sort properties to show in tables

configure()[source]

Direct access to configuration

showSaturation()[source]

Show dialog to define input for a two-phase saturation table

showIsoproperty()[source]

Show dialog to define input for isoproperty table calculations

addTable(fluidos, title)[source]

Add table with properties to mainwindow fluidos: List with fluid instances title: Text title for window table

addTableSpecified()[source]

Add blank table to mainwindow to calculata point data

plot2D()[source]

Add a generic 2D plot to project

plot3D()[source]

Add a generic 3D plot to project

plot(x, y, xscale=None, yscale=None, z='', mesh=False, typemesh=0)[source]

Create a plot x: property for axes x y: property for axes y xscale: scale for axis x yscale: scale for axis y z: property for axis z, optional to 3D plot

calculatePlot(fluid)[source]

Calculate data for plot fluid: class of meos fluid to calculate

static LineList(name, Preferences, fluid=None)[source]

Return a list with the values of isoline name to plot

class tools.UI_Tables.Menu(parent=None)[source]

Bases: QMenu, plugin

QMenu to import in mainwindow with all meos addon functionality

Methods

aboutToShow_menu()

Populate menu, check if fluid and reference state are defined to enable/disable calculation/plot option

__init__(parent=None)[source]
aboutToShow_menu()[source]

Populate menu, check if fluid and reference state are defined to enable/disable calculation/plot option

class tools.UI_Tables.Dialog(config=None, parent=None)[source]

Bases: QDialog, plugin

Dialog to choose fluid for meos plugins calculations

__init__(config=None, parent=None)[source]
tools.UI_Tables.chooseFluid.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
class tools.UI_Tables.chooseFluid.Ui_ChooseFluid(config=None, parent=None)[source]

Bases: QDialog

Dialog to choose fluid for meos plugins calculations

Attributes:
group

Methods

fill(compounds)

Fill list fluid compounds: List of MEoS subclasses to show

filter()

Show dialog with group compound filter

id()

Return correct id of selected fluid in mEoS.__all__ list

info()

Show info dialog for fluid

update(indice)

Update data when selected fluid change

all = True
group = None
__init__(config=None, parent=None)[source]

config: instance with project config to set initial values

id()[source]

Return correct id of selected fluid in mEoS.__all__ list

fill(compounds)[source]

Fill list fluid compounds: List of MEoS subclasses to show

filter()[source]

Show dialog with group compound filter

info()[source]

Show info dialog for fluid

update(indice)[source]

Update data when selected fluid change

class tools.UI_Tables.chooseFluid.DialogFilterFluid(showAll=True, group=None, parent=None)[source]

Bases: QDialog

Dialog for filter compounds family to show

text = {'Alkanes': 'Alkanes', 'Alkenes': 'Alkenes', 'CFCs': 'CFCs', 'Gases': 'Gases', 'Heteroatom': 'Heteroatom', 'Naphthenes': 'Naphthenes', 'Nobles': 'Noble gases', 'PseudoCompounds': 'Pseudo Compounds', 'Siloxanes': 'Siloxanes'}
classOrder = ['Nobles', 'Gases', 'Alkanes', 'Naphthenes', 'Alkenes', 'Heteroatom', 'CFCs', 'Siloxanes', 'PseudoCompounds']
__init__(showAll=True, group=None, parent=None)[source]
class tools.UI_Tables.chooseFluid.Dialog_InfoFluid(element, parent=None)[source]

Bases: QDialog

Dialog to show parameter of element with meos

Methods

fill(element)

Fill values

more()

Show parameter for transport and ancillary equations

__init__(element, parent=None)[source]

element: class of element to show info

fill(element)[source]

Fill values

more()[source]

Show parameter for transport and ancillary equations

class tools.UI_Tables.chooseFluid.Widget_MEoS_Data(eq, parent=None)[source]

Bases: QWidget

Widget to show meos data

Methods

fill(eq)

Fill widget with data of equations

__init__(eq, parent=None)[source]

eq: dict with equation parameter

fill(eq)[source]

Fill widget with data of equations

class tools.UI_Tables.chooseFluid.transportDialog(element, parent=None)[source]

Bases: QDialog

Dialog to show parameters for transport and ancillary equations

__init__(element, parent=None)[source]
class tools.UI_Tables.chooseFluid.Widget_Viscosity_Data(element, eq, parent=None)[source]

Bases: QWidget

Widget to show viscosity data

__init__(element, eq, parent=None)[source]

element: element class for code extract eq: dict with viscosity parameter

class tools.UI_Tables.chooseFluid.Widget_Conductivity_Data(element, eq, parent=None)[source]

Bases: QWidget

Widget to show thermal conductivity data

__init__(element, eq, parent=None)[source]

element: element class for code extract eq: dict with thermal conductivity parameter

tools.UI_Tables.library.getMethod(pref=None)[source]

Return the thermo method name to use

tools.UI_Tables.library.getClassFluid(method, fluid)[source]

Return the thermo class to calculate Really return the base instance to add kwargs to calculate

tools.UI_Tables.library.getLimit(fluid, conf)[source]
tools.UI_Tables.library.calcPoint(fluid, conf, **kwargs)[source]

Procedure to calculate point state and check state in P-T range of eq

tools.UI_Tables.library.get_propiedades(conf)[source]

Procedure to get the properties to show in tables Input:

conf: configparser instance with mainwindow preferences

eanOutput:

array with properties, key and units

tools.UI_Tables.library._getData(fluid, keys, phase=True, unit=None)[source]

Procedure to get values of properties in fluid Input:

fluid: fluid instance to get values keys: array with desired parameter to get phase: boolean to get the properties values for both phases unit: unidades subclass

tools.UI_Tables.library.saveProperties(fluids)[source]

Save all available properties of a list of fluids

tools.UI_Tables.plot.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
class tools.UI_Tables.plot.PlotMEoS(dim, toolbar=False, filename='', parent=None)[source]

Bases: QWidget

Plot widget to show meos plot data, add context menu options

Methods

click(event)

Update input and graph annotate when mouse click over chart

closeEvent(event)

Force save status of window at exit

contextMenuEvent(event)

Create context menu

edit()

Show edit plot dialog

editAxis()

Show edit axes dialog

grid(boolean)

Set grid visibility of plot

mouseMoveEvent(event)

Mouse move event over the plot

readFromJSON(data, parent)

Read window data from file

showFluid()

Show dialog with properties of selected fluid

table(obj)

Export plot data to table Input: obj: object (Line2D instance) to show data

writeToJSON(data)

Write instance parameter to file

changeStatusThermo

clearPointData

mouseMove

showPointData

updatePosition

icon = '/home/docs/checkouts/readthedocs.org/user_builds/pychemqt/checkouts/latest/images/button/plot.png'
mouseMove

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

__init__(dim, toolbar=False, filename='', parent=None)[source]

constructor Input:

dim: dimension of plot, | 2 | 3 toolbar: boolean to add the matplotlib toolbar filename: filename for data

showFluid()[source]

Show dialog with properties of selected fluid

mouseMoveEvent(event)[source]

Mouse move event over the plot

closeEvent(event)[source]

Force save status of window at exit

contextMenuEvent(event)[source]

Create context menu

grid(boolean)[source]

Set grid visibility of plot

edit()[source]

Show edit plot dialog

editAxis()[source]

Show edit axes dialog

table(obj)[source]

Export plot data to table Input:

obj: object (Line2D instance) to show data

_getData()[source]

Get data from file

_saveData(data)[source]

Save changes in data to file

click(event)[source]

Update input and graph annotate when mouse click over chart

showPointData(state)[source]
clearPointData()[source]
updatePosition(point)[source]
writeToJSON(data)[source]

Write instance parameter to file

classmethod readFromJSON(data, parent)[source]

Read window data from file

changeStatusThermo(conf)[source]
class tools.UI_Tables.plot.Plot2D(parent=None)[source]

Bases: QDialog

Dialog for select a special 2D plot

Methods

ejeXChanged(index)

Fill variables available in ejeY, all except the active in ejeX

__init__(parent=None)[source]
ejeXChanged(index)[source]

Fill variables available in ejeY, all except the active in ejeX

class tools.UI_Tables.plot.Plot3D(parent=None)[source]

Bases: QDialog

Dialog for configure a 3D plot

Methods

ejeXChanged(index)

Fill variables available in ejeY, all except the active in ejeX

ejeYChanged(indY)

Fill variables available in ejeZ, all except the actives in other

__init__(parent=None)[source]
ejeXChanged(index)[source]

Fill variables available in ejeY, all except the active in ejeX

ejeYChanged(indY)[source]

Fill variables available in ejeZ, all except the actives in other

class tools.UI_Tables.plot.EditPlot(plotMEoS, parent=None)[source]

Bases: QDialog

Dialog to edit plot. This dialog let user change plot properties

Methods

add()

Add a isoline to plot

changeValue(key, value)

Update plot data

remove()

Remove a line from plot

update(i)

Fill format widget with value of selected line

__init__(plotMEoS, parent=None)[source]
static _updateLabel(label, value)[source]
update(i)[source]

Fill format widget with value of selected line

changeValue(key, value)[source]

Update plot data

add()[source]

Add a isoline to plot

remove()[source]

Remove a line from plot

class tools.UI_Tables.plot.AddLine(parent=None)[source]

Bases: QDialog

Dialog to add new isoline to plot

Methods

isolineaChanged(key)

Let show only the active inputs

lineas = [('Isotherm', <class 'lib.unidades.Temperature'>, None), ('Isobar', <class 'lib.unidades.Pressure'>, None), ('Isoenthalpic', <class 'lib.unidades.Enthalpy'>, None), ('Isoentropic', <class 'lib.unidades.SpecificHeat'>, 'SpecificEntropy'), ('Isochor', <class 'lib.unidades.SpecificVolume'>, None), ('Isodensity', <class 'lib.unidades.Density'>, None), ('Isoquality', <class 'float'>, None)]
__init__(parent=None)[source]
isolineaChanged(key)[source]

Let show only the active inputs

class tools.UI_Tables.plot.EditAxis(fig=None, parent=None)[source]

Bases: QDialog

Dialog to configure axes plot properties, label, margins, scales

Methods

populate()

Fill widget with plot parameters

update(key, value)

Update plot Input: key: plot parameter key to update value: new value for key

__init__(fig=None, parent=None)[source]
populate()[source]

Fill widget with plot parameters

update(key, value)[source]

Update plot Input:

key: plot parameter key to update value: new value for key

tools.UI_Tables.plot.convertFont(qfont)[source]

Convert qt QFont class properties to FontProperties to use in matplotlib

Parameters:
qfontQFont

QFont with properties to extract

Returns:
fontFontProperties

FontProperties instance to use in any matplotlib text instance

class tools.UI_Tables.plot.AxisWidget(name, parent=None)[source]

Bases: QGroupBox

Dialog to configure axes plot properties

__init__(name, parent=None)[source]
tools.UI_Tables.plot.calcIsoline(f, conf, var, fix, vvar, vfix, ini, step, end, total, bar)[source]

Procedure to calculate isoline. In isotherm and isobar add to calculate point the saturated states in two-phases region

tools.UI_Tables.plot.calcMesh(f, conf, Ti, Pi)[source]

Calculate mesh data for a 3D plot

tools.UI_Tables.plot.get_points(Preferences)[source]

Get point number to plot lines from Preferences

tools.UI_Tables.plot.getLineFormat(Preferences, name)[source]

get matplotlib line format from preferences Preferences: configparser instance with pycheqmt preferences name: name of isoline

tools.UI_Tables.plot.plotIsoline(data, axis, title, unidad, grafico, transform, **fmt)[source]

Procedure to plot any isoline Input:

data: section of property isoline of matrix data axis: array with keys of three axis, z None in 2D plot title: key of isoline type unidad: unidades subclass with isoline unit grafico: PlotMEoS instance to plot data transform: unit transform function for use configurated units in plots fmt: any matplotlib plot kwargs

tools.UI_Tables.plot.plot2D3D(grafico, data, Preferences, x, y, z=None, mesh=False, typemesh=0)[source]

Plot procedure Parameters:

grafico: plot data: data to plot Preferences: ConfigParser instance from mainwindow preferencesChanged x: Key for x axis y: Key for y axis z: Key for z axis Optional for 3D plot

tools.UI_Tables.plot._getunitTransform(eje)[source]

Return the axis unit transform function to map data to configurated unit Parameters:

eje: list with axis property keys

class tools.UI_Tables.reference.Ui_ReferenceState(config=None, parent=None)[source]

Bases: QDialog

Dialog for select reference state

Methods

setEnabled(boolean)

Enable custom entriees

__init__(config=None, parent=None)[source]

config: instance with project config to set initial values

setEnabled(boolean)[source]

Enable custom entriees

class tools.UI_Tables.reference.Ui_Properties(config=None, parent=None)[source]

Bases: QDialog

Dialog for select and sort shown properties in tables

Methods

Down()

Change current selected row with next row

Up()

Change current selected row with previous row

buttonClicked(boton)

Actions for dialogbuttonbox functionality

comprobarBotones(fila)

Check if button are enabled or disabled

properties()

Properties list

toggleCheck(fila, columna)

Toggle check status with a doubleclick in row

_default = [1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
__init__(config=None, parent=None)[source]
toggleCheck(fila, columna)[source]

Toggle check status with a doubleclick in row

Down()[source]

Change current selected row with next row

Up()[source]

Change current selected row with previous row

buttonClicked(boton)[source]

Actions for dialogbuttonbox functionality

properties()[source]

Properties list

comprobarBotones(fila)[source]

Check if button are enabled or disabled

tools.UI_Tables.table.translate(context: str, sourceText: str, disambiguation: str = None, n: int = -1) str
tools.UI_Tables.table.createTabla(conf, title, fluidos=None, parent=None)[source]

Create TablaMEoS to add to mainwindow

Parameters:
confConfigParser

configparser instance with project configuration

titlestr

title for the table

fluidoslib.MEoS

optional array with meos instances to fill de table

parentobject

mainwindow pointer

class tools.UI_Tables.table.TablaMEoS(*args, **kwargs)[source]

Bases: Tabla

Tabla customize to show meos data, add context menu options, save and load support in project

Attributes:
Plot
Point

Methods

add(row)

Add point to a table and to saved file

calculatePoint(row, column)

Add new value to kwargs for point, and show properties if it is calculable row, column: index for modified cell in table

changeStatusThermo(conf)

Change text show in status of mainwindow

closeEvent(event)

Force project changes to save at exit

contextMenuEvent(event)

Show context menu over cell

copy([event])

Copy selected values to clipboard

delete(rows)

Delete rows from table and for saved data

exportCSV()

Export data table as a csv file

hHeaderClicked(event)

Show dialog to config format and unit

readFromJSON(data, parent)

Load data table from saved file

selectPoint()

Show selected point in table in asociated plot if exist

setData(data)

Override Tabla method to adapt functionality

setRow(row, data)

Add data to a row

setStr()

Add data as string to cell table

showFluid()

Show fluid info dialog

vHeaderClicked(position)

Show dialog to manage item in table

writeToJSON(data)

Write instance parameter to file

Plot = None
icon = '/home/docs/checkouts/readthedocs.org/user_builds/pychemqt/checkouts/latest/images/button/table.png'
Point = None
__init__(*args, **kwargs)[source]

Constructor with additional kwargs don’t recognize in Tabla keys: array with keys properties units: array of unidades subclasses orderUnit: array of index of unit magnitud to show format: array of dict with numeric format

showFluid()[source]

Show fluid info dialog

changeStatusThermo(conf)[source]

Change text show in status of mainwindow

closeEvent(event)[source]

Force project changes to save at exit

_getPlot()[source]

Return plot if it’s loaded

hHeaderClicked(event)[source]

Show dialog to config format and unit

vHeaderClicked(position)[source]

Show dialog to manage item in table

delete(rows)[source]

Delete rows from table and for saved data

add(row)[source]

Add point to a table and to saved file

selectPoint()[source]

Show selected point in table in asociated plot if exist

calculatePoint(row, column)[source]

Add new value to kwargs for point, and show properties if it is calculable row, column: index for modified cell in table

setData(data)[source]

Override Tabla method to adapt functionality

setStr()[source]

Add data as string to cell table

setRow(row, data)[source]

Add data to a row

contextMenuEvent(event)[source]

Show context menu over cell

copy(event=None)[source]

Copy selected values to clipboard

exportCSV()[source]

Export data table as a csv file

writeToJSON(data)[source]

Write instance parameter to file

classmethod readFromJSON(data, parent)[source]

Load data table from saved file

class tools.UI_Tables.table.Ui_Saturation(method=None, fluid=None, parent=None)[source]

Bases: QDialog

Dialog to define input for a two-phase saturation table calculation

Methods

updateVar(boolean)

Update input values units and text

updateVary()

Update state for option to choose for properties to change

__init__(method=None, fluid=None, parent=None)[source]
Parameters:
method: str

name of method of calculation, meos, coolprop or refprop

fluid: int

Index of fluid in list

updateVary()[source]

Update state for option to choose for properties to change

updateVar(boolean)[source]

Update input values units and text

class tools.UI_Tables.table.Ui_Isoproperty(parent=None)[source]

Bases: QDialog

Dialog to define input for isoproperty table calculations

Methods

actualizarUI(indice)

Update UI

actualizarVariable(indice)

Update UI variables

propiedades = ['Temperature', 'Pressure', 'Density', 'Volume', 'Enthalpy', 'Entropy', 'Internal Energy']
unidades = [<class 'lib.unidades.Temperature'>, <class 'lib.unidades.Pressure'>, <class 'lib.unidades.Density'>, <class 'lib.unidades.SpecificVolume'>, <class 'lib.unidades.Enthalpy'>, <class 'lib.unidades.SpecificHeat'>, <class 'lib.unidades.Enthalpy'>, <class 'float'>]
keys = ['T', 'P', 'rho', 'v', 'h', 's', 'u', 'x']
__init__(parent=None)[source]
actualizarUI(indice)[source]

Update UI

actualizarVariable(indice)[source]

Update UI variables

class tools.UI_Tables.table.AddPoint(fluid, melting=False, parent=None)[source]

Bases: QDialog

Dialog to add new point to line2D

Methods

click(button)

Manage mouse click event over buttonbox

fill(fluid)

Fill dialog widget with fluid properties values

reset()

Reset dialog widgets to initial clear status

update(key, value)

Update fluid instance with new parameter key with value

keys = ['T', 'P', 'x', 'rho', 'v', 'h', 's', 'u']
__init__(fluid, melting=False, parent=None)[source]

fluid: initial fluid instance melting: boolean to add melting line calculation

click(button)[source]

Manage mouse click event over buttonbox

update(key, value)[source]

Update fluid instance with new parameter key with value

fill(fluid)[source]

Fill dialog widget with fluid properties values

reset()[source]

Reset dialog widgets to initial clear status