AFL.automation.mixing.Solution#

Functions

enforce_units(value, unit_type)

Ensure that a number has units and convert to the default_units

has_units(value)

is_mass(value)

is_volume(value)

Classes

Component(name[, mass, volume, density, ...])

Component of a mixture

Context(name)

Inherited by Pipeline to allow for context manager abuse

MixDB([db_spec])

Solution(name[, total_mass, total_volume, ...])

chain

chain(*iterables) --> chain object

Exceptions

EmptyException

Raised when a mixture runs out of mass or volume

MixWarning

NotFoundError

class AFL.automation.mixing.Solution.Solution(name: str, total_mass: str | Quantity | None = None, total_volume: str | Quantity | None = None, masses: Dict | None = None, volumes: Dict | None = None, concentrations: Dict | None = None, mass_fractions: Dict | None = None, location: str | None = None, solutes: List[str] | None = None, sanity_check: bool | None = True)[source]#
__init__(name: str, total_mass: str | Quantity | None = None, total_volume: str | Quantity | None = None, masses: Dict | None = None, volumes: Dict | None = None, concentrations: Dict | None = None, mass_fractions: Dict | None = None, location: str | None = None, solutes: List[str] | None = None, sanity_check: bool | None = True)[source]#

Initialize a Solution object.

Parameters:
  • name (str) – The name of the solution.

  • total_mass (str or pint.Quantity, optional) – The total mass of the solution.

  • total_volume (str or pint.Quantity, optional) – The total volume of the solution.

  • masses (dict, optional) – A dictionary of component masses.

  • volumes (dict, optional) – A dictionary of component volumes.

  • concentrations (dict, optional) – A dictionary of component concentrations.

  • mass_fractions (dict, optional) – A dictionary of component mass fractions.

  • location (str, optional) – The location of the solution on the robot. Usually a deck location e.g., ‘1A1’.

  • solutes (list of str, optional) – A list of solute names. If set, the components will be initialized as solutes and they won’t contribute to the volume of the solution

  • sanity_check (bool, optional) – Whether to perform a sanity check on the solution.

Raises:

ValueError – If concentrations are set without specifying a component with volume. If mass fractions are set without specifying a component with mass or the total mass.

__hash__()[source]#

Needed so Solutions can be dictionary keys

to_dict()[source]#
add_component(name, solutes: List[str] | None = None)[source]#
set_properties_from_dict(properties=None, inplace=False)[source]#
rename_component(old_name, new_name, inplace=False)[source]#
copy(name=None)[source]#
contains(name: str) bool[source]#
property size#
property solutes#
property solvents#
__eq__(other)[source]#

Compare the mass,volume, and composition of two mixtures

all_components_have_mass()[source]#
property mass: Quantity#

Total mass of mixture.

set_mass(value: str | Quantity)[source]#

Setter for inline mass changes

property volume: Quantity#

Total volume of mixture. Only solvents are included in volume calculation

set_volume(value: str | Quantity)[source]#

Setter for inline volume changes

property solvent_sld: Quantity#
property solvent_density#
property solvent_volume#
property solvent_mass#
property mass_fraction#

Mass fraction of components in mixture

Returns:

  • mass_fraction (dict)

  • Component mass fractions

property volume_fraction#

Volume fraction of solvents in mixture

Returns:

  • solvent_fraction (dict)

  • Component mass fractions

property concentration#
property molarity#
measure_out(amount: str | Quantity, deplete: object = False) Solution[source]#

Create solution with identical composition at new total mass/volume