Table

class ase2sprkkr.common.grammar_types.arrays.Table(columns=None, header=None, free_header=False, format={<class 'float'>: '>22.14', None: '>16'}, format_all=True, numbering=None, numbering_label=None, numbering_format=True, free_numbering=False, grouping=False, grouping_label=None, grouping_format=True, prefix=None, postfix=None, length=None, row_condition=None, flatten=False, default_values=False, named_result=None, group_size=None, group_size_format='{:<12}{}', groups_as_list=None, repeat_sparse=None, **kwargs)[source]

Tabular values, optionally with named columns.

For example, an SPR-KKR table may look like:

IQ     IREFQ       IMQ       NOQ  ITOQ  CONC
 1         1         1         1     1 1.000
 2         2         2         1     2 1.000

Class hierarchy

Inheritance diagram of ase2sprkkr.common.grammar_types.arrays.Table


Constructor

Parameters:
__init__(columns=None, header=None, free_header=False, format={<class 'float'>: '>22.14', None: '>16'}, format_all=True, numbering=None, numbering_label=None, numbering_format=True, free_numbering=False, grouping=False, grouping_label=None, grouping_format=True, prefix=None, postfix=None, length=None, row_condition=None, flatten=False, default_values=False, named_result=None, group_size=None, group_size_format='{:<12}{}', groups_as_list=None, repeat_sparse=None, **kwargs)[source]

Configure the table grammar and its storage representation.

Parameters:
  • columns (sequence or mapping, optional) – Column grammar types. A mapping also supplies column names.

  • header (bool, optional) – Whether the input has a header; inferred from column names by default.

  • free_header (bool, optional) – Accept arbitrary text in the header rather than the declared names.

  • format (mapping, optional) – Value formatting used for the individual columns.

  • format_all (bool, optional) – Pass formatting options to all column grammar types.

  • numbering (bool, str or GrammarType, optional) – Add a row-numbering column; a string supplies its heading.

  • numbering_label (str, optional) – Explicit label for the numbering column.

  • numbering_format (str or bool, optional) – Formatting of the numbering column.

  • free_numbering (bool, optional) – Do not require consecutive row numbers in the input.

  • grouping (bool or GrammarType, optional) – Represent the input as groups of rows, with group numbering.

  • grouping_label (str, optional) – Label for the grouping column.

  • grouping_format (str or bool, optional) – Formatting of group numbers.

  • prefix (str, optional) – Text written before or after the table.

  • postfix (str, optional) – Text written before or after the table.

  • length (int, optional) – Expected table length or number of groups.

  • row_condition (callable, optional) – Condition to validate for each row.

  • flatten (bool, optional) – Return a one-dimensional representation for suitable tables.

  • default_values (bool, optional) – Permit column grammar defaults.

  • named_result (bool, optional) – Use a NumPy structured array with named columns; detected if omitted.

  • group_size (str, optional) – Header option specifying the required number of rows in each group.

  • group_size_format (str, optional) – Format for the group-size header.

  • groups_as_list (bool, optional) – Store groups in a list instead of a multidimensional array.

  • repeat_sparse (object, optional) – Define how incomplete rows repeat values from preceding rows.

  • kwargs (mapping) – Column names and grammar types, when columns is omitted.

array_access = True

The value of this type can be accessed as array

name_in_grammar = False

Default value for ValueDefinition.name_in_grammar. Some types (e.g. Tables) commonly have no name (are identified by its position in the potential file) – such type could redefine this class property.

special_columns()[source]
_grammar(param_name=False)[source]
_string(data)[source]
_validate(value, why='set')[source]
convert(value)[source]
property numpy_type[source]
property _numpy_type[source]
number_of_columns()[source]
zero_data(length)[source]

Return array of zeros with the given number of rows and with the dtype of the table

grammar_name()[source]
static is_the_same_value(a, b)

The numpy arrays cannot be compared by =, that’s why this method. However, the method is still far from to be perfect, it can not compare nested numpy arrays.