Skip to content

Accessor

petropandas.pandas_accessors.OxidesAccessor

Use .oxides pandas dataframe accessor.

props property

Returns properties.

oxwt(**kwargs)

Convert molar proportions to oxides weight percents.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with oxides weight percents

cat_number(**kwargs)

Calculate cations number.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with cations numbers

oxy_number(**kwargs)

Calculate oxygens number.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with oxygens numbers

omega(**kwargs)

Oxygen to positive atomic charges ratio

Parameters:

Name Type Description Default
mineral Mineral

noxy and ncat are taken from Mneral instance

required
noxy int

ideal number of oxygens. Default 1

required
ncat int

ideal number of cations. Default 1

required

onf(noxy)

Oxygen normalisation factor - ideal oxygens / sum of oxygens

Other Parameters:

Name Type Description
noxy int

ideal oxygens

Returns:

Type Description
Series

pandas.Series: oxygen normalisation factors

cnf(ncat)

Cation normalisation factor - ideal cations / sum of cations

Parameters:

Name Type Description Default
ncat int

ideal cations

required

Returns:

Type Description
Series

pandas.Series: cation normalisation factors

cations(**kwargs)

Cations calculated on the basis of oxygens or cations.

Other Parameters:

Name Type Description
noxy int

ideal number of oxygens. Default 1

ncat int

ideal number of cations. Default 1

tocat bool

when True normalized to ncat, otherwise to noxy. Default False

Returns:

Type Description
DataFrame

Dataframe with calculated cations

charges(ncat, **kwargs)

Calculates charges based on number of cations.

Parameters:

Name Type Description Default
ncat int

number of cations

required

Other Parameters:

Name Type Description
keep list

list of additional columns to be included.Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with charges

charge_def(**kwargs)

Calculates charge deficiency based on number of oxygens and cations.

Other Parameters:

Name Type Description
mineral Mineral

noxy and ncat are taken from Mneral instance

noxy int

ideal number of oxygens. Default 1

ncat int

ideal number of cations. Default 1

Returns:

Type Description
Series

pandas.Series: Charge deficiency

apatite_correction(**kwargs)

Apatite correction

Note

All P2O5 is assumed to be apatite based and is removed from composition

CaO mol% = CaO mol% - (10 / 3) * P2O5 mol%

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Apatite corrected dataframe

convert_Fe(**kwargs)

Recalculate FeO to Fe2O3 or vice-versa.

Note

When only FeO exists, all is recalculated to Fe2O3. When only Fe2O3 exists, all is recalculated to FeO. When both exists, Fe2O3 is recalculated and added to FeO. Otherwise datatable is not changed.

Other Parameters:

Name Type Description
to str

to what iron oxide Fe should be converted. Default "FeO"

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with converted Fe oxide

recalculate_Fe(**kwargs)

Recalculate Fe based on charge balance.

Note

Either both FeO and Fe2O3 are present or any of then, the composition is modified to fullfil charge balance for given cations and oxygens.

Number of cations and oxygens could be provided by ncat and noxy args or by Mineral instance

Other Parameters:

Name Type Description
mineral Mineral

noxy and ncat are taken from Mneral instance

noxy int

ideal number of oxygens. Default 1

ncat int

ideal number of cations. Default 1

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with recalculated Fe

apfu(mineral, **kwargs)

Calculate a.p.f.u for given mineral

Parameters:

Name Type Description Default
mineral Mineral

Mineral instance (see petropandas.minerals)

required

Other Parameters:

Name Type Description
force bool

when True, remaining cations are added to last site

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with apfu for given mineral

check_stechiometry(mineral, **kwargs)

Calculate average missfit of populated and ideal cations on sites for given mineral

Parameters:

Name Type Description Default
mineral Mineral

Mineral instance (see petropandas.minerals)

required

Other Parameters:

Name Type Description
force bool

when True, remaining cations are added to last site

Returns:

Type Description
Series

Series with calculated misfit

endmembers(mineral, **kwargs)

Calculate endmembers proportions

Parameters:

Name Type Description Default
mineral Mineral

Mineral instance (see petropandas.minerals)

required

Other Parameters:

Name Type Description
tocat bool

when True normalize to cations, otherwise to oxygens. Default False

force bool

when True, remaining cations are added to last site

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with calculated endmembers

TCbulk(**kwargs)

Print oxides formatted as THERMOCALC bulk script

Note

The CaO is recalculate using apatite correction based on P205 if available.

Other Parameters:

Name Type Description
H2O float

wt% of water. When -1 the amount is calculated as 100 - Total. Default -1.

oxygen float

value to calculate moles of ferric iron. Moles FeO = FeOtot - 2O and moles Fe2O3 = O. Default 0.01

system str

axfile to be used. One of 'MnNCKFMASHTO', 'NCKFMASHTO', 'KFMASH', 'NCKFMASHTOCr', 'NCKFMASTOCr'. Default 'MnNCKFMASHTO'

Perplexbulk(**kwargs)

Print oxides formatted as PerpleX thermodynamic component list

Note

The CaO is recalculate using apatite correction based on P205 if available.

Other Parameters:

Name Type Description
H2O float

wt% of water. When -1 the amount is calculated as 100 - Total. Default -1.

oxygen float

value to calculate moles of ferric iron. Moles FeO = FeOtot - 2O and moles Fe2O3 = O. Default 0.01

system str

system to be used. One of 'MnNCKFMASHTO', 'NCKFMASHTO', 'KFMASH', 'NCKFMASHTOCr', 'NCKFMASTOCr'. Default 'MnNCKFMASHTO'

MAGEMin(**kwargs)

Print oxides formatted as MAGEMin bulk file

Note

The CaO is recalculate using apatite correction based on P205 if available.

