Minimal data object example

class h2tools.minimal_data.MinimalData

Minimal set of methods for any data object to work with h2tools.

If it is used as base class for class of data objects, it checks if all necessary functions are presented in the time of initialization of data object.

__len__()

Returns number of objects or items in cluster.

check_far(self_aux, other_aux)

Checks if clusters are far from each other by auxiliary data.

Auxiliary data can be anything, i.e. bounding box. This function must be symmetric (transitive to parameters self_aux and other_aux).

Parameters:

self_aux, other_aux : Python objects

Auxiliary data for two clusters.

Returns:

boolean

True if clusters are far, False otherwise.

compute_aux(index)

Computes auxiliary data for cluster, corresponding to index.

Simplest example of such an auxiliary data is bounding box.

Parameters:

index : 1-dimensional array

Indices of objects in initial cluster, corresponding to given subcluster.

Returns:

Python object

Some auxiliary data.

divide(index)

Divides cluster, corresponding to index.

Parameters:

index : 1-dimensional array

Indices of objects in initial cluster, corresponding to given subcluster.

Returns:

permutation : 1-dimensional array

How to permute indices of given cluster, such that indices of new subclusters are successive.

division : list

Indices of i-th subcluster take places from division[i] inclusively to division[i+1] exclusively.

Notes

Length of resulting division equals number of sublcusters plus 1. Simple example: division = [0, 1, 3, 5, 10] means cluster was divided into 4 subclusters, first subclusters has only 1 item, second subcluster has 2 items, third subcluster has 2 items and last subcluster has 5 items.