Iron Ore Assays

Demonstrate with some real data

import pandas as pd
import plotly
from elphick.mass_composition.datasets.sample_data import iron_ore_sample_data
from plotly.graph_objs import Figure

from elphick.mass_composition import MassComposition

Create a MassComposition object

We get some demo data in the form of a pandas DataFrame

df_data: pd.DataFrame = iron_ore_sample_data()
name = 'A072391'

print(df_data.shape)
df_data.head()
(126, 15)
mass_dry H2O MgO MnO Al2O3 P Fe SiO2 TiO2 CaO Na2O K2O DHID interval_from interval_to
index
6 2.12 0.35 0.07 0.0 1.48 0.019 64.30 3.23 0.080 0.04 0.01 0.03 CBS02 26.60 26.85
7 2.06 0.23 0.06 0.0 1.28 0.017 64.91 2.90 0.082 0.04 0.01 0.03 CBS02 26.85 27.10
9 1.91 0.23 0.06 0.0 1.01 0.016 65.09 2.39 0.059 0.03 0.01 0.02 CBS02 27.70 28.00
10 1.96 0.36 0.06 0.0 0.99 0.022 65.03 2.22 0.057 0.04 0.01 0.02 CBS02 28.00 28.30
12 2.06 0.40 0.05 0.0 0.75 0.016 65.87 1.69 0.040 0.03 0.01 0.01 CBS02 28.60 28.95


…and create a MassComposition from the DataFrame.

obj_mc: MassComposition = MassComposition(df_data, name=name)
obj_mc.aggregate(group_var='DHID')
mass_wet mass_dry H2O MgO MnO Al2O3 P Fe SiO2 TiO2 CaO Na2O K2O
DHID
CBS02 46.614043 46.310 0.652257 0.055636 0.000000 1.029685 0.022764 64.656675 2.589849 0.053834 0.029160 0.010436 0.017296
CBS03 229.414089 226.250 1.379204 0.132968 0.038134 1.399500 0.046587 60.297271 3.653106 0.052016 0.699112 0.030318 0.019871
CBS04 347.440438 344.680 0.794507 0.088788 0.126484 1.513147 0.038461 60.289083 3.319658 0.050986 0.093096 0.001773 0.011788
CBS10 306.500146 304.690 0.590586 0.044836 0.091520 1.963728 0.059062 61.001839 2.949455 0.061461 0.060045 0.014310 0.012509
CBS12 506.098042 493.968 2.396777 0.090723 0.247394 1.854824 0.032990 60.572344 2.491186 0.067683 0.045545 0.016941 0.014323
CBS13 593.551050 565.790 4.677112 0.066832 0.165065 1.969400 0.051777 59.839565 2.443914 0.072125 0.027301 0.019054 0.010321


Parallel plots

obj_mc: MassComposition = MassComposition(df_data.reset_index().set_index(['DHID', 'interval_from', 'interval_to']),
                                          name=name)

fig: Figure = obj_mc.plot_parallel(color='Fe')
fig


fig: Figure = obj_mc.plot_parallel(color='Fe', plot_interval_edges=True)
fig


# with selected variables
fig: Figure = obj_mc.plot_parallel(color='Fe', vars_include=['mass_wet', 'H2O', 'Fe', 'SiO2'])
# noinspection PyTypeChecker
plotly.io.show(fig)  # this call to show will set the thumbnail for the gallery

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

Gallery generated by Sphinx-Gallery