geometallurgy 0.4.10__py3-none-any.whl → 0.4.11__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.
@@ -15,6 +15,7 @@ import seaborn as sns
15
15
  import yaml
16
16
  from matplotlib import pyplot as plt
17
17
  from matplotlib.colors import ListedColormap, LinearSegmentedColormap
18
+ from networkx.algorithms.dag import is_directed_acyclic_graph
18
19
  from plotly.subplots import make_subplots
19
20
 
20
21
  from elphick.geomet import Sample
@@ -306,6 +307,8 @@ class Flowsheet:
306
307
  def solve(self):
307
308
  """Solve missing streams"""
308
309
 
310
+ assert is_directed_acyclic_graph(self.graph), "Graph is not a Directed Acyclic Graph (DAG), so cannot be solved."
311
+
309
312
  # Check the number of missing mc's on edges in the network
310
313
  missing_count: int = sum([1 for u, v, d in self.graph.edges(data=True) if d['mc'] is None])
311
314
  prev_missing_count = missing_count + 1 # Initialize with a value greater than missing_count
@@ -585,6 +585,7 @@ class IntervalSample(MassComposition):
585
585
  df_upsampled: pd.DataFrame = mass_preserving_interp(self.mass_data,
586
586
  interval_edges=interval_edges, precision=precision,
587
587
  include_original_edges=include_original_edges,
588
+ mass_wet=None, mass_dry=self.mass_dry_var,
588
589
  interval_data_as_mass=True)
589
590
 
