Neighborhoods🍋
MaxPerCategoryNeighborhood
🍋
Bases: MinMaxPointsNeighborhood
Min Max Per Category Neighbors model.
Neighborhood based on minimum and maximum number of closest points to be selected and maximum per category.
Parameters:
Name  Type  Description  Default 

dimension 
int

Neighborhood dimensions. 
3

metric 
Optional[Metric]

Metric. 
None

min_n 
int

Minimum number of closest points in ball. 
1

max_n 
int

Maximum number of closest points in ball. 
100

max_per_category 
Optional[int]

Maximum number of neighbors for each category. 
None

category 
Optional[ndarray]

Attribute to determine uniqueness of each category. 
None

Warning
Categories must be defined in consecutive groups, like drillhole.
Attributes:
Name  Type  Description 

dimension 
Neighborhood dimensions. 

metric 
Metric. 

min_n 
Minimum number of closest points in ball. 

max_n 
Maximum number of closest points in ball. 

max_per_category 
Maximum number of neighbors for each category. 

category 
Attribute to determine uniqueness of each category. 
select(points, reference=np.zeros(3))
🍋
Neighborhood selection function.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix where each row is a vector in the Euclidean Space. 
required 
reference 
ndarray

A numpy vector indicating the position (center of the ball). 
zeros(3)

Returns:
Type  Description 

ndarray

This function returns the indices of the N rows of x which are the closest to the vector p according to the distance 
MaxPerOctantNeighborhood
🍋
Bases: MinMaxPointsNeighborhood
Max Per Octant Neighbors model.
Neighborhood based on minimum and maximum number of closest points to be selected in a specified number of octants.
Octant are equal parts of an ellipsoid.
Parameters:
Name  Type  Description  Default 

dimension 
int

Neighborhood dimensions. 
3

metric 
Optional[Metric]

Metric. 
None

min_n 
int

Minimum number of closest points in ball. 
1

max_per_octant 
int

Maximum number of neighbors for each octant. 
15

n_octant 
int

Number of octants dividing the ellipsoid. 
8

Attributes:
Name  Type  Description 

dimension 
Neighborhood dimensions. 

metric 
Metric. 

min_n 
Minimum number of closest points in ball. 

max_per_octant 
Maximum number of neighbors for each octant. 

n_octant 
Number of octants dividing the ellipsoid. 
Warning
Octant must number divisible by 2 in order to have the same amount of octant in the upper and lower part of the ellipsoid.
MinMaxPointsNeighborhood
🍋
Bases: Neighborhood
MimMax Neighbors model.
Parameters:
Name  Type  Description  Default 

dimension 
int

Neighborhood dimension. 
3

metric 
Optional[Metric]

Metric. 
None

min_n 
int

Minimum number of closest points in ball. 
1

max_n 
int

Maximum number of closest points in ball. 
100

Attributes:
Name  Type  Description 

dimension 
Neighborhood dimension. 

metric 
Metric. 

min_n 
Minimum number of closest points in ball. 

max_n 
Maximum number of closest points in ball. 
select(points, reference=np.zeros(3))
🍋
Neighborhood selection function.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix where each row is a vector in the Euclidean Space. 
required 
reference 
ndarray

A numpy vector indicating the position (center of the ball). 
zeros(3)

Returns:
Type  Description 

ndarray

This function returns the indices of the N rows of x which are the closest to the vector p according to the distance. 
Neighborhood
🍋
Bases: Entity
Base class for unique neighborhood. Subclass it to have a custom selection mechanism.
select(points, reference=np.zeros(3))
🍋
Neighborhood selection function.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix where each row is a vector in the Euclidean Space. 
required 
reference 
ndarray

A numpy vector indicating the position (center of the ball). 
zeros(3)

Returns:
Type  Description 

ndarray

This function returns the indices of the N rows of x which are the closest to the vector p according to the distance. 
which_in_ball(points, reference=np.zeros(3), radius=1.0, metric=Metric())
🍋
Function to return the indexes of the points which are in a (closed) ball in the Euclidean space.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix whose rows represent vectors in the Euclidean space. 
required 
reference 
ndarray

Position vector indicating the center of the ball. 
zeros(3)

radius 
float

Radius of the ball. 
1.0

metric 
Metric

A metric object. 
Metric()

Returns:
Type  Description 

ndarray

A numpy arrray containing indices of point x to keep. 
which_nearest_in_ball(points, reference=np.zeros(3), radius=1.0, metric=Metric(), min_n=1, max_n=100)
🍋
Function to obtain the N closest points of a set of points to the center of a ball which are on that ball.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix where each row is a vector in the Euclidean Space. 
required 
reference 
ndarray

A numpy vector indicating the position (center of the ball). 
zeros(3)

radius 
float

Radius of the ball. 
1.0

metric 
Metric

Metric object defining the ball. 
Metric()

min_n 
int

Minimum number of points in the ball to be considered otherwise returns no points. 
1

max_n 
int

Maximum number of points in the ball to be considered (the N closest). 
100

Returns:
Type  Description 

ndarray

A numpy array. This function returns the indices of the N rows of x which are the closest to the vector p according to the distance Metric and which are in the ball of center p and radius r (according to that distance). If there is less points in the ball than N, the indexes of all those points are returned. Points returned are ordered by ascending distance. 
which_nearest_in_ball_with_max_per_category(points, reference=np.zeros(3), radius=1.0, metric=Metric(), min_n=1, max_n=100, max_per_category=None, category=None)
🍋
Function to obtain the N closest points of a set of points to the center of a ball which are on that ball with a maximum per category.
Parameters:
Name  Type  Description  Default 

points 
ndarray

A numpy matrix where each row is a vector in the Euclidean Space. 
required 
reference 
ndarray

A numpy vector indicating the position (center of the ball). 
zeros(3)

radius 
float

Radius of the ball. 
1.0

metric 
Metric

Metric object defining the ball. 
Metric()

min_n 
int

Minimum number of points in the ball to be considered otherwise returns no points. 
1

max_n 
int

Maximum number of points in the ball to be considered (the N closest). 
100

max_per_category 
Optional[int]

Maximum number of neighbors for each category. 
None

category 
Optional[ndarray]

Attribute to determine uniqueness of each category. 
None

Returns:
Type  Description 

ndarray

A numpy array. This function returns the indices of the N rows of x which are the closest to the vector p according to the distance Metric and which are in the ball of center p and radius r (according to that distance). If there is less points in the ball than N, the indexes of all those points are returned. Points returned are ordered by ascending distance. 