geometallurgy 0.4.15__tar.gz → 0.4.17__tar.gz
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.
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/PKG-INFO +1 -1
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/mc_config.yml +4 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/flowsheet/flowsheet.py +5 -3
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/flowsheet/operation.py +15 -4
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/pyproject.toml +1 -1
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/LICENSE +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/README.md +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/__init__.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/base.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/block_model.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/__init__.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/config_read.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/flowsheet_example_partition.yaml +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/flowsheet_example_simple.yaml +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/data/downloader.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/data/register.csv +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/datasets/__init__.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/datasets/datasets.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/datasets/downloader.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/datasets/register.csv +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/datasets/sample_data.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/extras.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/flowsheet/__init__.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/flowsheet/loader.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/flowsheet/stream.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/interval_sample.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/io.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/plot.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/profile.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/sample.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/__init__.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/amenability.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/block_model_converter.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/components.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/data.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/estimates.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/interp.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/interp2.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/layout.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/moisture.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/pandas.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/parallel.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/partition.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/size.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/timer.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/utils/viz.py +0 -0
- {geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/validate.py.hide +0 -0
|
@@ -264,6 +264,8 @@ class Flowsheet:
|
|
|
264
264
|
records.columns = [f"{col[0]}_{col[1]}" for col in records.columns]
|
|
265
265
|
|
|
266
266
|
result = unhealthy_data.merge(records, left_index=True, right_index=True, how='left')
|
|
267
|
+
# add stream to the index
|
|
268
|
+
result.set_index('stream', append=True, inplace=True)
|
|
267
269
|
return result
|
|
268
270
|
|
|
269
271
|
def unhealthy_node_records(self) -> pd.DataFrame:
|
|
@@ -278,9 +280,9 @@ class Flowsheet:
|
|
|
278
280
|
'mc'].is_balanced]
|
|
279
281
|
unhealthy_data: pd.DataFrame = pd.concat(
|
|
280
282
|
[self.graph.nodes[n]['mc'].unbalanced_records.assign(node=self.graph.nodes[n]['mc'].name) for n in
|
|
281
|
-
unhealthy_nodes], axis=
|
|
282
|
-
#
|
|
283
|
-
unhealthy_data = unhealthy_data
|
|
283
|
+
unhealthy_nodes], axis=0)
|
|
284
|
+
# add the node to the index
|
|
285
|
+
unhealthy_data = unhealthy_data.set_index('node', append=True)
|
|
284
286
|
|
|
285
287
|
# todo: append the streams around the node
|
|
286
288
|
|
|
@@ -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,9 +113,9 @@ class Operation:
|
|
|
102
113
|
return None
|
|
103
114
|
|
|
104
115
|
input_mass, output_mass = self.get_input_mass(), self.get_output_mass()
|
|
105
|
-
|
|
106
|
-
self._unbalanced_records = (input_mass - output_mass).loc[
|
|
107
|
-
self._is_balanced =
|
|
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)]
|
|
118
|
+
self._is_balanced = self._unbalanced_records.shape[0] == 0
|
|
108
119
|
|
|
109
120
|
@property
|
|
110
121
|
def is_balanced(self) -> Optional[bool]:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "geometallurgy"
|
|
3
3
|
packages = [{ include = "elphick/geomet" }]
|
|
4
|
-
version = "0.4.
|
|
4
|
+
version = "0.4.17"
|
|
5
5
|
description = "Tools for the geometallurgist"
|
|
6
6
|
authors = ["Greg <11791585+elphick@users.noreply.github.com>"]
|
|
7
7
|
repository = "https://github.com/elphick/geometallurgy"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/flowsheet_example_partition.yaml
RENAMED
|
File without changes
|
{geometallurgy-0.4.15 → geometallurgy-0.4.17}/elphick/geomet/config/flowsheet_example_simple.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|