NumpyViewDefinition

class ase2sprkkr.common.generated_configuration_definitions.NumpyViewDefinition(name, data, selector=slice(None, None, None), shape=None, transpose=False, reorder=None, transform_key=None, plot=None, written_name=None, alternative_names=None, is_optional=False, is_hidden=False, is_expert=False, name_in_grammar=None, info=None, description=None, write_alternative_name=False, condition=None, write_condition=None, result_class=None, warning_condition=None)[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

  • write_alternative_name (bool) –

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, plot=None, written_name=None, alternative_names=None, is_optional=False, is_hidden=False, is_expert=False, name_in_grammar=None, info=None, description=None, write_alternative_name=False, condition=None, write_condition=None, result_class=None, warning_condition=None)[source]
Parameters:
  • name (str) – Name of the value/section

  • written_name (str or None) – Name to write to the input file. Default None means use the name.

  • alternative_names (str or [str]) – Alternative names that can denotes the value. If no written_name is given, the first alternative_names is used for the output. However, contrary to written_name, such way still allow to parse the name during parsing as the name of the value.

  • is_optional (boolean) – If True, this section/value can be missing in the .pot/task file

  • is_hidden (boolean) – Hidden values are not offered to a user, usually they are set by another object (and so a direct setting of their values has no sense)

  • is_expert (boolean) – Expert values/sections are not required and they are somewhat hidden from the user

  • name_in_grammar (boolean or None) – If False, there the name of the variable is not printed in the configuration file. The variable is recognized by its position. If None, the default class value is used

  • info (str) – A short help message for the value/section. It will be the perex for description.

  • description (str) – The additional informations for the users.

  • write_alternative_name (bool) – Wheter use the name or the (first) alternative name in the output.

  • write_condition – If defined, write the value, only if write_condition(the option) is True.

  • condition

    If defined, the condition
    • the condition.parse_condition() is invoked, when a given grammar element should be parsed. If it is False, the element is skipped

    • the condition() is invoked, when the elements of the container is listed to hide the inactive members

  • result_class – Redefine the class that holds data for this option/section.

  • warning_condition – If this lambda returns a non-none during validation, a warning will be issued.

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 the container

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

By default, generated values recieve no enhancement from its definition

copy_value(value, all_values=False)[source]