diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d8362b..d0294d0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,8 +7,13 @@ - - + + + + + + + - - - file://$PROJECT_DIR$/Sindri/Controllers/PureSubstanceController.py - 220 - - @@ -504,26 +502,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -582,16 +560,6 @@ - - - - - - - - - - @@ -763,13 +731,6 @@ - - - - - - - @@ -825,23 +786,6 @@ - - - - - - - - - - - - - - - - - @@ -909,20 +853,71 @@ - + + + + - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/Sindri/Controllers/PureSubstanceController.py b/Sindri/Controllers/PureSubstanceController.py index 1770b9d..374f59f 100644 --- a/Sindri/Controllers/PureSubstanceController.py +++ b/Sindri/Controllers/PureSubstanceController.py @@ -167,8 +167,10 @@ def genDiagrams(self): try: if self.diagramsView.le_isotherms.text().strip() != "": self.isotherms_range = [ - float(i) for i in self.diagramsView.le_isotherms.text().replace(',', ' ').split() - + float(i) + for i in self.diagramsView.le_isotherms.text() + .replace(",", " ") + .split() ] else: self.isotherms_range = [] @@ -231,7 +233,7 @@ def plotDiagrams(self): lnscale=self.diagramsView.checkBox_logscale.isChecked(), grid=self.diagramsView.checkBox_grid.isChecked(), smooth=self.diagramsView.checkBox_smooth.isChecked(), - plotisothermals=self.diagramsView.checkBox_isotherms.isChecked() + plotisothermals=self.diagramsView.checkBox_isotherms.isChecked(), ) elif choice == "TS": self.diag.plotTS( diff --git a/Sindri/Models/LiquidModel.py b/Sindri/Models/LiquidModel.py index 9ca46de..6cf6cc3 100644 --- a/Sindri/Models/LiquidModel.py +++ b/Sindri/Models/LiquidModel.py @@ -1,5 +1,6 @@ import numpy as np -from fortran.UNIFAC import getgamma as _helper_getGamma2 + +# from fortran.UNIFAC import getgamma as _helper_getGamma2 import db @@ -95,13 +96,13 @@ def __init__(self, subs_ids): # cursor.close() def getGamma(self, x, T: float): - return _helper_getGamma2( - x, T,self.amk, self.vk, self.Rk, self.Qk - ) - # x = np.atleast_1d(x) - # return _helper_getGamma( - # x, T, self.amk, self.vk, self.Rk, self.Qk + # return _helper_getGamma2( + # x, T,self.amk, self.vk, self.Rk, self.Qk # ) + # x = np.atleast_1d(x) + return _helper_getGamma( + x, T, self.n, self.m, self.amk, self.vk, self.Rk, self.Qk + ) from numba import njit diff --git a/Sindri/Views/AddAliasView.py b/Sindri/Views/AddAliasView.py index 7eedd4b..d122775 100644 --- a/Sindri/Views/AddAliasView.py +++ b/Sindri/Views/AddAliasView.py @@ -14,7 +14,6 @@ def __init__(self, controller, parent=None): self.btn_ok.clicked.connect(self.ok_clicked) self.btn_cancel.clicked.connect(self.cancel_clicked) - def ok_clicked(self): self.controller.ok_clicked() diff --git a/Sindri/Views/PureSubstanceDiagramsView.py b/Sindri/Views/PureSubstanceDiagramsView.py index e5b5ede..61dbf9f 100644 --- a/Sindri/Views/PureSubstanceDiagramsView.py +++ b/Sindri/Views/PureSubstanceDiagramsView.py @@ -5,12 +5,7 @@ class PureSubstanceDiagramsView(QtWidgets.QWidget, Ui_Form_PureSubstanceDiagrams): - def __init__( - self, - controller, - model: PureSubstanceModel, - parent=None, - ): + def __init__(self, controller, model: PureSubstanceModel, parent=None): super().__init__(parent) self.setupUi(self) diff --git a/Sindri/db_addSubstanceProperties.py b/Sindri/db_addSubstanceProperties.py index f7bb12b..9b09f0f 100644 --- a/Sindri/db_addSubstanceProperties.py +++ b/Sindri/db_addSubstanceProperties.py @@ -88,7 +88,9 @@ def __init__(self, parent=None): QtGui.QPixmap(":/images/antoine_correlation_equation.png") ) - self.tableWidget_aliases.horizontalHeader().setDefaultAlignment(QtCore.Qt.AlignLeft) + self.tableWidget_aliases.horizontalHeader().setDefaultAlignment( + QtCore.Qt.AlignLeft + ) def confirm_clicked(self): diff --git a/Sindri/db_editSubstanceProperties.py b/Sindri/db_editSubstanceProperties.py index e4e7da3..13e5dcc 100644 --- a/Sindri/db_editSubstanceProperties.py +++ b/Sindri/db_editSubstanceProperties.py @@ -224,7 +224,9 @@ def __init__(self, parent=None, hl_row=None): ) # alias - self.tableWidget_aliases.horizontalHeader().setDefaultAlignment(QtCore.Qt.AlignLeft) + self.tableWidget_aliases.horizontalHeader().setDefaultAlignment( + QtCore.Qt.AlignLeft + ) self.btn_add_alias.clicked.connect(self.addAlias) self.btn_remove_alias.clicked.connect(self.removeAlias) self.loadAliases() diff --git a/Sindri/diagrams.py b/Sindri/diagrams.py index 88e2329..3f662db 100644 --- a/Sindri/diagrams.py +++ b/Sindri/diagrams.py @@ -22,8 +22,9 @@ "S": "Entropy", } + class IsothermalPVStruct: - def __init__(self, T: List[float], V:List[float],P:List[List[float]]): + def __init__(self, T: List[float], V: List[float], P: List[List[float]]): self.T = T self.V = V self.P = P @@ -49,7 +50,7 @@ def __init__( self.compound = compound self.eosname = eosname self.eoseq = eoseq - self.isotherms :IsothermalPVStruct = isotherms + self.isotherms: IsothermalPVStruct = isotherms self.Tliq, self.Tvap = np.zeros(self.n), np.zeros(self.n) self.Pliq, self.Pvap = np.zeros(self.n), np.zeros(self.n) @@ -70,7 +71,7 @@ def __init__( self.lnscale = False self.grid = True self.smooth = True - self.plotisotherms= False + self.plotisotherms = False for i in range(self.n): self.Tliq[i], self.Tvap[i] = self.propsliq[i].T, self.propsvap[i].T @@ -102,8 +103,15 @@ def __init__( else: self.has_isotherms = False - - def plotPV(self, xunit: str, yunit: str, lnscale=True, smooth=True, grid=True, plotisothermals=False): + def plotPV( + self, + xunit: str, + yunit: str, + lnscale=True, + smooth=True, + grid=True, + plotisothermals=False, + ): self.x_letter, self.y_letter = "V", "P" self.xliq, self.yliq = self.Vliq, self.Pliq self.xvap, self.yvap = self.Vvap, self.Pvap @@ -245,16 +253,22 @@ def _plot(self): try: if self.plotisotherms and self.has_isotherms: - v = conv_unit(np.atleast_1d(self.isotherms.V), SI_dict[self.x_letter], self.xunit) + v = conv_unit( + np.atleast_1d(self.isotherms.V), SI_dict[self.x_letter], self.xunit + ) if self.lnscale: v = np.log(v) for i in range(len(self.isotherms.T)): t = self.isotherms.T[i] - p = conv_unit(np.atleast_1d(self.isotherms.P[i]), SI_dict[self.y_letter], self.yunit) + p = conv_unit( + np.atleast_1d(self.isotherms.P[i]), + SI_dict[self.y_letter], + self.yunit, + ) if self.lnscale: p = np.log(p) label = "isothermal at {:.3f} K".format(t) - ax.plot(v, p, label=label, linestyle='--') + ax.plot(v, p, label=label, linestyle="--") except Exception as e: print("Error plotting isothermal data\n{}".format(str(e))) raise @@ -320,8 +334,8 @@ def helper_P_guess(_T): tmp.append(p) PV_isotherms.append(tmp) - PV_isotherms = IsothermalPVStruct(isotherms, list(v_iso_space.tolist()), PV_isotherms) + PV_isotherms = IsothermalPVStruct( + isotherms, list(v_iso_space.tolist()), PV_isotherms + ) return (retliq, retvap, critical_point, PV_isotherms) - - diff --git a/deploy_pyinstaller.bat b/deploy_pyinstaller.bat index be90996..fb6496b 100644 --- a/deploy_pyinstaller.bat +++ b/deploy_pyinstaller.bat @@ -28,6 +28,6 @@ xcopy %innofile% %work_folder% /E REM if exist %s7z% (call %s7z% a Sindri -t"zip" Sindri & call %s7z% a Sindri.exe Sindri -sfx) -%work_folder%\Sindri_inno.iss +call %work_folder%\Sindri_inno.iss cd %current_dir% \ No newline at end of file