class zfit.core.dimension.BaseDimensional[source]

Bases: zfit.core.interfaces.ZfitDimensional

property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

property obs

Return the observables.

abstract property space

Return the Space object that defines the dimensionality of the object.

zfit.core.dimension.add_spaces(spaces: Iterable[zfit.Space])[source]

Add two spaces and merge their limits if possible or return False.


spaces (Iterable[Space]) –


Return type

Union[None, Space, bool]


LimitsIncompatibleError – if limits of the spaces cannot be merged because they overlap

zfit.core.dimension.combine_spaces(spaces: Iterable[zfit.Space])[source]

Combine spaces with different obs and limits to one space.

Checks if the limits in each obs coincide exactly. If this is not the case, the combination is not unambiguous and False is returned


spaces (List[Space]) –


Returns False if the limits don’t coincide in one or more obs. Otherwise

return the Space with all obs from spaces sorted by the order of spaces and with the combined limits.

Return type

zfit.Space or False

zfit.core.dimension.common_obs(spaces: Union[zfit.Space, Iterable[zfit.Space]]) → List[str][source]

Extract the union of obs from spaces in the order of spaces.

For example:
space1.obs: [‘obs1’, ‘obs3’]
space2.obs: [‘obs2’, ‘obs3’, ‘obs1’]
space3.obs: [‘obs2’]

returns [‘obs1’, ‘obs3’, ‘obs2’]


() (spaces) – :py:class:`~zfit.Space`s to extract the obs from


The observables as str

Return type


zfit.core.dimension.limits_consistent(spaces: Iterable[zfit.Space])[source]

Check if space limits are the exact same in each obs they are defined and therefore are compatible.

In this case, if a space has several limits, e.g. from -1 to 1 and from 2 to 3 (all in the same observable), to be consistent with this limits, other limits have to have (in this obs) also the limits from -1 to 1 and from 2 to 3. Only having the limit -1 to 1 _or_ 2 to 3 is considered _not_ consistent.

This function is useful to check if several spaces with different observables can be _combined_.


spaces (List[zfit.Space]) –


Return type


zfit.core.dimension.limits_overlap(spaces: Union[zfit.Space, Iterable[zfit.Space]], allow_exact_match: bool = False) → bool[source]

Check if _any_ of the limits of spaces overlaps with _any_ other of spaces.

This also checks multiple limits within one space. If allow_exact_match is set to true, then an exact overlap of limits is allowed.

  • spaces (Iterable[zfit.Space]) –

  • allow_exact_match (bool) – An exact overlap of two limits is counted as “not overlapping”. Example: limits from -1 to 3 and 4 to 5 to NOT overlap with the limits 4 to 5 iff allow_exact_match is True.


if there are overlapping limits.

Return type