EllipsoidDomain#
Module for the Ellipsoid Domain.
- class EllipsoidDomain(ellipsoid_dict, sample_surface=False)[source]
Bases:
BaseDomainImplementation of the ellipsoid domain.
See also
Original reference: Dezert, Jean, and Musso, Christian. An efficient method for generating points uniformly distributed in hyperellipsoids. Proceedings of the Workshop on Estimation, Tracking and Fusion: A Tribute to Yaakov Bar-Shalom. 2001.
- Example:
>>> ellipsoid_domain = EllipsoidDomain({'x':[-1, 1], 'y':[-1, 1]}) >>> ellipsoid_domain = EllipsoidDomain({'x':[-1, 1], 'y':1.0})
Initialization of the
EllipsoidDomainclass.- Parameters:
ellipsoid_dict (dict) – A dictionary where the keys are the variable names and the values are the domain extrema. The domain extrema can be either a list or tuple with two elements or a single number. If the domain extrema is a single number, the variable is fixed to that value.
sample_surface (bool) – If
True, only the surface of the ellipsoid is considered part of the domain. Default isFalse.
- Raises:
ValueError – If
sample_surfaceis not a boolean.TypeError – If the ellipsoid dictionary is not a dictionary.
ValueError – If the ellipsoid dictionary contains variables with invalid ranges.
ValueError – If the ellipsoid dictionary contains values that are neither numbers nor lists/tuples of numbers of length 2.
- compute_center_axes()[source]
Compute centers and axes for the ellipsoid.
- is_inside(point, check_border=False)[source]
Check if a point is inside the ellipsoid.
- Parameters:
point (LabelTensor) – The point to check.
check_border (bool) – If
True, the boundary is considered inside the domain. Default isFalse.
- Raises:
ValueError – If
pointis not aLabelTensor.ValueError – If the labels of
pointdiffer from the variables of the domain.
- Returns:
Whether the point is inside the domain or not.
- Return type:
- update(domain)[source]
Update the current domain by adding the labels contained in
domain. Each new label introduces a new dimension. Only domains of the same type can be used for update.- Parameters:
domain (EllipsoidDomain) – The domain whose labels are to be merged into the current one.
- Raises:
TypeError – If the provided domain is not of an instance of
EllipsoidDomain.- Returns:
A new domain instance with the merged labels.
- Return type:
EllipsoidDomain
- sample(n, mode='random', variables='all')[source]
Sampling routine.
- Parameters:
- Raises:
AssertionError – If
nis not a positive integer.ValueError – If the sampling mode is invalid.
ValueError – If
variablesis neitherall, a string, nor a list/tuple of strings.ValueError – If any of the specified variables is unknown.
- Returns:
The sampled points.
- Return type:
- Example:
>>> ellipsoid_domain = EllipsoidDomain({'x':[0, 1], 'y':[0, 1]}) >>> ellipsoid_domain.sample(n=5) LabelTensor([[0.7174, 0.5319], [0.2713, 0.6518], [0.1020, 0.4093], [0.2102, 0.1353], [0.4830, 0.1873]])
- partial()[source]
Return the boundary of the domain as a new domain object.
- Returns:
The boundary of the domain.
- Return type:
EllipsoidDomain
- property sample_surface
Whether only the surface of the ellipsoid is considered part of the domain.
- Returns:
Trueif only the surface is considered part of the domain,Falseotherwise.- Return type: