The base module

The base module contains the Base class.

This class contains essential methods and attributes needed for all other classes.

class base.Base(coordinates=None, distances=None, maxk=None, period=None, verbose=False, n_jobs=2, rng_seed=42)[source]

Base class.

compute_distances(maxk=None, metric='euclidean', period=None, n_jobs=None)[source]

Compute distaces between points up to the maxk nearest neighbour.

Parameters:
  • maxk – maximum number of neighbours for which distance is computed and stored

  • metric – type of metric

  • period (float or np.array) – periodicity (only used for periodic distance computation). Default is None.

remove_identical_points()[source]

Find points that are numerically identical and remove them.

For very large datasets this method might be slow; you might want to use a command like: awk ‘!seen[$0]++’ . See https://unix.stackexchange.com/questions/11939/how-to-get-only-the-unique-results-without-having-to-sort-data for more information

remove_zero_dists(distances)[source]

Find zero neighbour distances and substitute the numerical zeros with a very small number.

This method is mostly useful to regularize the computation of certain id estimators.