NumpyViewDefinition

class ase2sprkkr.common.generated_configuration_definitions.NumpyViewDefinition(name, data, selector=slice(None, None, None), shape=None, transpose=False, reorder=None, transform_key=None, written_name=None, is_optional=None, is_hidden=False, is_expert=False, experimental=False, name_in_grammar=None, name_format=None, info=None, description=None, name_regex=None, condition=None, write_condition=None, result_class=None, is_repeated=False, repeated_delimiter=None, repeated_count=None, repeated_with_name=None, warning_condition=None, validators=(), plot=None, indent=None, *args)[source]

Values described by this description are possibly reshaped views into a large “raw data array”

Parameters:
  • name – Name of the resulting variable

  • data – The source variable, from which the data are taken

  • selector – The selector, which select the data to be viewed. Any slice or simple numpy index is allowed.

  • shape – The data will be reshaped to given shape. The dimension can be given either by number, or by names of other container variables. E.g. ('NE', 5)

  • transpose – Transpose the source data before returning or indexing. If reorder is given, this settings has no effect.

  • reorder – Reorder the axes after reshaping. Argument is the array of axes order, e.g. (2,0,1) shifts the last axis to be the first.

  • transform_key – Transform function for the keys idnexing the array (e.g. the string name can be transformed to a propper numerical index)

  • plot – PlotInfo object that defines how the results are plotted

  • warning_condition (Callable[[Any], Any] | None)

  • validators (Callable[[Any, Any, str], Any] | Iterable[Callable[[Any, Any, str], Any]] | None)

Class hierarchy

Inheritance diagram of ase2sprkkr.common.generated_configuration_definitions.NumpyViewDefinition


Constructor

__init__(name, data, selector=slice(None, None, None), shape=None, transpose=False, reorder=None, transform_key=None, written_name=None, is_optional=None, is_hidden=False, is_expert=False, experimental=False, name_in_grammar=None, name_format=None, info=None, description=None, name_regex=None, condition=None, write_condition=None, result_class=None, is_repeated=False, repeated_delimiter=None, repeated_count=None, repeated_with_name=None, warning_condition=None, validators=(), plot=None, indent=None, *args)[source]
Parameters:
  • warning_condition (Callable[[Any], Any] | None)

  • validators (Callable[[Any, Any, str], Any] | Iterable[Callable[[Any, Any, str], Any]] | None)

data_description(verbose=False, show_hidden=False, prefix='')[source]
Parameters:
  • verbose (bool | str)

  • prefix (str)

determine_shape(container)[source]

Return the shape of the resulting array, possibly computed using properties of the other values in container.

Parameters:

container (Any)

Return type:

tuple

source(container)[source]

Return the selected source view in container.

Parameters:

container (Any)

Return type:

Any

getter(container, key=None)[source]

Return the complete view or the item selected by key.

Parameters:
  • container (Any)

  • key (Any)

Return type:

Any

setter(container, value, key=slice(None, None, None))[source]

Assign value at key in the mutable source view.

Mutable view writes are deliberately immediate and cannot be rolled back.

Parameters:
  • container (Any)

  • value (Any)

  • key (Any)

Return type:

None

copy_value(value, all_values=False)[source]