Incremental Separation

This method sorts by the provided direction prior to incrementally removing and discarding the first fraction (of the remaining fractions) and recalculating the mass-composition and recovery of the portion remaining. This is equivalent to incrementally applying a perfect separation (partition) at every interval edge.

The returned data can be used to assess the amenability of a fractionated sample (in the dimension of the sample).

This concept is only applicable in a single dimension where the mass-composition (sample) object is an interval index.

The example will use a dataset that represents a sample fractionated by size.

import logging

import pandas as pd
import plotly

from elphick.mass_composition import MassComposition
from elphick.mass_composition.datasets.sample_data import size_by_assay
logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s %(levelname)s %(module)s - %(funcName)s: %(message)s',
                    datefmt='%Y-%m-%dT%H:%M:%S%z')

Create the sample

The sample is a MassComposition object

df_data: pd.DataFrame = size_by_assay()
df_data
mass_dry fe sio2 al2o3
size_retained size_passing
0.850 2.000 3.3 64.15 2.04 2.68
0.500 0.850 9.9 64.33 2.05 2.23
0.150 0.500 26.5 64.52 1.84 2.19
0.075 0.150 2.5 62.65 2.88 3.32
0.045 0.075 8.8 62.81 2.12 2.25
0.000 0.045 49.0 55.95 6.39 6.34


The size index is of the Interval type, maintaining the fractional information.

mc_size: MassComposition = MassComposition(df_data, name='Sample')
mc_size.data.to_dataframe
<bound method Dataset.to_dataframe of <xarray.Dataset> Size: 336B
Dimensions:   (size: 6)
Coordinates:
  * size      (size) object 48B [0.85, 2.0) [0.5, 0.85) ... [0.0, 0.045)
Data variables:
    mass_wet  (size) float64 48B 3.3 9.9 26.5 2.5 8.8 49.0
    mass_dry  (size) float64 48B 3.3 9.9 26.5 2.5 8.8 49.0
    H2O       (size) float64 48B 0.0 0.0 0.0 0.0 0.0 0.0
    Fe        (size) float64 48B 64.15 64.33 64.52 62.65 62.81 55.95
    SiO2      (size) float64 48B 2.04 2.05 1.84 2.88 2.12 6.39
    Al2O3     (size) float64 48B 2.68 2.23 2.19 3.32 2.25 6.34
Attributes:
    mc_name:            Sample
    mc_vars_mass:       ['mass_wet', 'mass_dry']
    mc_vars_chem:       ['Fe', 'SiO2', 'Al2O3']
    mc_vars_attrs:      []
    mc_interval_edges:  {'size': {'left': 'retained', 'right': 'passing'}}>

Incrementally Separate

Leverage the method to return the incremental perfect separation in the size dimension. Here we will “de-slime” by discarding the smallest (lowest) sizes incrementally.

results: pd.DataFrame = mc_size.ideal_incremental_separation(discard_from="lowest")
results
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
mass_wet mass_dry H2O Fe SiO2 Al2O3
size_cut-point attribute
0.850 composition 3.300 3.300 0.0 64.150000 2.040000 2.680000
0.500 composition 13.200 13.200 0.0 64.285000 2.047500 2.342500
0.150 composition 39.700 39.700 0.0 64.441864 1.908992 2.240705
0.075 composition 42.200 42.200 0.0 64.335711 1.966517 2.304645
0.045 composition 51.000 51.000 0.0 64.072451 1.993000 2.295216
0.000 composition 100.000 100.000 0.0 60.092450 4.147530 4.277160
0.850 recovery 0.033 0.033 NaN 0.035228 0.016231 0.020677
0.500 recovery 0.132 0.132 NaN 0.141209 0.065164 0.072293
0.150 recovery 0.397 0.397 NaN 0.425734 0.182728 0.207979
0.075 recovery 0.422 0.422 NaN 0.451798 0.200088 0.227385
0.045 recovery 0.510 0.510 NaN 0.543778 0.245069 0.273677
0.000 recovery 1.000 1.000 NaN 1.000000 1.000000 1.000000


Repeat the process but by discarding the coarser sizes.

results_2: pd.DataFrame = mc_size.ideal_incremental_separation(discard_from="highest")
results_2
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
mass_wet mass_dry H2O Fe SiO2 Al2O3
size_cut-point attribute
2.000 composition 100.000 100.000 0.0 60.092450 4.147530 4.277160
0.850 composition 96.700 96.700 0.0 59.953981 4.219452 4.331665
0.500 composition 86.800 86.800 0.0 59.454873 4.466889 4.571371
0.150 composition 60.300 60.300 0.0 57.228905 5.621327 5.617910
0.075 composition 57.800 57.800 0.0 56.994429 5.739896 5.717301
0.045 composition 49.000 49.000 0.0 55.950000 6.390000 6.340000
2.000 recovery 1.000 1.000 NaN 1.000000 1.000000 1.000000
0.850 recovery 0.967 0.967 NaN 0.964772 0.983769 0.979323
0.500 recovery 0.868 0.868 NaN 0.858791 0.934836 0.927707
0.150 recovery 0.603 0.603 NaN 0.574266 0.817272 0.792021
0.075 recovery 0.578 0.578 NaN 0.548202 0.799912 0.772615
0.045 recovery 0.490 0.490 NaN 0.456222 0.754931 0.726323


Plot Grade-Recovery

fig = mc_size.plot_grade_recovery(target_analyte='Fe')
fig.update_layout(height=800)
fig
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.


Discard the highest (coarsest) sizes. As expected the response differs.

fig = mc_size.plot_grade_recovery(target_analyte='Fe', discard_from="highest")
fig.update_layout(height=800)
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.


Plot Amenability

The Amenability Index (AI) will generally range between zero and one, but can in fact be legitimately negative. The closer the AI is to 1.0, the more amenable the ore is to separation of that particular gangue component relative to the target analyte. The AI is shown in the legend (in brackets).

The plot below suggests that SiO2 is marginally more amenable than Al2O3 across the spectrum of yield for this sample.

fig = mc_size.plot_amenability(target_analyte='Fe')
fig.update_layout(height=800)
# noinspection PyTypeChecker
plotly.io.show(fig)
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Discard the highest (coarsest) sizes. As expected the response differs. The Amenability indices are negative indicating a downgrade, rather than an upgrade. This demonstrates that desliming is a plausible pathway to beneficiating this sample, while “coarse scalping” is not.

fig = mc_size.plot_amenability(target_analyte='Fe', discard_from="highest")
fig.update_layout(height=800)
fig
/home/runner/work/mass-composition/mass-composition/elphick/mass_composition/mass_composition.py:1386: FutureWarning:

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.


Total running time of the script: ( 0 minutes 1.361 seconds)

Gallery generated by Sphinx-Gallery