darfix.core.dimension.Dimension#

class darfix.core.dimension.Dimension(kind, name, size=None, _range=None, tolerance=1e-09, unique_values=None)[source]#

Bases: object

Define a dimension used during the dataset

Parameters:
  • kind (str | int) – metadata type in fabioh5 mapping

  • name (str) – name of the dimension (should fit the fabioh5 mapping for now)

  • size (int | None) – length of the dimension.

  • kind

  • name

  • size

  • tolerance (float) –

  • unique_values (Sequence[float] | None) –

static from_dict(_dict)[source]#
Parameters:
  • _dict (dict) – dict defining the dimension. Should contains the following keys: name, kind, size. Unique values are not stored into it because it depends on the metadata and should be obtained from a fit / set_dims

  • _dict

Returns:

Dimension corresponding to the dict given

Return type:

Dimension

property kind#
property name: str#
property range#
set_kind(kind)[source]#
Parameters:

kind (int) –

set_name(name)[source]#
Parameters:

name (str) –

set_range(_range)[source]#
set_size(size)[source]#
Parameters:

size (int) –

set_tolerance(tolerance)[source]#
Parameters:

tolerance (float) –

set_unique_values(values)[source]#

Sets the unique values of the dimension. If the size of the dimension is fixed, it automatically sets the first size values, else it finds the unique values.

Parameters:
  • values (Sequence[float]) – list of values.

  • values

property size: int | None#
to_dict()[source]#

Translate the current Dimension to a dictionary

property tolerance: float#
property unique_values: list[float]#