Utilities

Helper functions for building extractions.

litxbench.core.extraction_utils.balance_composition(main_element, additions)[source]

A composition written in balance notation is as follows: Ti-6Al-4V Where Ti is the main element, and an additional 6% Al and 4% V (by w.t. %) are added to the base element to form the alloy..

This function makes it easy to specify balance compositions.

Parameters:
  • main_element (str) – The main element in the composition.

  • additions (dict[str, float]) – A dictionary of the additions to the main element. The keys are the elements, and the values are the percentages of the additions. The percentage of the main element is calculated as 100 - the sum of the percentages of the additions.

Returns:

A Composition object.

Return type:

Composition

litxbench.core.extraction_utils.composition_with_weight_additions(base, additions, addition_wt_frac)[source]

How to interpret this:

  1. They weighted out the base composition in the lab

  2. They added additions_comp to the base composition. The amount added is addition_wt_frac of the base composition’s weight.

Parameters:
  • base (Composition)

  • additions (Composition)

  • addition_wt_frac (float)

Return type:

Composition

litxbench.core.extraction_utils.convert_value_between_units(value, input_unit, output_unit)[source]
Parameters:
Return type:

float

litxbench.core.extraction_utils.normalize(val, val_in_paper, source=None)[source]

This function to document that the value mentioned in the paper (e.g. a type of meaasurement/process/material/object etc.) is actually a privileged ground-truth value.

E.g. The paper says they measured the Yield Strength of an alloy via compression testing:

val_in_paper=”Yield Strength”

When we normalize this, we interpret it as:

val=AlloyMeasurementKind.yield_strength_compression

Parameters:
  • val (T)

  • val_in_paper (str)

  • source (str | None)

Return type:

T