darfix.core.dimension.Dimension#

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

Bases: object

Define a dimension used during the dataset

Parameters:
  • kind (Union[int,str]) – metadata type in fabioh5 mapping

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

  • size (Union[int,None]) – length of the dimension.

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

Returns:

Dimension corresponding to the dict given

Return type:

Dimension

property kind#
property name#
property range#
set_kind(kind)[source]#
set_name(name)[source]#
set_range(_range)[source]#
set_size(size)[source]#
set_tolerance(tolerance)[source]#
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 (array_like) – list of values.

property size#
to_dict()[source]#

Translate the current Dimension to a dictionary

property tolerance#
property unique_values#