590
591
  obj: IntervalSample = IntervalSample(df_upsampled, name=self.name, moisture_in_scope=False,
@@ -9,7 +9,7 @@ from elphick.geomet.utils.pandas import composition_to_mass, mass_to_composition
9
9
 
10
10
  def mass_preserving_interp(df_intervals: pd.DataFrame, interval_edges: Union[Iterable, int],
11
11
  include_original_edges: bool = True, precision: Optional[int] = None,
12
- mass_wet: str = 'mass_wet', mass_dry: str = 'mass_dry',
12
+ mass_wet: Optional[str] = 'mass_wet', mass_dry: str = 'mass_dry',
13
13
  interval_data_as_mass: bool = False) -> pd.DataFrame:
14
14
  """Interpolate with zero mass loss using pchip
15
15
 
@@ -81,7 +81,7 @@ def mass_preserving_interp(df_intervals: pd.DataFrame, interval_edges: Union[Ite
81
81
  # if the new grid extrapolates (on the coarse side), mass will be lost, so we assume that when extrapolating.
82
82
  # the mass in the extrapolated fractions is zero. By inserting these records the spline will conform.
83
83
  x_extra = grid_vals[grid_vals > mass_cum.index.max()]
84
- if x_extra:
84
+ if len(x_extra) > 0:
85
85
  cum_max: pd.Series = mass_cum.iloc[-1, :]
86
86
  mass_cum = mass_cum.reindex(index=mass_cum.index.append(pd.Index(x_extra))) # reindex to enable insert
87
87
  mass_cum.loc[x_extra, :] = cum_max.values
@@ -180,7 +180,8 @@ def mass_preserving_interp_2d(intervals: pd.DataFrame, interval_edges: dict[str,
180
180
  # proportion the dim_1 interpolated values by the dim_2 recovery
181
181
  new_vals: pd.DataFrame = dim_2_deportment.mul(filtered_intervals_mass.loc[dim_1_interp_interval].values)
182
182
  # create a multiindex by combining the dim_1 and dim_2 intervals
183
- new_index = pd.MultiIndex.from_arrays([pd.IntervalIndex([dim_1_interp_interval] * len(new_vals)), new_vals.index])
183
+ new_index = pd.MultiIndex.from_arrays(
184
+ [pd.IntervalIndex([dim_1_interp_interval] * len(new_vals)), new_vals.index])
184
185
  new_vals.index = new_index
185
186
  chunks.append(new_vals)
186
187
 
@@ -190,4 +191,3 @@ def mass_preserving_interp_2d(intervals: pd.DataFrame, interval_edges: dict[str,
190
191
  # convert to composition
191
192
  res = mass_to_composition(res, mass_dry=mass_dry)
192
193
  return res
193
-
@@ -88,7 +88,7 @@ def composition_to_mass(df: pd.DataFrame,
88
88
  df: The pd.DataFrame containing mass. H2O if provided will be ignored. All columns other than the
89
89
  mass_wet and mass_dry are assumed to be `additive`, that is, dry mass weighting is valid.
90
90
  Assumes composition is in %w/w units.
91
- mass_wet: The wet mass column, optional. If not provided, it's assumed to be equal to mass_dry.
91
+ mass_wet: The wet mass column, optional.
92
92
  mass_dry: The dry mass column, not optional. Consider solve_mass_moisture prior to this call if needed.
93
93
  moisture_column_name: if mass_wet is provided, the resultant moisture will be returned with this column name.
94
94
  If None, and moisture is detected in the input, that column name will be used instead.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geometallurgy
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: Tools for the geometallurgist
5
5
  Home-page: https://github.com/elphick/geometallurgy
6
6
  Author: Greg
@@ -15,11 +15,11 @@ elphick/geomet/datasets/register.csv,sha256=-N3F6L0097C-I79axINi_ewFAxiqbT_SOSW3
15
15
  elphick/geomet/datasets/sample_data.py,sha256=jt5DWxdMmPbZGDuon2s8Q2wlX3cEegB0dSmRKF4pz4I,7684
16
16
  elphick/geomet/extras.py,sha256=0yDwbPMylP21EOo27juu4gUiewygSXLSjggYDrPvDcQ,1128
17
17
  elphick/geomet/flowsheet/__init__.py,sha256=-lxSLPZNQfiLXKZ2qqS5XbbhrZA2ABi3ppx0LaHnNEI,33
18
- elphick/geomet/flowsheet/flowsheet.py,sha256=ZSTXcdIo8ERRFsgDU8x1Wdh49mVDi4cIi5AY8hH8Yg8,51105
18
+ elphick/geomet/flowsheet/flowsheet.py,sha256=orMHEQx3tCFm7n3mzNczjd_0rxYcuYBZu1D9qaMRBFo,51290
19
19
  elphick/geomet/flowsheet/loader.py,sha256=8nd9Vqbg1de35iuoc4mdRFxrUsIBZed0ivXIAu80jBk,4756
20
20
  elphick/geomet/flowsheet/operation.py,sha256=f8k0-Gr_Uy2SlEp8bwAaG4yeBa3DU0HoPn9wyWhYipE,9720
21
21
  elphick/geomet/flowsheet/stream.py,sha256=RL4ZNcSm-u0MwdXp1gWq2q6FTnPs5q4xIOavs9FEDVg,1286
22
- elphick/geomet/interval_sample.py,sha256=6Cu9hN6Vnl8w3Tuzs7YP7Fv4H7-70vw-tJimJbP96Ng,31258
22
+ elphick/geomet/interval_sample.py,sha256=KBiad0MZcfdcB96OQL60cbasTu5dz2Cek4tie5Kozk0,31361
23
23
  elphick/geomet/io.py,sha256=tZsX_getGxL07dPlF3Ozyzvt2tFHE5OdgPM5pc5xL68,15709
24
24
  elphick/geomet/plot.py,sha256=e9uz8L3QZ23CW4OYm78NhdZl01i0DxHfC4r1kigz7Ss,5732
25
25
  elphick/geomet/profile.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -30,11 +30,11 @@ elphick/geomet/utils/block_model_converter.py,sha256=REYbS4cu-8z0IzCpuU9ISlPnAvx
30
30
  elphick/geomet/utils/components.py,sha256=oDR8w7aFKRP38u98yfHp-8MtOaG-c0YcGtwNjgrhGWA,3546
31
31
  elphick/geomet/utils/data.py,sha256=AnQ3JXEt2M-T5doGljM_fvdX1CvGbMr6wwjxqcw0fjs,1983
32
32
  elphick/geomet/utils/estimates.py,sha256=-x6KDQb-04IrxN8yO38Fx93F6_SGG67koagCtYBtW3c,4892
33
- elphick/geomet/utils/interp.py,sha256=VLzz1ui5j7iyYDKtJeZ8FIdArYEPipuvgW9iAquoBi0,10644
33
+ elphick/geomet/utils/interp.py,sha256=9lb2sEFfAWYzFECybLPD4nF0S85Xo37nNkxU1DG__A4,10679
34
34
  elphick/geomet/utils/interp2.py,sha256=ybuQBNTQOdVzmVYOhQDx2LkGKpl8yxgbQPz_hwS8ClQ,6633
35
35
  elphick/geomet/utils/layout.py,sha256=-c1EF-G0qGRQbLrrTS-LsbII-lnvw71y97iUBLd02do,2080
36
36
  elphick/geomet/utils/moisture.py,sha256=t9WMwADyz-QAMW-cdah1tIlzTDrhooSoKOPdIlVQHvU,2192
37
- elphick/geomet/utils/pandas.py,sha256=prMAtLlgRJaFICwbZXX7Fn4R_PbzJsVoLWsr7oYEcN8,17452
37
+ elphick/geomet/utils/pandas.py,sha256=6sKl3WUjXLR7qFmqBzuCjnfCoUsLRapwZk2nO5BfzYI,17397
38
38
  elphick/geomet/utils/parallel.py,sha256=l38JBTkCmdqKHQkS8njoA-sBN9XQGkhF59XtAhWShgs,842
39
39
  elphick/geomet/utils/partition.py,sha256=U0jFpvdvZJVdutfB6RzUzKfO9NWCGtBkeySx-QbP-l4,1534
40
40
  elphick/geomet/utils/sampling.py,sha256=qwf1ZUjsg431rpFqto_8WxLwlMCGyC5bWUlPXo-nHIM,61
@@ -42,8 +42,8 @@ elphick/geomet/utils/size.py,sha256=EmV_sv2bOImQN3s7TWCniU_y83HNJEPtZH7fMMkYTcc,
42
42
  elphick/geomet/utils/timer.py,sha256=J09nGNSkH8jdHzSmY1F3goBmycDacVe0SUMEhj7ATzw,3111
43
43
  elphick/geomet/utils/viz.py,sha256=M0CnfDXBHtYb8aak1Sfz6XLvRSmkzX3ybIDllEmDR8A,1718
44
44
  elphick/geomet/validate.py.hide,sha256=qAWJlgq0jp19UakVV0dEU_AsqV_JctUn1QTHn8cCRw0,6738
45
- geometallurgy-0.4.10.dist-info/LICENSE,sha256=GrSVdcGtNbGvAYC_tIjLHBrIVPyg-Ksfe7ZGr087yCI,1069
46
- geometallurgy-0.4.10.dist-info/METADATA,sha256=W0FwaOzfkkhGA55im6RoioV5CkvcnSxQQWKm5pL3fxE,4386
47
- geometallurgy-0.4.10.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
48
- geometallurgy-0.4.10.dist-info/entry_points.txt,sha256=aQI-8kmaba_c9ZGOFkJgWl0MWBke5BQLNyPSVcbS7EU,58
49
- geometallurgy-0.4.10.dist-info/RECORD,,
45
+ geometallurgy-0.4.11.dist-info/LICENSE,sha256=GrSVdcGtNbGvAYC_tIjLHBrIVPyg-Ksfe7ZGr087yCI,1069
46
+ geometallurgy-0.4.11.dist-info/METADATA,sha256=z0IpMOosGVEPcGgBuTIAhgL7Jxt3v718Cvb-SnhFF7Y,4386
47
+ geometallurgy-0.4.11.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
48
+ geometallurgy-0.4.11.dist-info/entry_points.txt,sha256=aQI-8kmaba_c9ZGOFkJgWl0MWBke5BQLNyPSVcbS7EU,58
49
+ geometallurgy-0.4.11.dist-info/RECORD,,