votesim.utilities.math

Class Summary

NearestManhattanInterpolator(x, y)

Nearest-neighbour interpolation in N dimensions using Manhatten p=1 norm.

Function Summary

ltruncnorm(loc, scale, size[, random_state])

Truncated normal random numbers, cut off at locations less than 0.

vectorized_choice(p, n[, items])

Randomly choose integers

Module Classes

NearestManhattanInterpolator

class votesim.utilities.math.NearestManhattanInterpolator(x, y)

Nearest-neighbour interpolation in N dimensions using Manhatten p=1 norm.

New in version 0.9.

__call_\_
Parameters
  • x ((Npoints, Ndims) ndarray of floats) – Data point coordinates.

  • y ((Npoints,) ndarray of float or complex) – Data values.

Method/Attribute Summary

Module Functions

ltruncnorm

votesim.utilities.math.ltruncnorm(loc, scale, size, random_state=None)

Truncated normal random numbers, cut off at locations less than 0.

Parameters
  • loc (float) – Center coordinate of gaussian distribution

  • scale (float) – Std deviation scale

  • size (int) – Number of random numbers to generate

  • random_state (None or numpy.random.RandomState) – Random number seeding object, or None.

Returns

out – Output samples

Return type

array shaped (size)

vectorized_choice

votesim.utilities.math.vectorized_choice(p, n, items=None)

Randomly choose integers

Parameters
  • p (array) – Weights on choices

  • n (int) – Number of choices

  • items (array) – Choices