teflow.loader module

teflow.loader.AtomicWeight

A constant namedtuple storing atomic weights in AMU (from pymatgen). This namedtuple can be utilized wherever regular tuples are employed, and it adds the capability to access fields by element name in addition to position index. Furthermore, a placeholder is stored at index 0 to align tuple indices with atomic numbers.

示例

>>> print(AtomicWeight.Ne)
20.1797
>>> print(AtomicWeight[10])
20.1797
>>> print(getattr(AtomicWeight, 'Ne'))
20.1797
class teflow.loader.Compound

基类:AttrDict

Represents the chemical composition of a compound using an ordered dictionary.

classmethod from_string(formula: str)

Instance construction from a chemical formula.

property natom

The total number of atoms in the compound. Returns a rounded integer if it is within a 1E-8 tolerance of an integer, otherwise the original exact float.

Type:

int or float

to_string(fmt='%.9g', style='join', ignore=('1',))

Generates a string representation of the compound, with support for ‘join’ (default), ‘split’, and ‘originlab’ styles at present.

property weight_ave

Average atomic weight of the compound.

Type:

float

property weights

A dictionary mapping elements to atomic weights.

Type:

AttrDict

class teflow.loader.TEdatacol(data, group)

基类:TEdataset

Inherits from TEdataset, disregarding the temperature dependence of material properties. Instead, treats the temperature data column as a regular material property, and returns the property itself when accessed.

get(key, default=<object object>)

Fetches a material property. Raises ValueError for any property that cannot be fetched if default is not set.

class teflow.loader.TEdataset(data, group)

基类:Mapping

A read-only, dict-like interface class for managing thermoelectric data (in fact, it is inherited from collections.abc.Mapping). It primarily facilitates the conversion between various electrical conductivity-related physical quantities, such as electrical conductivity, resistivity, carrier concentration, and mobility, based on the quantitative conversion relationships: C = 10^4 / R = 1.602176634 * N * U. Here, C is the conductivity in S/cm, R is the resistivity in uOhm.m, N is the carrier concentration in 10^19 cm^(-3), and U is the mobility in cm^2/(V.s). The identifiers for these properties can be customized (refer to Notes for details). After initialization, properties can be accessed directly using ‘[]’ or the get() method, similar to a built-in dict object. The class also offers gget() method for batch retrieval of multiple properties. Note that get() method may compute and return derived properties, in contrast to ‘[]’ which strictly returns original data. A conventional set of symbols are:

Prop.

Description

Unit

T

Temperature

K

S

Seebeck coefficient

uV/K

C

Electrical conductivity

S/cm

R

Electrical resistivity

uOhm.m

K

Thermal conductivity

W/(m.K)

N

Carrier concentration

1E19 cm^(-3)

U

Mobility

cm^2/(V.s)

L

Lorenz number

1E-8 W.Ohm/K^2

X

<Placeholder>

Additionally, a significant feature of this class is handling the temperature dependency of material properties. The class pairs each material property with a corresponding temperature, returning both temperature and property when accessed.

参数:
  • data (list) – A list of thermoelectric data, where each item represents a property and is converted to a numpy.ndarray object during initialization. It can also be a numpy.ndarray, which will be treated as a regular iterable. For instance, in the case of a two-dimensional array, each row represents a distinct property.

  • group (list or str) – Specifies the identifiers for each item in data. This can be a list or a string (strings are automatically parsed using the parse_group() method). The pairing of group and data behaves similarly to the built-in zip function, ceasing iteration when the shorter of the two is fully iterated. The default parse_group() method utilizes the regular expression r’[A-Z][a-z0-9_]?’ (i.e. PATTERN attribute) to match each identifier. This method can be overridden to change the parsing behavior.

备注

The default identifiers for electrical conductivity, resistivity, carrier concentration, and mobility are C, R, N, and U, respectively. To alter this default setting, override the CONDALIAS attribute before initialization. It is a 4-element tuple containing the identifiers for the aforementioned properties in the specified order. During initialization, these identifiers are bound to four corresponding methods (_getC, _getR, _getN, _getU). To modify the specific conversion strategies, you can override these methods according to your requirements.

CONDALIAS = ('C', 'R', 'N', 'U')
IGNORED = {'X'}
PATTERN = '[A-Z][a-z0-9_]?'
TEMPSYMBOL = 'T'
classmethod from_file(filename, group, delimiter=None)

Construct the object or parse data directly from a file.

参数:
  • filename (str) – The name of the file containing the data.

  • group (list or str) – Identifiers for each data item, passed directly to the initializer. Refer to initializer documentation for more details.

  • delimiter (str, optional) – The delimiter used in the file. Default is None, any consecutive whitespaces act as delimiter.

返回:

An instance of this class.

返回类型:

object

get(key, default=<object object>)

Fetches a paired (temperature, property). Raises ValueError for any property that cannot be fetched if default is not set.

gget(group, default=<object object>)

Batch fetch specified properties from group using get(), and return a list.

classmethod parse_group(group)

Parse group into identifiers based on PATTERN attribute.

teflow.loader.parseCTA(text: str)
teflow.loader.parseLFA(text: str)
teflow.loader.parseZEM(text: str)