zfit.dimension.
Coordinates
Bases: zfit.core.interfaces.ZfitOrderableDimensional
zfit.core.interfaces.ZfitOrderableDimensional
obs
Return the observables, string identifier for the coordinate system.
Optional[Tuple[str, …]]
Optional
Tuple
str
axes
Return the axes, integer based identifier(indices) for the coordinate system.
Optional[Tuple[int]]
int
n_obs
Return the number of observables, the dimensionality. Corresponds to the last dimension.
with_obs
Create a new instance that has obs; sorted by or set or dropped.
The behavior is as follows:
obs are already set: input obs are None: the observables will be dropped. If no axes are set, an error will be raised, as no coordinates will be assigned to this instance anymore. input obs are not None: the instance will be sorted by the incoming obs. If axes or other objects have an associated order (e.g. data, limits,…), they will be reordered as well. If a strict subset is given (and allow_subset is True), only a subset will be returned. This can be used to take a subspace of limits, data etc. If a strict superset is given (and allow_superset is True), the obs will be sorted accordingly as if the obs not contained in the instances obs were not in the input obs. obs are not set: if the input obs are None, the same object is returned. if the input obs are not None, they will be set as-is and now correspond to the already existing axes in the object.
obs are already set:
input obs are None: the observables will be dropped. If no axes are set, an error will be raised, as no coordinates will be assigned to this instance anymore.
input obs are not None: the instance will be sorted by the incoming obs. If axes or other objects have an associated order (e.g. data, limits,…), they will be reordered as well. If a strict subset is given (and allow_subset is True), only a subset will be returned. This can be used to take a subspace of limits, data etc. If a strict superset is given (and allow_superset is True), the obs will be sorted accordingly as if the obs not contained in the instances obs were not in the input obs.
obs are not set:
if the input obs are None, the same object is returned.
if the input obs are not None, they will be set as-is and now correspond to the already existing axes in the object.
obs (Union[str, Iterable[str], ForwardRef, None]) – Observables to sort/associate this instance with
Union
Iterable
ForwardRef
None
allow_superset (bool) – if False and a strict superset of the own observables is given, an error
bool
raised. (is) –
allow_subset (bool) – if False and a strict subset of the own observables is given, an error
raised. –
A copy of the object with the new ordering/observables
CoordinatesUnderdefinedError – if obs is None and the instance does not have axes
ObsIncompatibleError – if obs is a superset and allow_superset is False or a subset and allow_allow_subset is False
with_axes
Create a new instance that has axes; sorted by or set or dropped.
axes are already set: input axes are None: the axes will be dropped. If no observables are set, an error will be raised, as no coordinates will be assigned to this instance anymore. input axes are not None: the instance will be sorted by the incoming axes. If obs or other objects have an associated order (e.g. data, limits,…), they will be reordered as well. If a strict subset is given (and allow_subset is True), only a subset will be returned. This can be used to retrieve a subspace of limits, data etc. If a strict superset is given (and allow_superset is True), the axes will be sorted accordingly as if the axes not contained in the instances axes were not present in the input axes. axes are not set: if the input axes are None, the same object is returned. if the input axes are not None, they will be set as-is and now correspond to the already existing obs in the object.
axes are already set:
input axes are None: the axes will be dropped. If no observables are set, an error will be raised, as no coordinates will be assigned to this instance anymore.
input axes are not None: the instance will be sorted by the incoming axes. If obs or other objects have an associated order (e.g. data, limits,…), they will be reordered as well. If a strict subset is given (and allow_subset is True), only a subset will be returned. This can be used to retrieve a subspace of limits, data etc. If a strict superset is given (and allow_superset is True), the axes will be sorted accordingly as if the axes not contained in the instances axes were not present in the input axes.
axes are not set:
if the input axes are None, the same object is returned.
if the input axes are not None, they will be set as-is and now correspond to the already existing obs in the object.
axes (Union[int, Iterable[int], None]) – Axes to sort/associate this instance with
allow_superset (bool) – if False and a strict superset of the own axeservables is given, an error
allow_subset (bool) – if False and a strict subset of the own axeservables is given, an error
A copy of the object with the new ordering/axes
AxesIncompatibleError – if axes is a superset and allow_superset is False or a subset and allow_allow_subset is False
with_autofill_axes
Overwrite the axes of the current object with axes corresponding to range(len(n_obs)).
This effectively fills with (0, 1, 2,…) and can be used mostly when an object enters a PDF or similar. overwrite allows to remove the axis first in case there are already some set.
object.obs -> ('x', 'z', 'y') object.axes -> None object.with_autofill_axes() object.obs -> ('x', 'z', 'y') object.axes -> (0, 1, 2)
overwrite (bool) – If axes are already set, replace the axes with the autofilled ones. If axes is already set and overwrite is False, raise an error.
ZfitOrderableDimensional
The object with the new axes
AxesIncompatibleError – if the axes are already set and overwrite is False.
get_reorder_indices
Indices that would order the instances obs as obs respectively the instances axes as axes.
obs (Union[str, Iterable[str], ForwardRef]) – Observables that the instances obs should be ordered to. Does not reorder, but just return the indices that could be used to reorder.
axes (Union[int, Iterable[int]]) – Axes that the instances obs should be ordered to. Does not reorder, but just return the indices that could be used to reorder.
Tuple[int]
New indices that would reorder the instances obs to be obs respectively axes.
CoordinatesUnderdefinedError – If neither obs nor axes is given
reorder_x
Reorder x in the last dimension either according to its own obs or assuming a function ordered with func_obs.
There are two obs or axes around: the one associated with this Coordinate object and the one associated with x. If x_obs or x_axes is given, then this is assumed to be the obs resp. the axes of x and x will be reordered according to self.obs resp. self.axes.
If func_obs resp. func_axes is given, then x is assumed to have self.obs resp. self.axes and will be reordered to align with a function ordered with func_obs resp. func_axes.
Switching func_obs for x_obs resp. func_axes for x_axes inverts the reordering of x.
x (Union[Tensor, ndarray]) – Tensor to be reordered, last dimension should be n_obs resp. n_axes
Tensor
ndarray
x_obs (Union[str, Iterable[str], ForwardRef]) – Observables associated with x. If both, x_obs and x_axes are given, this has precedency over the latter.
x_axes (Union[int, Iterable[int]]) – Axes associated with x.
func_obs (Union[str, Iterable[str], ForwardRef]) – Observables associated with a function that x will be given to. Reorders x accordingly and assumes self.obs to be the obs of x. If both, func_obs and func_axes are given, this has precedency over the latter.
func_axes (Union[int, Iterable[int]]) – Axe associated with a function that x will be given to. Reorders x accordingly and assumes self.axes to be the axes of x.
Union[ndarray, Tensor]
The reordered array-like object