{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PEC Monte Carlo simulation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Start by importing MagmaPEC and MagmaPandas and any other packages you want to use. Here we also import Pandas for importing pressure data. For details on the use of MagmaPandas, please see it's [documentation](https://magmapandas.readthedocs.io/en/latest/)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import MagmaPEC as mpc\n", "import MagmaPandas as mp\n", "\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the next few steps we import all relevant data and set up the melt initial FeO prediction model. These steps are identical to the [PEC model example](https://magmapec.readthedocs.io/en/latest/notebooks/pec_corr.html#)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import melt inclusion and olivine data:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "melt_file = \"./data/melt.csv\"\n", "olivine_file = \"./data/olivine.csv\"\n", "\n", "melt = mp.read_melt(melt_file, index_col=[\"name\"])\n", "olivine = mp.read_olivine(olivine_file, index_col=[\"name\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import inclusion internal pressures or calculate them if you have measured melt CO2 (and H2O). See the [PEC model example](https://magmapec.readthedocs.io/en/latest/notebooks/pec_corr.html) for details on how to do the calculation. Here we import them from a file." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "pressure_file =\"./data/pressure.csv\"\n", "pressure = pd.read_csv(pressure_file, index_col = [\"name\"]).squeeze()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set up the melt initial FeO prediction model:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "wholerock_file = \"./data/wholerock.csv\"\n", "wholerock = mp.read_melt(wholerock_file, index_col=[\"name\"])\n", "\n", "x = wholerock.drop(columns=[\"FeO\"])\n", "FeOi_predict = mpc.FeOi_prediction(x=x, FeO=wholerock[\"FeO\"])\n", "\n", "do_not_use = [\"MnO\", \"P2O5\", \"Cr2O3\", \"total\"]\n", "\n", "model_fits = FeOi_predict.calculate_model_fits(exclude=do_not_use)\n", "FeOi_predict.select_predictors(idx=3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we need to set up the object that handles the random sampling of errors in the Monte Carlo simulation. This is done with the *PEC_MC_parameters* class and it includes the following parameters for error propagation:\n", "\n", "- **melt_errors**\n", " \n", " propagate errors on melt composition by providing one standard deviation errors per element as a pandas Series (fixed errors for all inclusions) or DataFrame (errors per inclusion).\n", "\n", "- **olivine_errors**\n", "\n", " propagate errors on olivine composition by providing one standard deviation errors per element as a pandas Series (fixed errors for all inclusions) or DataFrame (errors per inclusion).\n", "\n", "- **FeOi_errors**\n", "\n", " propagate errors on estimate melt initial FeO contents. Fixed errors can be provided either for the whole dataset, or per inclusion. Alternatively, an [FeOi_prediction object](https://magmapec.readthedocs.io/en/latest/notebooks/FeOi.html) can be provided to propagate errors on predictions models.\n", "\n", "- **Fe3Fe2**\n", "\n", " Propagate errors on modelled melt Fe2+/Fe3+ ratios. Errors are automatically calculated by MagmaPandas based on the selected model. Pass *True* to this parameter to activate it.\n", "\n", "- **Kd**\n", "\n", " Propagate errors on modelled olivine-melt Fe-Mg partition coefficients. Errors are automatically calculated by MagmaPandas based on the selected model. Pass *True* to this parameter to activate it.\n", "\n", "By default errors are not propagated - you explicitely need to tell MagmaPEC to do so when initialising the *PEC_MC_parameters* object" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example we will use all error propagation options, which means we need to provide melt and olivine composition errors. We import these from .csv files containing error data for individual inclusions and olivines. This is just an example with randomly generated errors, normally you should use analytical errors." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "melt_errors_file = \"./data/melt_errors.csv\"\n", "olivine_errors_file = \"./data/olivine_errors.csv\"\n", "\n", "melt_errors = pd.read_csv(melt_errors_file, index_col=[0])\n", "olivine_errors = pd.read_csv(olivine_errors_file, index_col=[0])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Make very sure that the elements in the error data have identical sorting to the melt and olivine dataframes, otherwise errors will be applied to the wrong elements. \n", "We can force this by sorting the columns of the error dataframes (or series) with the *elements* attributes of the melt and olivine MagmaFrames:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "melt_errors = melt_errors[melt.elements]\n", "olivine_errors = olivine_errors[olivine.elements]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here's what they look like:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SiO2Al2O3MgOCaOFeONa2OK2OMnOTiO2P2O5Cr2O3CO2H2OFSCl
PI032-04-011.020.640.140.470.690.100.080.050.180.050.050.170.210.220.100.12
PI032-04-021.060.840.290.460.540.050.030.010.060.180.040.240.120.130.120.04
PI041-02-021.040.900.090.550.490.220.210.010.160.040.000.150.230.040.170.06
PI041-03-010.980.640.100.400.530.120.120.080.010.030.000.050.360.060.140.04
PI041-03-031.020.540.310.420.680.180.030.020.110.060.100.180.080.130.060.15
\n", "
" ], "text/plain": [ " SiO2 Al2O3 MgO CaO FeO Na2O K2O MnO TiO2 P2O5 \\\n", "PI032-04-01 1.02 0.64 0.14 0.47 0.69 0.10 0.08 0.05 0.18 0.05 \n", "PI032-04-02 1.06 0.84 0.29 0.46 0.54 0.05 0.03 0.01 0.06 0.18 \n", "PI041-02-02 1.04 0.90 0.09 0.55 0.49 0.22 0.21 0.01 0.16 0.04 \n", "PI041-03-01 0.98 0.64 0.10 0.40 0.53 0.12 0.12 0.08 0.01 0.03 \n", "PI041-03-03 1.02 0.54 0.31 0.42 0.68 0.18 0.03 0.02 0.11 0.06 \n", "\n", " Cr2O3 CO2 H2O F S Cl \n", "PI032-04-01 0.05 0.17 0.21 0.22 0.10 0.12 \n", "PI032-04-02 0.04 0.24 0.12 0.13 0.12 0.04 \n", "PI041-02-02 0.00 0.15 0.23 0.04 0.17 0.06 \n", "PI041-03-01 0.00 0.05 0.36 0.06 0.14 0.04 \n", "PI041-03-03 0.10 0.18 0.08 0.13 0.06 0.15 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "melt_errors.head()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SiO2FeOMgONiOMnOAl2O3CaO
PI032-04-011.060.601.220.010.090.080.02
PI032-04-020.850.571.280.140.070.240.06
PI041-02-021.110.441.300.080.100.010.19
PI041-03-010.990.501.310.140.160.150.01
PI041-03-030.950.641.210.130.110.100.15
\n", "
" ], "text/plain": [ " SiO2 FeO MgO NiO MnO Al2O3 CaO\n", "PI032-04-01 1.06 0.60 1.22 0.01 0.09 0.08 0.02\n", "PI032-04-02 0.85 0.57 1.28 0.14 0.07 0.24 0.06\n", "PI041-02-02 1.11 0.44 1.30 0.08 0.10 0.01 0.19\n", "PI041-03-01 0.99 0.50 1.31 0.14 0.16 0.15 0.01\n", "PI041-03-03 0.95 0.64 1.21 0.13 0.11 0.10 0.15" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "olivine_errors.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Together with the *FeOi_prediction* object, we pass these as arguments to the *PEC_MC_parameters* object. We also set *Fe3Fe2* and *Kd* to *True* in order to propagate their model errors." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "mc_parameters = mpc.PEC_MC_parameters(melt_errors=melt_errors, olivine_errors=olivine_errors, FeOi_errors=FeOi_predict, Fe3Fe2=True, Kd=True, temperature=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can create the Monte Carlo model with the *PEC_MC* object" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "pec_mc_model = mpc.PEC_MC(inclusions=melt, olivines=olivine, P_bar=pressure, FeO_target=FeOi_predict, MC_parameters=mc_parameters)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And finally run the Monte Carlo simulation with *n* iterations. To get representative errors, a minimum of 50 iterations is recommended." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Monte Carlo loop\n", "050/050\n", "Equilibrating ... |██████████████████████████████| 100% [10/10] in 2.2s \n", "Correcting ... |██████████████████████████████| 100% [10/10] in 13.4s \n" ] } ], "source": [ "pec_mc_model.run(n=50)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Results are stored internally in the following attributes:\n", "\n", "- **pec**: pandas DataFrame\n", "\n", " Average PEC extents (%) of the MC model and their one standard deviation errors.\n", "\n", "- **inclusions_corr**: MagmaPandas Melt frame\n", "\n", " Averages of corrected melt inclusion compositions (wt. %)\n", "\n", "- **inclusions_stddev**: pandas DataFrame\n", "\n", " One standard deviation errors on inclusions_corr (wt. %)\n", "\n", "- **pec_MC**: pandas DataFrame\n", "\n", " PEC extents for individual iterations\n", "\n", "- **inclusions_MC**: dictionary of MagmaPandas Melt frames\n", "\n", " corrected melt inclusion compositions for individual iterations." ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "pec = pec_mc_model.pec\n", "inclusions_corrected = pec_mc_model.inclusions_corr\n", "inclusions_errors = pec_mc_model.inclusions_stddev\n", "\n", "pec_mc = pec_mc_model.pec_MC\n", "inclusions_MC = pec_mc_model.inclusions_MC" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
pecstddev
name
PI032-04-019.5966994.571030
PI032-04-0210.5711024.999259
PI041-02-020.0296763.332411
PI041-03-0112.1220175.592136
PI041-03-0312.3509345.439491
PI041-05-04-4.3245842.935303
PI041-05-061.7612583.100318
PI041-07-0111.7551844.999059
PI041-07-0210.5480424.990837
PI052-01-02-8.1530842.932983
\n", "
" ], "text/plain": [ " pec stddev\n", "name \n", "PI032-04-01 9.596699 4.571030\n", "PI032-04-02 10.571102 4.999259\n", "PI041-02-02 0.029676 3.332411\n", "PI041-03-01 12.122017 5.592136\n", "PI041-03-03 12.350934 5.439491\n", "PI041-05-04 -4.324584 2.935303\n", "PI041-05-06 1.761258 3.100318\n", "PI041-07-01 11.755184 4.999059\n", "PI041-07-02 10.548042 4.990837\n", "PI052-01-02 -8.153084 2.932983" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pec" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SiO2Al2O3MgOCaOFeONa2OK2OMnOTiO2P2O5Cr2O3CO2H2OFSCl
name
PI032-04-0149.03818513.9658317.5483749.71205010.2705873.5876900.6796580.1317312.4502700.2829720.000000.6011381.3858410.1385700.1471490.059956
PI032-04-0248.55446714.6597047.4773629.37195410.3524093.4584430.9094020.1357732.5742480.3182820.000000.5914181.3037310.0865110.1660560.040240
PI041-02-0249.19484416.8699464.7457809.21952110.2094813.8158801.0815260.1504592.7959360.5658360.000000.4698720.6688200.0596030.1163370.036158
PI041-03-0145.88767415.7780306.99327411.02145310.6869713.3488191.1409170.1101423.1610590.5550120.000000.7946860.2815670.0865930.0987870.055019
PI041-03-0345.36827215.8831197.00686911.18075310.7605093.4101141.1667750.0858193.2459160.5004280.000000.8077920.3028710.1127840.0936460.074334
PI041-05-0447.90543418.7584683.5549049.5225329.3194794.6396021.6199160.1306692.5068530.8304470.000000.4886030.4485690.0908820.1242180.059425
PI041-05-0646.43951616.9342604.5588209.11568411.5235883.9928811.4680840.1717943.6828090.6309960.000000.6455020.5291450.1136110.1278810.065430
PI041-07-0145.78286915.4665127.0940719.64160611.5207743.1305501.2733280.1468893.5183250.5584880.000000.4659741.0358650.0998080.1701160.094825
PI041-07-0245.85131815.5774266.67589610.24831411.4466013.2403301.3804810.1399953.5597690.6195970.000000.3937790.6001010.0741410.1351760.057076
PI052-01-0249.17397717.1289003.79043910.4849618.4172584.9374961.5541450.2352621.7475720.7163710.076230.2887861.0883260.1690990.1329970.058181
\n", "
" ], "text/plain": [ " SiO2 Al2O3 MgO CaO FeO Na2O \\\n", "name \n", "PI032-04-01 49.038185 13.965831 7.548374 9.712050 10.270587 3.587690 \n", "PI032-04-02 48.554467 14.659704 7.477362 9.371954 10.352409 3.458443 \n", "PI041-02-02 49.194844 16.869946 4.745780 9.219521 10.209481 3.815880 \n", "PI041-03-01 45.887674 15.778030 6.993274 11.021453 10.686971 3.348819 \n", "PI041-03-03 45.368272 15.883119 7.006869 11.180753 10.760509 3.410114 \n", "PI041-05-04 47.905434 18.758468 3.554904 9.522532 9.319479 4.639602 \n", "PI041-05-06 46.439516 16.934260 4.558820 9.115684 11.523588 3.992881 \n", "PI041-07-01 45.782869 15.466512 7.094071 9.641606 11.520774 3.130550 \n", "PI041-07-02 45.851318 15.577426 6.675896 10.248314 11.446601 3.240330 \n", "PI052-01-02 49.173977 17.128900 3.790439 10.484961 8.417258 4.937496 \n", "\n", " K2O MnO TiO2 P2O5 Cr2O3 CO2 \\\n", "name \n", "PI032-04-01 0.679658 0.131731 2.450270 0.282972 0.00000 0.601138 \n", "PI032-04-02 0.909402 0.135773 2.574248 0.318282 0.00000 0.591418 \n", "PI041-02-02 1.081526 0.150459 2.795936 0.565836 0.00000 0.469872 \n", "PI041-03-01 1.140917 0.110142 3.161059 0.555012 0.00000 0.794686 \n", "PI041-03-03 1.166775 0.085819 3.245916 0.500428 0.00000 0.807792 \n", "PI041-05-04 1.619916 0.130669 2.506853 0.830447 0.00000 0.488603 \n", "PI041-05-06 1.468084 0.171794 3.682809 0.630996 0.00000 0.645502 \n", "PI041-07-01 1.273328 0.146889 3.518325 0.558488 0.00000 0.465974 \n", "PI041-07-02 1.380481 0.139995 3.559769 0.619597 0.00000 0.393779 \n", "PI052-01-02 1.554145 0.235262 1.747572 0.716371 0.07623 0.288786 \n", "\n", " H2O F S Cl \n", "name \n", "PI032-04-01 1.385841 0.138570 0.147149 0.059956 \n", "PI032-04-02 1.303731 0.086511 0.166056 0.040240 \n", "PI041-02-02 0.668820 0.059603 0.116337 0.036158 \n", "PI041-03-01 0.281567 0.086593 0.098787 0.055019 \n", "PI041-03-03 0.302871 0.112784 0.093646 0.074334 \n", "PI041-05-04 0.448569 0.090882 0.124218 0.059425 \n", "PI041-05-06 0.529145 0.113611 0.127881 0.065430 \n", "PI041-07-01 1.035865 0.099808 0.170116 0.094825 \n", "PI041-07-02 0.600101 0.074141 0.135176 0.057076 \n", "PI052-01-02 1.088326 0.169099 0.132997 0.058181 " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "inclusions_corrected" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SiO2_stddevAl2O3_stddevMgO_stddevCaO_stddevFeO_stddevNa2O_stddevK2O_stddevMnO_stddevTiO2_stddevP2O5_stddevCr2O3_stddevCO2_stddevH2O_stddevF_stddevS_stddevCl_stddev
name
PI032-04-010.6841400.7672291.4295790.5288470.3186060.1957410.0822480.0462260.1691120.0572550.0000000.1508420.2031300.1309840.0776340.068188
PI032-04-020.6750871.0203841.4297340.5188000.2776150.1476780.0446180.0140490.1062980.1358020.0000000.2043670.1371610.0931340.0853420.033133
PI041-02-020.9217951.0782721.0855520.5739990.3784200.2140540.1777470.0159820.1365630.0489910.0000000.1481340.2779510.0342260.1132980.035241
PI041-03-010.6831580.9123161.7363490.6491940.1599930.1966580.1203080.0628010.1402060.0401010.0000000.0618390.2286350.0455630.0984350.036972
PI041-03-030.6216320.7893951.6028010.5465560.2153480.1989450.0648440.0215290.1516840.0684540.0000000.1341190.0704330.1108460.0526020.088702
PI041-05-040.7678730.9785180.8986870.4184290.3433350.2534670.1277150.1265360.0938000.0342760.0000000.2497200.1674240.0961600.0101950.009643
PI041-05-060.8592920.9864020.9754610.4328610.3998220.3756940.2133020.1854240.1979410.0439420.0000000.2173300.2361470.0871900.0596500.030361
PI041-07-010.5779251.0789461.4089470.5049970.2485940.1367890.0453720.0750740.1432280.0262590.0000000.0561720.1855720.0969990.0270730.091682
PI041-07-020.5358060.9577691.5284390.5517890.2278770.1662530.1473850.0590760.1380050.0259770.0000000.1660850.1742100.0027450.0452420.063498
PI052-01-020.9066490.8889550.8778430.4354150.4023620.1342630.0731660.0245050.0979820.2288030.0971020.0080380.1513100.1626270.0602600.017870
\n", "
" ], "text/plain": [ " SiO2_stddev Al2O3_stddev MgO_stddev CaO_stddev FeO_stddev \\\n", "name \n", "PI032-04-01 0.684140 0.767229 1.429579 0.528847 0.318606 \n", "PI032-04-02 0.675087 1.020384 1.429734 0.518800 0.277615 \n", "PI041-02-02 0.921795 1.078272 1.085552 0.573999 0.378420 \n", "PI041-03-01 0.683158 0.912316 1.736349 0.649194 0.159993 \n", "PI041-03-03 0.621632 0.789395 1.602801 0.546556 0.215348 \n", "PI041-05-04 0.767873 0.978518 0.898687 0.418429 0.343335 \n", "PI041-05-06 0.859292 0.986402 0.975461 0.432861 0.399822 \n", "PI041-07-01 0.577925 1.078946 1.408947 0.504997 0.248594 \n", "PI041-07-02 0.535806 0.957769 1.528439 0.551789 0.227877 \n", "PI052-01-02 0.906649 0.888955 0.877843 0.435415 0.402362 \n", "\n", " Na2O_stddev K2O_stddev MnO_stddev TiO2_stddev P2O5_stddev \\\n", "name \n", "PI032-04-01 0.195741 0.082248 0.046226 0.169112 0.057255 \n", "PI032-04-02 0.147678 0.044618 0.014049 0.106298 0.135802 \n", "PI041-02-02 0.214054 0.177747 0.015982 0.136563 0.048991 \n", "PI041-03-01 0.196658 0.120308 0.062801 0.140206 0.040101 \n", "PI041-03-03 0.198945 0.064844 0.021529 0.151684 0.068454 \n", "PI041-05-04 0.253467 0.127715 0.126536 0.093800 0.034276 \n", "PI041-05-06 0.375694 0.213302 0.185424 0.197941 0.043942 \n", "PI041-07-01 0.136789 0.045372 0.075074 0.143228 0.026259 \n", "PI041-07-02 0.166253 0.147385 0.059076 0.138005 0.025977 \n", "PI052-01-02 0.134263 0.073166 0.024505 0.097982 0.228803 \n", "\n", " Cr2O3_stddev CO2_stddev H2O_stddev F_stddev S_stddev \\\n", "name \n", "PI032-04-01 0.000000 0.150842 0.203130 0.130984 0.077634 \n", "PI032-04-02 0.000000 0.204367 0.137161 0.093134 0.085342 \n", "PI041-02-02 0.000000 0.148134 0.277951 0.034226 0.113298 \n", "PI041-03-01 0.000000 0.061839 0.228635 0.045563 0.098435 \n", "PI041-03-03 0.000000 0.134119 0.070433 0.110846 0.052602 \n", "PI041-05-04 0.000000 0.249720 0.167424 0.096160 0.010195 \n", "PI041-05-06 0.000000 0.217330 0.236147 0.087190 0.059650 \n", "PI041-07-01 0.000000 0.056172 0.185572 0.096999 0.027073 \n", "PI041-07-02 0.000000 0.166085 0.174210 0.002745 0.045242 \n", "PI052-01-02 0.097102 0.008038 0.151310 0.162627 0.060260 \n", "\n", " Cl_stddev \n", "name \n", "PI032-04-01 0.068188 \n", "PI032-04-02 0.033133 \n", "PI041-02-02 0.035241 \n", "PI041-03-01 0.036972 \n", "PI041-03-03 0.088702 \n", "PI041-05-04 0.009643 \n", "PI041-05-06 0.030361 \n", "PI041-07-01 0.091682 \n", "PI041-07-02 0.063498 \n", "PI052-01-02 0.017870 " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "inclusions_errors" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
namePI032-04-01PI032-04-02PI041-02-02PI041-03-01PI041-03-03PI041-05-04PI041-05-06PI041-07-01PI041-07-02PI052-01-02
iteration
02.8147951.06189-7.7132813.0103272.955713-9.099756-0.5223142.1853760.01543-14.604492
112.5240484.575262-1.4233288.7849618.0-5.3858571.88066410.1670910.0-10.747681
23.7895264.0-0.3820316.2012946.136987-7.401428-1.3508547.8087166.187897-11.27063
311.88.137012-1.4261727.445889.01008-6.124573-2.06932410.49.422449-8.559125
42.2431642.316284-2.7307135.9053716.262866-8.7786620.8384526.9210824.375781-11.380933
\n", "
" ], "text/plain": [ "name PI032-04-01 PI032-04-02 PI041-02-02 PI041-03-01 PI041-03-03 \\\n", "iteration \n", "0 2.814795 1.06189 -7.713281 3.010327 2.955713 \n", "1 12.524048 4.575262 -1.423328 8.784961 8.0 \n", "2 3.789526 4.0 -0.382031 6.201294 6.136987 \n", "3 11.8 8.137012 -1.426172 7.44588 9.01008 \n", "4 2.243164 2.316284 -2.730713 5.905371 6.262866 \n", "\n", "name PI041-05-04 PI041-05-06 PI041-07-01 PI041-07-02 PI052-01-02 \n", "iteration \n", "0 -9.099756 -0.522314 2.185376 0.01543 -14.604492 \n", "1 -5.385857 1.880664 10.16709 10.0 -10.747681 \n", "2 -7.401428 -1.350854 7.808716 6.187897 -11.27063 \n", "3 -6.124573 -2.069324 10.4 9.422449 -8.559125 \n", "4 -8.778662 0.838452 6.921082 4.375781 -11.380933 " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pec_mc.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The dataframes in *inclusions_MC* also have *isothermal_equilibration* and *Kd_equilibration* columns. These columns show if equilibration during stage [1] and [2] respectively was successful. In extreme cases, error propagation of melt and olivine compositions by random sampling can result in melt-olivine pairs that cannot be equilibrated without crystallising more than the entire inclusion or exchanging more Mg or Fe than is present in the inclusion. If that is the case, no corrected compositions are calculated and eiher the isothermal- of Kd-equilibration column is set to *False*." ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
SiO2Al2O3MgOCaOFeONa2OK2OMnOTiO2P2O5Cr2O3CO2H2OFSClisothermal_equilibrationKd_equilibration
iteration
049.65975515.3460034.7658479.63831710.2971863.7612510.8830660.1171852.6044990.3496110.00.5241411.2895850.3840340.2176110.161906NaNNaN
149.02162113.4062038.4947898.9194210.7639323.4106220.63470.2518582.508110.1999260.00.6929121.4835250.00.1634880.048894NaNNaN
248.24739715.6706655.68745110.35298310.1448353.7999170.5791990.1164632.7035250.3130390.00.6782621.347230.0294330.0539670.275634NaNNaN
348.69100413.5950757.82550410.15596610.3943423.60040.6337250.1395962.5807420.1927470.00.4910911.4773360.1459060.0643590.012207NaNNaN
449.66828614.1394615.62687510.31721910.4872243.8563360.6091070.1186172.7127150.2648580.00.4829991.3676830.1599370.1886820.0NaNNaN
\n", "
" ], "text/plain": [ " SiO2 Al2O3 MgO CaO FeO Na2O \\\n", "iteration \n", "0 49.659755 15.346003 4.765847 9.638317 10.297186 3.761251 \n", "1 49.021621 13.406203 8.494789 8.91942 10.763932 3.410622 \n", "2 48.247397 15.670665 5.687451 10.352983 10.144835 3.799917 \n", "3 48.691004 13.595075 7.825504 10.155966 10.394342 3.6004 \n", "4 49.668286 14.139461 5.626875 10.317219 10.487224 3.856336 \n", "\n", " K2O MnO TiO2 P2O5 Cr2O3 CO2 H2O \\\n", "iteration \n", "0 0.883066 0.117185 2.604499 0.349611 0.0 0.524141 1.289585 \n", "1 0.6347 0.251858 2.50811 0.199926 0.0 0.692912 1.483525 \n", "2 0.579199 0.116463 2.703525 0.313039 0.0 0.678262 1.34723 \n", "3 0.633725 0.139596 2.580742 0.192747 0.0 0.491091 1.477336 \n", "4 0.609107 0.118617 2.712715 0.264858 0.0 0.482999 1.367683 \n", "\n", " F S Cl isothermal_equilibration \\\n", "iteration \n", "0 0.384034 0.217611 0.161906 NaN \n", "1 0.0 0.163488 0.048894 NaN \n", "2 0.029433 0.053967 0.275634 NaN \n", "3 0.145906 0.064359 0.012207 NaN \n", "4 0.159937 0.188682 0.0 NaN \n", "\n", " Kd_equilibration \n", "iteration \n", "0 NaN \n", "1 NaN \n", "2 NaN \n", "3 NaN \n", "4 NaN " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "inclusions_MC[\"PI032-04-01\"].head()" ] } ], "metadata": { "kernelspec": { "display_name": "py310", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" } }, "nbformat": 4, "nbformat_minor": 2 }