Array

class ase2sprkkr.common.grammar_types.arrays.Array(type, default_value=None, length=None, max_length=None, min_length=None, write_length=False, as_list=False, format=None, delimiter=None, **kwargs)[source]

A (numpy) array of values of one type

Class hierarchy

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


Constructor

__init__(type, default_value=None, length=None, max_length=None, min_length=None, write_length=False, as_list=False, format=None, delimiter=None, **kwargs)[source]
Parameters:
  • type – The grammar type of the values in the list (it can be given by a python type)

  • default_value – The default value for the list

  • length – If it is set, the list have to have just this length (it sets min_ and max_length to the length)

  • min_length – The minimal allowed length of the list.

  • max_length – The maximal allowed length of the list.

  • write_length – Write length of the array as the first element.

  • as_list – Type of the value array. True means List, False means np.ndarray, or custom type (e.g. tuple) can be provided. However, the value can be set using tuple or list anyway.

delimiter = Suppress:(<SP><TAB>)
Parameters:

name (Optional[str])

Return type:

ParserElement

delimiter_str = ' '
array_access = True

The value of this type can be accessed as array

_build_grammar()[source]
_do_build_grammar()[source]
_set_convert_action(grammar)[source]
grammar_name()[source]
_string(val)[source]
_validate(value, why='set')[source]
property _dtype_condition[source]
convert(value)[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.

property is_numpy_array
numpy_dtype()[source]
additional_description(prefix)[source]