morganjwilliams / pyrolite

A set of tools for getting the most from your geochemical data.
https://pyrolite.readthedocs.io
Other
133 stars 37 forks source link

Add functionality for mineral normalisation/data transformation #5

Open morganjwilliams opened 6 years ago

morganjwilliams commented 6 years ago

For working with mineral data, additional functionality is needed:

morganjwilliams commented 5 years ago

92999f23ac48a00a8ddb00ad9469cf92c67dba75 adds much of this functionality.

morganjwilliams commented 5 years ago
ondrolexa commented 1 year ago

Hi Morgan, I'm trying to use pyrolite to calculate garnet end members but without success...

import numpy as np
import pandas as pd

from pyrolite.mineral.normative import endmember_decompose

comp = pd.DataFrame({"SiO2":37.244,"Al2O3":21.216,"CaO":1.285,"K2O":0.007,"TiO2":0.023,"FeO":35.964,"MnO":1.116,"MgO":3.387,"Na2O":0.017,"Y2O3":0.018}, index=[0])

endmember_decompose(comp, endmembers="garnet")

results in...

2023-08-28 13:21:04,678 pyrolite.geochem.transform - WARNING: No relevant species (['K', 'K2O', 'KT', 'K2OT']) found to aggregate.
2023-08-28 13:21:04,693 pyrolite.geochem.transform - WARNING: No relevant species (['Fe', 'Fe2O', 'FeO', 'Fe2O3', 'FeO2', 'Fe2O5', 'FeO3', 'Fe2O7', 'FeT', 'Fe2OT', 'FeOT', 'Fe2O3T', 'FeO2T', 'Fe2O5T', 'FeO3T', 'Fe2O7T']) found to aggregate.
2023-08-28 13:21:04,717 pyrolite.geochem.transform - WARNING: No relevant species (['Na', 'Na2O', 'NaT', 'Na2OT']) found to aggregate.
2023-08-28 13:21:04,722 pyrolite.geochem.transform - WARNING: No relevant species (['Y', 'Y2O', 'YO', 'Y2O3', 'YT', 'Y2OT', 'YOT', 'Y2O3T']) found to aggregate.
name  pyrope  almandine  spessartine  grossular  andradite  uvarovite  majorite  morimotoite
0       12.5       12.5         12.5       12.5       12.5       12.5      12.5         12.5

Any advise? Thanks.

morganjwilliams commented 1 year ago

@ondrolexa I'll take a look! Note that this decomposition as currently implemented is just based on optimization, so first guess is it got stuck at the beginning. Could potentially work in rules-based systems which do already exist for things which are bit more complicated like garnets.