NumpyArray
- class ase2sprkkr.common.grammar_types.data.NumpyArray(dtype=None, *, delimiter=None, written_delimiter=None, shape=None, written_shape=None, items_per_line=None, item_format='% .18e', dtypes=None, trivial_parsing=False, no_newline_at_end=True, prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', lines=None, indented=False, line_length=None, ends_with=None, ends_with_str=None, include_ends_with=False)[source]
Match anything up to the end of the file or to the given delimiter, as numpy array
Class hierarchy
Constructor
- Parameters:
prefix (str | None)
postfix (str | None)
format (str)
after_format (str | None)
default_value (Any)
condition (Callable[[Any], bool | str] | None)
after_convert (Callable[[Any], Any] | None)
ends_with (str | re.Pattern)
- __init__(dtype=None, *, delimiter=None, written_delimiter=None, shape=None, written_shape=None, items_per_line=None, item_format='% .18e', dtypes=None, trivial_parsing=False, no_newline_at_end=True, prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', lines=None, indented=False, line_length=None, ends_with=None, ends_with_str=None, include_ends_with=False)[source]
- Parameters:
delimiter – None - default behavior. int - the number will take given fixed number of chars
written_delimiter – Delimiter used only for writing. By default, use
delimiteror one space when the parsing delimiter is not specified.shape – Resize to given shape after read. A string, callable or
DependentValuederives the shape from other options.written_shape – Resize to given shape before writing
items_per_line – Flatten the array and wrap its output after this many scalar items. If
shapeis dynamic, its value also determines the number of input lines.item_format – Output format of the array (just for writing).
trivial_parsing – Use numpy.fromstring for simple whitespace-delimited numeric data. Requires one explicit integer or floating-point dtype.
dtype – Type of the resulting data. Pass
'line'to get array of whole linesdtypes – More dtypes can be given. Then, the first, that match the data, is used
**kwargs – Any other arguments are passed to the
GrammarType constructorprefix (str | None)
postfix (str | None)
format (str)
after_format (str | None)
default_value (Any)
condition (Callable[[Any], bool | str] | None)
after_convert (Callable[[Any], Any] | None)
ends_with (str | re.Pattern)
- array_access = True
The value of this type can be accessed as array
- validate(value, param_name='<Unknown>', why='set', option=None)[source]
Validate the array and, when possible, its configured shape.
- 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.