geometallurgy 0.4.16__py3-none-any.whl → 0.4.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elphick/geomet/config/mc_config.yml +4 -0
- elphick/geomet/flowsheet/operation.py +14 -2
- {geometallurgy-0.4.16.dist-info → geometallurgy-0.4.17.dist-info}/METADATA +1 -1
- {geometallurgy-0.4.16.dist-info → geometallurgy-0.4.17.dist-info}/RECORD +7 -7
- {geometallurgy-0.4.16.dist-info → geometallurgy-0.4.17.dist-info}/LICENSE +0 -0
- {geometallurgy-0.4.16.dist-info → geometallurgy-0.4.17.dist-info}/WHEEL +0 -0
- {geometallurgy-0.4.16.dist-info → geometallurgy-0.4.17.dist-info}/entry_points.txt +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from copy import copy
|
|
2
2
|
from enum import Enum
|
|
3
3
|
from functools import reduce
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
from typing import Optional, TypeVar, TYPE_CHECKING
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
7
8
|
import pandas as pd
|
|
9
|
+
import yaml
|
|
8
10
|
|
|
9
11
|
from elphick.geomet.base import MC
|
|
10
12
|
from elphick.geomet.flowsheet.stream import Stream
|
|
@@ -25,13 +27,22 @@ class NodeType(Enum):
|
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
class Operation:
|
|
28
|
-
def __init__(self, name):
|
|
30
|
+
def __init__(self, name, config_file: Optional[Path] = None):
|
|
29
31
|
self.name = name
|
|
30
32
|
self._inputs = []
|
|
31
33
|
self._outputs = []
|
|
32
34
|
self._is_balanced: Optional[bool] = None
|
|
33
35
|
self._unbalanced_records: Optional[pd.DataFrame] = None
|
|
34
36
|
|
|
37
|
+
# Load configuration
|
|
38
|
+
if config_file is None:
|
|
39
|
+
config_file = Path(__file__).parent / '.././config/mc_config.yml'
|
|
40
|
+
|
|
41
|
+
with open(config_file, 'r') as file:
|
|
42
|
+
config = yaml.safe_load(file)
|
|
43
|
+
self.tol_abs = config['flowsheet']['operation'].get('tol_abs', 1e-6)
|
|
44
|
+
self.tol_rel = config['flowsheet']['operation'].get('tol_rel', 1e-6)
|
|
45
|
+
|
|
35
46
|
@property
|
|
36
47
|
def has_empty_input(self) -> bool:
|
|
37
48
|
return None in self.inputs
|
|
@@ -102,7 +113,8 @@ class Operation:
|
|
|
102
113
|
return None
|
|
103
114
|
|
|
104
115
|
input_mass, output_mass = self.get_input_mass(), self.get_output_mass()
|
|
105
|
-
|
|
116
|
+
mask = ~np.isclose(input_mass, output_mass, atol=self.tol_abs, rtol=self.tol_rel)
|
|
117
|
+
self._unbalanced_records = (input_mass - output_mass).loc[mask.any(axis=1)]
|
|
106
118
|
self._is_balanced = self._unbalanced_records.shape[0] == 0
|
|
107
119
|
|
|
108
120
|
@property
|
|
@@ -5,7 +5,7 @@ elphick/geomet/config/__init__.py,sha256=F94hbxN3KzSaljbElIGVhdEwX0FKmHxST4jJ7rN
|
|
|
5
5
|
elphick/geomet/config/config_read.py,sha256=frRwfRwUXpgxwMNCiBVFUw1-yPbBHs3h2KjmzXImvxY,1396
|
|
6
6
|
elphick/geomet/config/flowsheet_example_partition.yaml,sha256=85vrhOotQHhaKkYN-0QQA7ed03EMRkyaKZc-GtXMKro,716
|
|
7
7
|
elphick/geomet/config/flowsheet_example_simple.yaml,sha256=u4sM2gkyyHXnOlqW3TvwBjRdl4x34zGeZS7YGNmdfC4,428
|
|
8
|
-
elphick/geomet/config/mc_config.yml,sha256=
|
|
8
|
+
elphick/geomet/config/mc_config.yml,sha256=5sUQXOmXIcqEp_Thwj8yBoHWC_JMDSpYL_uIlEHWkbI,977
|
|
9
9
|
elphick/geomet/data/downloader.py,sha256=x_107mTNCaG9YwEO54mBx7l3KaqOavCi93uZjPdC5GU,1621
|
|
10
10
|
elphick/geomet/data/register.csv,sha256=-N3F6L0097C-I79axINi_ewFAxiqbT_SOSW3-XtPkI4,3046
|
|
11
11
|
elphick/geomet/datasets/__init__.py,sha256=7CX648YFMv39FchI1_oEF28zF52v4gX0lnqomPwkcvU,59
|
|
@@ -17,7 +17,7 @@ elphick/geomet/extras.py,sha256=UMkAYp72X-30ckaZ-2ENffUUZ7k7JBTdtgsVdgxxYAk,1164
|
|
|
17
17
|
elphick/geomet/flowsheet/__init__.py,sha256=-lxSLPZNQfiLXKZ2qqS5XbbhrZA2ABi3ppx0LaHnNEI,33
|
|
18
18
|
elphick/geomet/flowsheet/flowsheet.py,sha256=det02WllI-Bt4ILvg5MmVCEdynhobWBh5cJsubzQnD8,52085
|
|
19
19
|
elphick/geomet/flowsheet/loader.py,sha256=8nd9Vqbg1de35iuoc4mdRFxrUsIBZed0ivXIAu80jBk,4756
|
|
20
|
-
elphick/geomet/flowsheet/operation.py,sha256=
|
|
20
|
+
elphick/geomet/flowsheet/operation.py,sha256=bsT3ZZNhOXSeONjHAzSmex2CAOOWxG7tDcxmMUaFwTg,10170
|
|
21
21
|
elphick/geomet/flowsheet/stream.py,sha256=NOXcYeZLSmOSoSRFc7M36Jc8c1ARgjiCvtRuixYfuqA,1370
|
|
22
22
|
elphick/geomet/interval_sample.py,sha256=fhcWBTA01TqvCBsJv7dzWZHRBpw_4W2Ahawks5SPj28,31320
|
|
23
23
|
elphick/geomet/io.py,sha256=tZsX_getGxL07dPlF3Ozyzvt2tFHE5OdgPM5pc5xL68,15709
|
|
@@ -41,8 +41,8 @@ elphick/geomet/utils/size.py,sha256=EmV_sv2bOImQN3s7TWCniU_y83HNJEPtZH7fMMkYTcc,
|
|
|
41
41
|
elphick/geomet/utils/timer.py,sha256=8WNKLFcINRsZ3IsKtOIZ77YbKtqczyOOTEWY9h9Uxxw,3112
|
|
42
42
|
elphick/geomet/utils/viz.py,sha256=M0CnfDXBHtYb8aak1Sfz6XLvRSmkzX3ybIDllEmDR8A,1718
|
|
43
43
|
elphick/geomet/validate.py.hide,sha256=qAWJlgq0jp19UakVV0dEU_AsqV_JctUn1QTHn8cCRw0,6738
|
|
44
|
-
geometallurgy-0.4.
|
|
45
|
-
geometallurgy-0.4.
|
|
46
|
-
geometallurgy-0.4.
|
|
47
|
-
geometallurgy-0.4.
|
|
48
|
-
geometallurgy-0.4.
|
|
44
|
+
geometallurgy-0.4.17.dist-info/LICENSE,sha256=GrSVdcGtNbGvAYC_tIjLHBrIVPyg-Ksfe7ZGr087yCI,1069
|
|
45
|
+
geometallurgy-0.4.17.dist-info/METADATA,sha256=tOckk944ZdykLolkklkfOsDi9Ff0pQcdxWiLzQbZKZ4,4469
|
|
46
|
+
geometallurgy-0.4.17.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
|
|
47
|
+
geometallurgy-0.4.17.dist-info/entry_points.txt,sha256=aQI-8kmaba_c9ZGOFkJgWl0MWBke5BQLNyPSVcbS7EU,58
|
|
48
|
+
geometallurgy-0.4.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|