-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3481b74
commit b48af72
Showing
7 changed files
with
625 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
kind,T,P,x1,y1 | ||
bubble,303.15,20.24,0.2385,0.9721 | ||
bubble,303.15,30.36,0.3698,0.9768 | ||
bubble,303.15,39.55,0.5063,0.9815 | ||
bubble,303.15,50.95,0.7078,0.9842 | ||
bubble,303.15,57.83,0.843,0.9855 | ||
bubble,303.15,64.68,0.941,0.9884 | ||
bubble,303.15,67.46,0.9656,0.9909 | ||
bubble,315.15,20.84,0.2168,0.956 | ||
bubble,315.15,30.4,0.3322,0.966 | ||
bubble,315.15,40.52,0.4446,0.9748 | ||
bubble,315.15,50.66,0.5809,0.9753 | ||
bubble,315.15,60.29,0.718,0.9753 | ||
bubble,315.15,69.11,0.8457,0.9764 | ||
bubble,315.15,72.89,0.8928,0.9773 | ||
bubble,315.15,75.94,0.9252,0.9777 | ||
bubble,315.15,77.5,0.9424,0.9768 | ||
bubble,315.15,78.66,0.952,0.9756 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
|
||
import pandas as pd | ||
|
||
import pathlib | ||
|
||
import pytest | ||
|
||
|
||
PATH = pathlib.Path(os.path.abspath(os.path.dirname(__file__))) | ||
DATA_PATH = PATH / "datasets" | ||
|
||
|
||
@pytest.fixture | ||
def data_path(): | ||
return DATA_PATH.joinpath | ||
|
||
|
||
@pytest.fixture | ||
def data_co2_c6_pxy(data_path): | ||
tc = [304.1, 504.0] | ||
pc = [73.75, 30.12] | ||
w = [0.4, 0.299] | ||
return pd.read_csv(data_path("co2_c6.csv")), tc, pc, w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
kind,T,P,x1,y1 | ||
bubble,303.15,20.24,0.2385,0.9721 | ||
bubble,303.15,30.36,0.3698,0.9768 | ||
bubble,303.15,39.55,0.5063,0.9815 | ||
bubble,303.15,50.95,0.7078,0.9842 | ||
bubble,303.15,57.83,0.843,0.9855 | ||
bubble,303.15,64.68,0.941,0.9884 | ||
bubble,303.15,67.46,0.9656,0.9909 | ||
bubble,315.15,20.84,0.2168,0.956 | ||
bubble,315.15,30.4,0.3322,0.966 | ||
bubble,315.15,40.52,0.4446,0.9748 | ||
bubble,315.15,50.66,0.5809,0.9753 | ||
bubble,315.15,60.29,0.718,0.9753 | ||
bubble,315.15,69.11,0.8457,0.9764 | ||
bubble,315.15,72.89,0.8928,0.9773 | ||
bubble,315.15,75.94,0.9252,0.9777 | ||
bubble,315.15,77.5,0.9424,0.9768 | ||
bubble,315.15,78.66,0.952,0.9756 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
import yaeos | ||
import yaeos.fitting | ||
import yaeos.fitting.model_setters | ||
|
||
|
||
def test_fit_co2_c6_pxy(data_co2_c6_pxy): | ||
data, tc, pc, w = data_co2_c6_pxy | ||
|
||
mr0 = yaeos.QMR(kij=[[0, 0], [0, 0]], lij=[[0, 0], [0, 0]]) | ||
model = yaeos.PengRobinson76(tc, pc, w, mixrule=mr0) | ||
|
||
fit_kij = yaeos.fitting.model_setters.fit_kij_lij | ||
args = (model, True, False) | ||
|
||
problem = yaeos.fitting.BinaryFitter( | ||
model_setter=fit_kij, model_setter_args=args, data=data | ||
) | ||
|
||
x0 = [0.0] | ||
|
||
problem.fit(x0, bounds=None) | ||
|
||
assert (abs(problem.solution.x[0] - 0.11) < 1e-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters