pyAp package
pyAp.ApStoic module
Weiran Li & Yishen Zhang
2022-07-08, v0.2
Please cite the paper below if you use “ApThermo” in your research:
Li and Costa (2020, GCA) https://doi.org/10.1016/j.gca.2019.10.035
- pyAp.ApStoic.stoi_(data, assume_oxy=26)[source]
function to test apatite stoichiometry
Parameters:
data: :class: pandas.Dataframe oxygen number: default is 26 for FAp, and 25 for OHAp [Use “ApStoic_Ketcham.py” if you wish to use oxygen number depending on the crystal composition (between 25-26) following Ketcham2015]
Return:
- res_apfu: :class: pandas.Dataframe
saved csv file
pyAp.ApTernary module
Weiran Li & Yishen Zhang
2022-02-20, v0.2
Please cite the paper below if you use “ApThermo” in your research:
Li and Costa (2020, GCA) https://doi.org/10.1016/j.gca.2019.10.035
pyAp.pyAp_tools module
Weiran Li & Yishen Zhang
2022-02-20, v0.2
- pyAp.pyAp_tools.ap_mc(comp, std, i, mc)[source]
MC calculation model for pyAp
Parameters:
comp: :class: pandas.Dataframe std: :class: pandas.Dataframe i: :class: numpy.array
index for iteration
- mc: :class: numpy.array
number of monte carlo simulation
Returns:
- df: :class: pandas.Dataframe
expanded dataframe after monte carlo simulation
pyAp.pyApthermo module
Weiran Li & Yishen Zhang
2022-07-08, v0.2
Please cite the paper below if you use “ApThermo” in your research:
Li and Costa (2020, GCA) https://doi.org/10.1016/j.gca.2019.10.035
- class pyAp.pyApthermo.ApThermo(inputs, cal_H2O=True, cal_gamma=False)[source]
Bases:
objectcalculate exchange coefficients (Kd) and melt water contents using apatite
Input values should be filled in the provided excel spreadsheet.
!! Do NOT change the column header names in the input file, as this code reads the data according to those names (it’s okay to change column orders).
Parameters (“inputs”)
Inputs have to follow this order: “XF”, “XCL”, “T,C”, “MELTF”, “MELTCL”, “MELTCOMP”,
For Kd calculation: * XF : mole fraction of F in apatite (can be calculated from “pyAp/ApStoic.py”) * XCL : mole fraction of Cl in apatite * “T,C” : temperature in celsius degree
For water calculation (if “cal_H2O==True”): * MELTF : F concentration in the melt, in wt% * MELTCL : Cl concentration in the melt, in wt% * MELTCOMP: Melt composition (for choosing water speciation model)
Switches (conditions for calculation)
For water speciation: “highP” , “highT” (see below)
- “cal_H2O”choose whether to calculate melt water contents
default = True
- “cal_gamma”: choose whether to calculate activity coefficients of F, Cl, OH in the melt (for further calculations beyond this model)
default = False
- Kd()[source]
calculate exchange coefficients Kd using apatite F-Cl-OH composition, and temperature (T)
return Kds for OH-Cl, OH-F, Cl-F, and activity coefficients (gamma) for OH, F, Cl
Module contents
pyAp
pyAp is a python package for calculating magmatic volatile, trace element concentrations, and oxygen fugacity using mineral apatite.
It includes multiple apatite-based models developed by W. Li and co-authors, including:
ApThermo: a thermodynamic model for calculating melt H2O (and CO2) concentrations (following Li & Costa, 2020, GCA) ApREE2O3: a lattice strain-thermodynamic model for calculating melt trace element (including REE) concentrations and oxygen fugacity (fO2) (following Li et al, in review)
More modules will be added in the future (ApTimer - Li et al. 2020 EPSL; ApZone - Li et al. in prep).