dimension

class zfit.core.dimension.BaseDimensional[source]

Bases: zfit.core.interfaces.ZfitDimensional

axes

Return the axes.

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

Return the number of observables.

name

Name prepended to all ops created by this model.

obs

Return the observables.

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.

Parameters:spaces (Iterable[Space]) –
Returns:
Return type:Union[None, Space, bool]
Raises: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

Parameters:

spaces (List[Space]) –

Returns:

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

Raises:
  • ValueError – if only one space is given
  • LimitsIncompatibleError – If the limits of one or more spaces (or within a space) overlap
  • LimitsNotSpecifiedError – If the limits for one or more obs but not all are None.
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’]

Parameters:() (spaces) – :py:class:`~zfit.Space`s to extract the obs from
Returns:The observables as str
Return type:List[str]
zfit.core.dimension.get_same_obs[source]
zfit.core.dimension.is_combinable(spaces)[source]
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_.

Parameters:spaces (List[zfit.Space]) –
Returns:
Return type:bool
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.

Parameters:
  • 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.
Returns:

if there are overlapping limits.

Return type:

bool