NumpyArray
- class ase2sprkkr.common.test.grammar_types.data.NumpyArray(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', *, delimiter=None, shape=None, written_shape=None, item_format='% .18e', dtype=None, no_newline_at_end=True)[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)
- __init__(prefix=None, postfix=None, format='', after_format=None, default_value=None, condition=None, after_convert=None, description='', *, delimiter=None, shape=None, written_shape=None, item_format='% .18e', dtype=None, no_newline_at_end=True)[source]
- Parameters:
delimiter – None - default behavior. int - the number will take given fixed number of chars
shape – Resize to given shape after read
written_shape – Resize to given shape before writing
item_format – Output format of the array (just for writing).
dtype – Type of the resulting data. Pass
'line'
to get array of whole lines**kwargs – Any other arguments are passed to the
GrammarType constructor
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)
- array_access = True
The value of this type can be accessed as array
- _string(value)[source]
Convert the value to the ouput.
The
string()
apply format and do some additional transformation (add prefix, postfix etc.), so the actual way how to convert the value for the output should be here.
- 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.