lib.utilities module

lib.utilities.representacion(number, fmt=0, total=0, decimales=4, eng=False, tol=5, signo=False, thousand=False)[source]

Function for string representation of float values

Parameters:
numberfloat

number to transform

fmtmode

0 - fixed point 1 - Significant figures 2 - Engineering format

totalinteger

total number of digits

decimalesinteger

decimal number

engboolean

Use engineering repr for big or small number

tolinteger

Exponent limit to use engineering repr over float normal repr

signoboolean

Show sign, use to force positive sign

thousandboolean

Use thousand separator point

Returns:
reprstr

String representation

Examples

>>> import math
>>> representacion(math.pi, signo=True)
'+3.1416'
lib.utilities.colors(number, mix='', scale=False)[source]

Function to generate colors

Parameters:
number: integer

Number of required colors

mixstr

Name color for mix

scaleboolean

Define output in a scale red-blue

Returns:
rgblist

List with color hexadecimal code

lib.utilities.exportTable(matrix, fname, ext, title=None)[source]

Save data to a spreadsheet file

Parameters:
matrixlist

array with data to save

extstr

name of format to save, with supported csv | ods | xls | xlsx

titlelist, optional

list with column title

lib.utilities.spreadsheetColumn(index)[source]

Procedure to convert index column in AAA spreadsheet column namestyle

Parameters:
indexinteger

index of column start with 0

Returns:
keystr

column letter code, ej: A, C

Examples

>>> spreadsheetColumn(5)
'F'
>>> spreadsheetColumn(75)
'BX'
lib.utilities.formatLine(config, section, name)[source]

Return a matplotlib line formatting kw

Parameters:
configconfigparser.Configparser instance

configuration

sectionstr

Section name in Configparser

namestr

Line name prefix

Returns:
kwdict

matplotlib kwargs formatting dictionary

lib.utilities.SimpleEq(Tc, T, coef)[source]

Common procedure for calculation of simple properties like the ancillary equation for vapor pressure, saturated densities of liquid and vapor

The procedure define several equations:

\[\frac{x}{x_r} = 1 + \sum_i N_i\theta^{t_i}\]
\[\ln\left(\frac{x}{x_r}\right) = \sum_i N_i\theta^{t_i}\]
\[\ln\left(\frac{x}{x_r}\right) = \frac{T_c}{T}\sum_i N_i\theta^{t_i}\]
\[\theta = 1 - \frac{T}{Tc}\]

The coef must define the parameters:

  • eq: Index of equation to use

  • n: Polinomial parameter

  • t: Exponent of tita

Parameters:
Tcfloat

Critical Temperature, [K]

Tfloat

Temperature, [K]

coef: dict

Coefficient for correlation

lib.utilities.refDoc(doi, refs, tab=4)[source]

Function decorator used to automatic addiction of References section to documentation of procedures

Parameters:
doidict

Dictionary with library references

refslist

List of number to report in References section