This page was generated from docs/Examples/Data_Input/Importing_Petrolog.ipynb. Interactive online version: .
Importing Petrolog3 files
This notebook shows how to import Petrolog3 output files to calculate the SCSS.
You can download the relevant excel file here:
If you havent done so already, you need to pip install PySulfSat
Do this by removing the #. You only need to do this once per computer. After your initial installation, you will want to upgrade instead using the second command
[1]:
#!pip install PySulfSat
#!pip install PySulfSat --upgrade
[2]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import PySulfSat as ss
pd.options.display.max_columns = None
ss.__version__
[2]:
'0.0.17'
Import data
Here we have Ni and Cu contents in Petrolog, although really, they should be solved iteratively as demonstrated in the sulfide fractionation example
[3]:
df_out=ss.import_data('PetrologCalculations.xlsx', Petrolog=True)
df_out.head()
We have replaced all missing liquid oxides and strings with zeros.
[3]:
SiO2_Liq | TiO2_Liq | Al2O3_Liq | FeOt_Liq | MnO_Liq | MgO_Liq | CaO_Liq | Na2O_Liq | K2O_Liq | P2O5_Liq | H2O_Liq | Fe3Fet_Liq | Ni_Liq_ppm | Cu_Liq_ppm | SiO2_magma | TiO2_magma | Al2O3_magma | Fe2O3_magma | FeO_magma | MnO_magma | MgO_magma | CaO_magma | Na2O_magma | K2O_magma | P2O5_magma | Cr2O3_magma | Ni_magma | Cu_magma | Cr2O3_Liq | Ni_Liq | Cu_Liq | SiO2_cumulate | TiO2_cumulate | Al2O3_cumulate | Fe2O3_cumulate | FeO_cumulate | MnO_cumulate | MgO_cumulate | CaO_cumulate | Na2O_cumulate | K2O_cumulate | P2O5_cumulate | Cr2O3_cumulate | Ni_cumulate | Cu_cumulate | Temperature | Temperature_Olv | Olv_Fo_magma | Olv_Kd | Olv_Fo_cumulate | Pressure(kbar) | Lg(fO2) | dNNO | density | Ln(viscosity) | Melt_%_magma | Olv_%_magma | Olv_Peritectic | Fluid_%_magma | Olv_%_cumulate | Sample | Unnamed:58 | T_K | P_kbar | Fraction_melt | Sample_ID_Liq | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 49.9010 | 0.9981 | 14.9715 | 8.980926 | 0.0998 | 9.9763 | 11.9772 | 2.4953 | 0.1996 | 0.0998 | 0.0 | 0.098489 | 697.8 | 99.8 | 49.9010 | 0.9981 | 14.9715 | 0.9839 | 8.0964 | 0.0998 | 9.9763 | 11.9772 | 2.4953 | 0.1996 | 0.0998 | 0.0998 | 697.8 | 99.8 | 0.0998 | 697.8 | 99.8 | 40.2986 | 0 | 0 | 0 | 11.7372 | 0 | 46.9121 | 0 | 0 | 0 | 0 | 0 | 8257.6 | 10.0 | 1253.281 | 1253.281 | 87.69 | 0.308 | 87.69 | 1 | -7.72 | -0.7 | 2.683 | 6.25 | 99.9900 | 0 | N | 0 | 0.0100 | PetrologDefault | 08:21:15 | 1526.431 | 1 | 0.999900 | 0 |
1 | 49.9978 | 1.0081 | 15.1220 | 8.951296 | 0.1008 | 9.6064 | 12.0976 | 2.5203 | 0.2016 | 0.1008 | 0.0 | 0.097851 | 624.6 | 100.7 | 49.9978 | 1.0081 | 15.1220 | 0.9743 | 8.0754 | 0.1008 | 9.6064 | 12.0976 | 2.5203 | 0.2016 | 0.1008 | 0.1008 | 624.6 | 100.7 | 0.1008 | 624.6 | 100.7 | 40.2698 | 0 | 0 | 0 | 11.9273 | 0 | 46.7855 | 0 | 0 | 0 | 0 | 0 | 7984.5 | 10.0 | 1243.430 | 1243.430 | 87.28 | 0.309 | 87.49 | 1 | -7.83 | -0.7 | 2.682 | 6.38 | 98.9950 | 0 | N | 0 | 1.0050 | PetrologDefault | 08:21:15 | 1516.580 | 1 | 0.989950 | 1 |
2 | 50.0982 | 1.0185 | 15.2770 | 8.916645 | 0.1018 | 9.2279 | 12.2216 | 2.5462 | 0.2037 | 0.1018 | 0.0 | 0.097284 | 554.8 | 101.6 | 50.0982 | 1.0185 | 15.2770 | 0.9649 | 8.0492 | 0.1018 | 9.2279 | 12.2216 | 2.5462 | 0.2037 | 0.1018 | 0.1018 | 554.8 | 101.6 | 0.1018 | 554.8 | 101.6 | 40.2390 | 0 | 0 | 0 | 12.1280 | 0 | 46.6507 | 0 | 0 | 0 | 0 | 0 | 7708.8 | 10.1 | 1233.064 | 1233.064 | 86.83 | 0.310 | 87.27 | 1 | -7.94 | -0.7 | 2.681 | 6.52 | 97.9904 | 0 | N | 0 | 2.0096 | PetrologDefault | 08:21:15 | 1506.214 | 1 | 0.979904 | 2 |
3 | 50.2003 | 1.0289 | 15.4337 | 8.877334 | 0.1029 | 8.8486 | 12.3469 | 2.5723 | 0.2058 | 0.1029 | 0.0 | 0.096823 | 489.9 | 102.6 | 50.2003 | 1.0289 | 15.4337 | 0.9561 | 8.0178 | 0.1029 | 8.8486 | 12.3469 | 2.5723 | 0.2058 | 0.1029 | 0.1029 | 489.9 | 102.6 | 0.1029 | 489.9 | 102.6 | 40.2069 | 0 | 0 | 0 | 12.3359 | 0 | 46.5096 | 0 | 0 | 0 | 0 | 0 | 7436.5 | 10.1 | 1222.361 | 1222.361 | 86.36 | 0.311 | 87.05 | 1 | -8.05 | -0.7 | 2.680 | 6.67 | 96.9959 | 0 | N | 0 | 3.0041 | PetrologDefault | 08:21:15 | 1495.511 | 1 | 0.969959 | 3 |
4 | 50.3062 | 1.0397 | 15.5950 | 8.832002 | 0.1040 | 8.4612 | 12.4760 | 2.5992 | 0.2079 | 0.1040 | 0.0 | 0.096445 | 428.7 | 103.5 | 50.3062 | 1.0397 | 15.5950 | 0.9475 | 7.9802 | 0.1040 | 8.4612 | 12.4760 | 2.5992 | 0.2079 | 0.1040 | 0.1040 | 428.7 | 103.5 | 0.1040 | 428.7 | 103.5 | 40.1725 | 0 | 0 | 0 | 12.5558 | 0 | 46.3589 | 0 | 0 | 0 | 0 | 0 | 7162.8 | 10.2 | 1211.080 | 1211.080 | 85.84 | 0.312 | 86.81 | 1 | -8.18 | -0.7 | 2.679 | 6.83 | 95.9923 | 0 | N | 0 | 4.0077 | PetrologDefault | 08:21:15 | 1484.230 | 1 | 0.959923 | 4 |
Calculate SCSS using Smythe
[4]:
Smythe_CalcSulf=ss.calculate_S2017_SCSS(df=df_out, T_K=df_out['T_K'],
P_kbar=df_out['P_kbar'], Fe_FeNiCu_Sulf=0.65,
Fe3Fet_Liq=df_out['Fe3Fet_Liq'], Ni_Liq=df_out['Ni_Liq_ppm'], Cu_Liq=df_out['Cu_Liq_ppm'])
Smythe_CalcSulf.head()
Using inputted Fe_FeNiCu_Sulf ratio for calculations.
no non ideal SCSS as no Cu/CuFeNiCu
[4]:
SCSS2_ppm_ideal_Smythe2017 | SCSS2_ppm_ideal_Smythe2017_1sigma | T_Input_K | P_Input_kbar | Fe_FeNiCu_Sulf | Fe3Fet_Liq_input | Si_wt_atom | Ti_wt_atom | Al_wt_atom | Mg_wt_atom | Mn_wt_atom | Fe2_wt_atom | Fe3_wt_atom | Ca_wt_atom | Na_wt_atom | K_wt_atom | P_wt_atom | H_wt_atom | Si_XA_ideal | Ti_XA_ideal | Al_XA_ideal | Mg_XA_ideal | Fe2_XA_ideal | Ca_XA_ideal | Na_XA_ideal | K_XA_ideal | H_XA_ideal | Si*Fe_ideal | Si_XA_non_ideal | Ti_XA_non_ideal | Al_XA_non_ideal | Mg_XA_non_ideal | Fe2_XA_non_ideal | Ca_XA_non_ideal | Na_XA_non_ideal | K_XA_non_ideal | H_XA_non_ideal | Si*Fe_non_ideal | log_SCSS_ideal | Fe_FeNiCu_Sulf_calc | SiO2_Liq | TiO2_Liq | Al2O3_Liq | FeOt_Liq | MnO_Liq | MgO_Liq | CaO_Liq | Na2O_Liq | K2O_Liq | P2O5_Liq | H2O_Liq | Fe3Fet_Liq | Ni_Liq_ppm | Cu_Liq_ppm | SiO2_magma | TiO2_magma | Al2O3_magma | Fe2O3_magma | FeO_magma | MnO_magma | MgO_magma | CaO_magma | Na2O_magma | K2O_magma | P2O5_magma | Cr2O3_magma | Ni_magma | Cu_magma | Cr2O3_Liq | Ni_Liq | Cu_Liq | SiO2_cumulate | TiO2_cumulate | Al2O3_cumulate | Fe2O3_cumulate | FeO_cumulate | MnO_cumulate | MgO_cumulate | CaO_cumulate | Na2O_cumulate | K2O_cumulate | P2O5_cumulate | Cr2O3_cumulate | Ni_cumulate | Cu_cumulate | Temperature | Temperature_Olv | Olv_Fo_magma | Olv_Kd | Olv_Fo_cumulate | Pressure(kbar) | Lg(fO2) | dNNO | density | Ln(viscosity) | Melt_%_magma | Olv_%_magma | Olv_Peritectic | Fluid_%_magma | Olv_%_cumulate | Sample | Unnamed:58 | T_K | P_kbar | Fraction_melt | Sample_ID_Liq | Fe_FeNiCu_Sulf_calc | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1163.632126 | 317.869126 | 1526.431 | 1 | 0.65 | 0.098489 | 0.458760 | 0.006900 | 0.162217 | 0.136728 | 0.000777 | 0.062247 | 0.006799 | 0.117975 | 0.044478 | 0.002341 | 0.000777 | 0.0 | -12643.917846 | -77.425761 | -2992.954217 | -1910.042747 | -2133.469827 | -923.846254 | -589.186980 | -67.922629 | -0.0 | 3328.767457 | -12843.656196 | -73.937634 | -3082.117373 | -1984.261077 | -2172.132780 | -1041.911444 | -609.912056 | -66.914620 | -0.0 | 3364.402871 | 7.059302 | 0.65 | 49.9010 | 0.9981 | 14.9715 | 8.980926 | 0.0998 | 9.9763 | 11.9772 | 2.4953 | 0.1996 | 0.0998 | 0.0 | 0.098489 | 697.8 | 99.8 | 49.9010 | 0.9981 | 14.9715 | 0.9839 | 8.0964 | 0.0998 | 9.9763 | 11.9772 | 2.4953 | 0.1996 | 0.0998 | 0.0998 | 697.8 | 99.8 | 0.0998 | 697.8 | 99.8 | 40.2986 | 0 | 0 | 0 | 11.7372 | 0 | 46.9121 | 0 | 0 | 0 | 0 | 0 | 8257.6 | 10.0 | 1253.281 | 1253.281 | 87.69 | 0.308 | 87.69 | 1 | -7.72 | -0.7 | 2.683 | 6.25 | 99.9900 | 0 | N | 0 | 0.0100 | PetrologDefault | 08:21:15 | 1526.431 | 1 | 0.999900 | 0 | 0.65 |
1 | 1132.187652 | 309.279446 | 1516.580 | 1 | 0.65 | 0.097851 | 0.460128 | 0.006977 | 0.164018 | 0.131795 | 0.000786 | 0.062150 | 0.006740 | 0.119285 | 0.044970 | 0.002367 | 0.000785 | 0.0 | -12681.596545 | -78.282676 | -3026.179002 | -1841.131776 | -2130.145227 | -934.101871 | -595.707729 | -68.674435 | -0.0 | 3333.484439 | -12881.930112 | -74.755944 | -3116.331958 | -1912.672440 | -2168.747932 | -1053.477703 | -616.662177 | -67.655269 | -0.0 | 3369.170350 | 7.031907 | 0.65 | 49.9978 | 1.0081 | 15.1220 | 8.951296 | 0.1008 | 9.6064 | 12.0976 | 2.5203 | 0.2016 | 0.1008 | 0.0 | 0.097851 | 624.6 | 100.7 | 49.9978 | 1.0081 | 15.1220 | 0.9743 | 8.0754 | 0.1008 | 9.6064 | 12.0976 | 2.5203 | 0.2016 | 0.1008 | 0.1008 | 624.6 | 100.7 | 0.1008 | 624.6 | 100.7 | 40.2698 | 0 | 0 | 0 | 11.9273 | 0 | 46.7855 | 0 | 0 | 0 | 0 | 0 | 7984.5 | 10.0 | 1243.430 | 1243.430 | 87.28 | 0.309 | 87.49 | 1 | -7.83 | -0.7 | 2.682 | 6.38 | 98.9950 | 0 | N | 0 | 1.0050 | PetrologDefault | 08:21:15 | 1516.580 | 1 | 0.989950 | 1 | 0.65 |
2 | 1099.523987 | 300.356720 | 1506.214 | 1 | 0.65 | 0.097284 | 0.461540 | 0.007056 | 0.165875 | 0.126736 | 0.000794 | 0.062014 | 0.006682 | 0.120635 | 0.045480 | 0.002394 | 0.000794 | 0.0 | -12720.511949 | -79.173986 | -3060.433090 | -1770.461624 | -2125.481450 | -944.675207 | -602.466551 | -69.463239 | -0.0 | 3336.392958 | -12921.460271 | -75.607099 | -3151.606511 | -1839.256265 | -2163.999637 | -1065.402284 | -623.658745 | -68.432367 | -0.0 | 3372.110005 | 7.002633 | 0.65 | 50.0982 | 1.0185 | 15.2770 | 8.916645 | 0.1018 | 9.2279 | 12.2216 | 2.5462 | 0.2037 | 0.1018 | 0.0 | 0.097284 | 554.8 | 101.6 | 50.0982 | 1.0185 | 15.2770 | 0.9649 | 8.0492 | 0.1018 | 9.2279 | 12.2216 | 2.5462 | 0.2037 | 0.1018 | 0.1018 | 554.8 | 101.6 | 0.1018 | 554.8 | 101.6 | 40.2390 | 0 | 0 | 0 | 12.1280 | 0 | 46.6507 | 0 | 0 | 0 | 0 | 0 | 7708.8 | 10.1 | 1233.064 | 1233.064 | 86.83 | 0.310 | 87.27 | 1 | -7.94 | -0.7 | 2.681 | 6.52 | 97.9904 | 0 | N | 0 | 2.0096 | PetrologDefault | 08:21:15 | 1506.214 | 1 | 0.979904 | 2 | 0.65 |
3 | 1066.279038 | 291.275205 | 1495.511 | 1 | 0.65 | 0.096823 | 0.462968 | 0.007136 | 0.167753 | 0.121655 | 0.000804 | 0.061837 | 0.006628 | 0.122000 | 0.045995 | 0.002421 | 0.000803 | 0.0 | -12759.875643 | -80.066770 | -3095.084610 | -1699.479235 | -2119.422207 | -955.366577 | -609.283904 | -70.253349 | -0.0 | 3337.176747 | -12961.445800 | -76.459662 | -3187.290335 | -1765.515721 | -2157.830588 | -1077.459984 | -630.715903 | -69.210751 | -0.0 | 3372.902185 | 6.971930 | 0.65 | 50.2003 | 1.0289 | 15.4337 | 8.877334 | 0.1029 | 8.8486 | 12.3469 | 2.5723 | 0.2058 | 0.1029 | 0.0 | 0.096823 | 489.9 | 102.6 | 50.2003 | 1.0289 | 15.4337 | 0.9561 | 8.0178 | 0.1029 | 8.8486 | 12.3469 | 2.5723 | 0.2058 | 0.1029 | 0.1029 | 489.9 | 102.6 | 0.1029 | 489.9 | 102.6 | 40.2069 | 0 | 0 | 0 | 12.3359 | 0 | 46.5096 | 0 | 0 | 0 | 0 | 0 | 7436.5 | 10.1 | 1222.361 | 1222.361 | 86.36 | 0.311 | 87.05 | 1 | -8.05 | -0.7 | 2.680 | 6.67 | 96.9959 | 0 | N | 0 | 3.0041 | PetrologDefault | 08:21:15 | 1495.511 | 1 | 0.969959 | 3 | 0.65 |
4 | 1031.735153 | 281.838860 | 1484.230 | 1 | 0.65 | 0.096445 | 0.464443 | 0.007218 | 0.169688 | 0.116454 | 0.000813 | 0.061613 | 0.006575 | 0.123408 | 0.046526 | 0.002449 | 0.000813 | 0.0 | -12800.521565 | -80.994067 | -3130.789539 | -1626.819177 | -2111.747851 | -966.392392 | -616.316520 | -71.046416 | -0.0 | 3335.684853 | -13002.733814 | -77.345183 | -3224.058949 | -1690.032319 | -2150.017156 | -1089.894870 | -637.995897 | -69.992049 | -0.0 | 3371.394320 | 6.938997 | 0.65 | 50.3062 | 1.0397 | 15.5950 | 8.832002 | 0.1040 | 8.4612 | 12.4760 | 2.5992 | 0.2079 | 0.1040 | 0.0 | 0.096445 | 428.7 | 103.5 | 50.3062 | 1.0397 | 15.5950 | 0.9475 | 7.9802 | 0.1040 | 8.4612 | 12.4760 | 2.5992 | 0.2079 | 0.1040 | 0.1040 | 428.7 | 103.5 | 0.1040 | 428.7 | 103.5 | 40.1725 | 0 | 0 | 0 | 12.5558 | 0 | 46.3589 | 0 | 0 | 0 | 0 | 0 | 7162.8 | 10.2 | 1211.080 | 1211.080 | 85.84 | 0.312 | 86.81 | 1 | -8.18 | -0.7 | 2.679 | 6.83 | 95.9923 | 0 | N | 0 | 4.0077 | PetrologDefault | 08:21:15 | 1484.230 | 1 | 0.959923 | 4 | 0.65 |
[5]:
fig, (ax1) = plt.subplots(1, 1, figsize=(5,4.5), sharey=True)
ax1.plot(Smythe_CalcSulf['FeOt_Liq'], Smythe_CalcSulf['SCSS2_ppm_ideal_Smythe2017'],
'-r')
ax1.plot(Smythe_CalcSulf['FeOt_Liq'],
Smythe_CalcSulf['SCSS2_ppm_ideal_Smythe2017']+Smythe_CalcSulf['SCSS2_ppm_ideal_Smythe2017_1sigma'],
':r')
ax1.plot(Smythe_CalcSulf['FeOt_Liq'],
Smythe_CalcSulf['SCSS2_ppm_ideal_Smythe2017']-Smythe_CalcSulf['SCSS2_ppm_ideal_Smythe2017_1sigma'],
':r')
ax1.set_ylabel('SCSS (ppm)')
ax1.set_xlabel('FeO$_{T}$ Liq (Wt%)')
[5]:
Text(0.5, 0, 'FeO$_{T}$ Liq (Wt%)')
[ ]:
[ ]:
[ ]: