Setting#

class Setting(parameter, value)#

Bases: object

Physical quantity represented as a Parameter attached to a numerical value.

Module: exa.common.data.parameter

Attributes

element_indices

Element-wise indices of the parameter in self.

label

Label used as pretty identifier for display purposes, same as label of parameter.

name

Name used as identifier, same as name of parameter.

parent_label

Parent label of the parameter of self.

parent_name

Parent name of the parameter of self.

unit

SI unit of the value, if applicable, same as unit of parameter.

parameter

The parameter this Setting represents.

value

Data value attached to the parameter.

Methods

copy

create_element_parameter_for

Utility for creating an element-wise parameter for a single value in a collection valued parameter.

diff_sets

Return a one-sided difference between two sets of Settings, prioritising values in first.

get_by_name

merge

remove_by_name

replace

update

Create a new setting object with updated value.

Parameters:
parameter: Parameter#

The parameter this Setting represents.

value: Any#

Data value attached to the parameter.

update(value)#

Create a new setting object with updated value.

Parameters:

value (Any) –

Return type:

Setting

property name#

Name used as identifier, same as name of parameter.

property parent_name#

Parent name of the parameter of self.

property label#

Label used as pretty identifier for display purposes, same as label of parameter.

property parent_label#

Parent label of the parameter of self.

property unit#

SI unit of the value, if applicable, same as unit of parameter.

property element_indices: tuple[int, ...] | None#

Element-wise indices of the parameter in self.

static diff_sets(first, second)#

Return a one-sided difference between two sets of Settings, prioritising values in first.

Parameters:
  • first (Set[Setting]) – Set whose values will be in the resulting diff.

  • second (Set[Setting]) – Set that is compared to first.

Returns:

A new set of Settings whose parameters are only found in first, and Settings in first whose values differ from their counterparts in second.

Return type:

Set[Setting]

create_element_parameter_for(indices)#

Utility for creating an element-wise parameter for a single value in a collection valued parameter.

Parameters:

indices (int | list[int]) – The indices in the collection for which to create the element-wise parameter.

Returns:

The element-wise parameter.

Raises:

ValueError – If self is not collection-valued.

Return type:

Parameter