Other Parameters:

Name Type Description
H2O float

wt% of water. When -1 the amount is calculated as 100 - Total. Default -1.

oxygen float

value to calculate moles of ferric iron. Moles FeO = FeOtot - 2O and moles Fe2O3 = O. Default 0.01

db str

MAGEMin database. 'mp' metapelite (White et al. 2014), 'mb' metabasite (Green et al. 2016), 'ig' igneous (Holland et al. 2018), 'um' ultramafic (Evans & Frost 2021), 'ume' ultramafic extended (Evans & Frost 2021 + pl, hb and aug from Green et al. 2016), 'mpe' Metapelite extended (White et al. 2014, Green et al. 2016, Evans & Frost 2021), 'mbe' Metabasite extended (Green et al. 2016, Diener et al. 2007), 'mtl' mantle (Holland et al. 2013). Default is "mp"

sys_in str

system comp "wt" or "mol". Default is "mol"

title str

used as title. Default index

comment str

used as comment. Default 'petropandas'

df(**kwargs)

Returns dataframe.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe

dropna(**kwargs)

Drop columns with NA values.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

Returns:

Type Description
DataFrame

Dataframe without NA columns

molprop(**kwargs)

Convert oxides weight percents to molar proportions.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with molar proportions

mean()

Return Dataframe with single row of arithmetic means of valid columns

sum()

Return Dataframe with single row of sum of valid columns

scale(**kwargs)

Normalize values to given sum.

Other Parameters:

Name Type Description
to float

Sum of values. Default 100.0

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Scaled dataframe

plot(**kwargs)

Paiplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

boxplot(**kwargs)

Boxplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

heatmap(**kwargs)

Correlation heatmap of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

petropandas.pandas_accessors.IonsAccessor

Use .ions pandas dataframe accessor.

props property

Returns properties.

wt(omega=1)

Oxides weight percents calculated from ions.

Returns:

Type Description
DataFrame

Dataframe with calculated oxides weight percents

df(**kwargs)

Returns dataframe.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe

dropna(**kwargs)

Drop columns with NA values.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

Returns:

Type Description
DataFrame

Dataframe without NA columns

molprop(**kwargs)

Convert oxides weight percents to molar proportions.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with molar proportions

mean()

Return Dataframe with single row of arithmetic means of valid columns

sum()

Return Dataframe with single row of sum of valid columns

scale(**kwargs)

Normalize values to given sum.

Other Parameters:

Name Type Description
to float

Sum of values. Default 100.0

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Scaled dataframe

plot(**kwargs)

Paiplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

boxplot(**kwargs)

Boxplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

heatmap(**kwargs)

Correlation heatmap of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

petropandas.pandas_accessors.ElementsAccessor

Use .elements pandas dataframe accessor.

props property

Returns properties.

df(**kwargs)

Returns dataframe.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe

dropna(**kwargs)

Drop columns with NA values.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

Returns:

Type Description
DataFrame

Dataframe without NA columns

molprop(**kwargs)

Convert oxides weight percents to molar proportions.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with molar proportions

mean()

Return Dataframe with single row of arithmetic means of valid columns

sum()

Return Dataframe with single row of sum of valid columns

scale(**kwargs)

Normalize values to given sum.

Other Parameters:

Name Type Description
to float

Sum of values. Default 100.0

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Scaled dataframe

plot(**kwargs)

Paiplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

boxplot(**kwargs)

Boxplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

heatmap(**kwargs)

Correlation heatmap of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

petropandas.pandas_accessors.REEAccessor

Use .ree pandas dataframe accessor.

props property

Returns properties.

normalize(**kwargs)

Normalize REE by reservoir.

Note

Predefined reservoirs are imported from GERM Reservoir Database. You can check all available reservoirs in config["reservoirs"].

Other Parameters:

Name Type Description
reservoir str

Name of reservoir. Deafult "CI Chondrites"

reference str

Reference. Default "McDonough & Sun 1995"

source str

Original source. Deafult same as reference.

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with normalized REE composition

plot(**kwargs)

Spiderplot of REE data.

Note

List of REE used for plot could be set in config["ree_plot"]

Other Parameters:

Name Type Description
grouped bool

When True aggegated data with confidence interval is drawn. Default False

boxplot bool

When True, boxplot for each REE is drawn. Default False

boxplot_props dict

Additional arguments passed to sns.boxplot. Default {"color": "grey"}.

hue str or None

Name of columns used for colors.

palette string, list, dict, or matplotlib.colors.Colormap

Method for choosing the colors to use when mapping the hue semantic.

legend "auto", "brief", "full", or False

How to draw the legend.

title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

df(**kwargs)

Returns dataframe.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe

dropna(**kwargs)

Drop columns with NA values.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

Returns:

Type Description
DataFrame

Dataframe without NA columns

molprop(**kwargs)

Convert oxides weight percents to molar proportions.

Other Parameters:

Name Type Description
keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Dataframe with molar proportions

mean()

Return Dataframe with single row of arithmetic means of valid columns

sum()

Return Dataframe with single row of sum of valid columns

scale(**kwargs)

Normalize values to given sum.

Other Parameters:

Name Type Description
to float

Sum of values. Default 100.0

keep list

list of additional columns to be included. Default [].

dropna bool

whether to drop columns with NA only. Default True

Returns:

Type Description
DataFrame

Scaled dataframe

boxplot(**kwargs)

Boxplot of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.

heatmap(**kwargs)

Correlation heatmap of data.

All keywords except further listed are passed to seaborn pairplot.

Use all accessor valid columns or columns provided in vars

Other Parameters:

Name Type Description
title str

Title of the plot. Default None

filename str

If not none, plot is saved to file. Default None.

dpi int

DPI used for savefig. Default 150.