elphick.geomet.sample.Sample

class elphick.geomet.sample.Sample(data=None, name=None, moisture_in_scope=True, mass_wet_var=None, mass_dry_var=None, moisture_var=None, component_vars=None, composition_units='%', components_as_symbols=True, ranges=None, config_file=None)[source]
__init__(data=None, name=None, moisture_in_scope=True, mass_wet_var=None, mass_dry_var=None, moisture_var=None, component_vars=None, composition_units='%', components_as_symbols=True, ranges=None, config_file=None)[source]
Parameters:
  • data (Optional[DataFrame]) – The input data

  • name (Optional[str]) – The name of the sample

  • moisture_in_scope (bool) – Whether the moisture is in scope. If False, only dry mass is processed.

  • mass_wet_var (Optional[str]) – The name of the wet mass column

  • mass_dry_var (Optional[str]) – The name of the dry mass column

  • moisture_var (Optional[str]) – The name of the moisture column

  • component_vars (Optional[list[str]]) – The names of the chemical columns

  • components_as_symbols (bool) – If True, convert the composition variables to symbols, e.g. Fe

  • ranges (Optional[dict[str, list]]) – The range of valid data for each column in the data

  • config_file (Optional[Path]) – The configuration file

Methods

__init__([data, name, moisture_in_scope, ...])

add(other[, name, include_supplementary_data])

Add two objects together

balance_composition()

Balance the composition data

clip_composition([ranges])

Clip the components

clip_recovery(other[, recovery_bounds, ...])

Clip the recovery to the specified bounds and recalculate the estimate.

create_congruent_object(name[, ...])

Create an object with the same attributes

div(other[, name, include_supplementary_data])

Divide two objects

filter_by_index(index)

Update the data by index

from_mass_dataframe(mass_df[, mass_wet, ...])

Class method to create a MassComposition object from a mass dataframe.

get_mass_data([include_moisture])

Get the mass data

plot_comparison(other[, color, ...])

Create an interactive parallel plot

plot_parallel([color, vars_include, ...])

Create an interactive parallel plot

plot_ternary(variables[, color, title])

Plot a ternary diagram

query(expr[, name])

Reduce the data by a query expression

reset_index(index_name)

set_moisture(moisture[, mass_to_adjust])

Set the moisture to the specified value

split(fraction[, name_1, name_2, ...])

Split the object by mass

sub(other[, name, include_supplementary_data])

Subtract other from self

to_stream()

update_mass_data(value)

weight_average([group_by])

Attributes

aggregate

composition_columns

data

data_columns

mass_columns

mass_data

moisture_column

supplementary_columns

variable_map

A map from lower case standard names to the actual column names