aim2dat.units

Sub-package containing units and unit conversions. 'eV' and 'angstrom' are set to 1.0 and the unit of time is ansgrom/sqrt(u/eV) per default. However, other units can be set as base:

>>> length = Length(base_unit="m")
>>> length.m
1.0

Submodules

Classes

Constants

Class to access fundamental constants.

UnitConverter

Convert units used in spectroscopy.

Package Contents

class aim2dat.units.Constants(constants: str | dict = 'CODATA_2022')[source]

Class to access fundamental constants.

Overview

Methods

get_unit(name)

Get unit of constant.

get_value(name)

Get value of constant.

get_value_unit(name)

Get value and unit of constant.

get_unit(name: str) str[source]

Get unit of constant.

Parameters:

name (str) – Name of constant.

Returns:

str – Unit of the constant.

get_value(name: str) float[source]

Get value of constant.

Parameters:

name (str) – Name of the constant.

Returns:

float – Value of the constant.

get_value_unit(name: str) tuple[float, str][source]

Get value and unit of constant.

Parameters:

name (str) – Name of constant.

Returns:

tuple – Tuple containing value and unit of constant.

class aim2dat.units.UnitConverter[source]

Bases: _BaseUnitConverter

Convert units used in spectroscopy.

Overview

Methods

convert_units(value, unit_1, unit_2)

class Convert one unit into another.

available_units = []
plot_labels
classmethod convert_units(value: int | float, unit_1: str, unit_2: str) float[source]

Convert one unit into another.

Parameters:
  • value (float) – Input value.

  • unit_1 (str) – Physical unit of the input value.

  • unit_2 (str) – Physical unit to be converted into.

Returns:

processed_data (float) – Output value.