Miscellaneous

Random number generator

The RNG used internally for random subsets and probability filtering is automatically seeded with a random seed when the module is being imported. To manually set the seed use the init_random function.

catana.init_random(seed=None)

Sets the random seed for the io and decomposition module (used for filtering)

The catana.io and catana.decomposition module contain their own random number generator. Calling this function will initialize both of them and setting the same seed, if seed is not None.

Parameters:seed (unsigned int) – The random seed. If None, will be drawn from a random device.

Function Interpolator

class catana.FunctionInterpolator(self: catana.basictypes.FunctionInterpolator, function: Callable[[float], float], interpolation_points: int, x_min: float, x_max: float) → None

A function sampler and interpolator

Samples the given function with interpolation_points number of equidistantly distributed points between x_min and x_max. When called at a given position, interpolates linearly from the two closest sample points. Note that evaluating the function for values x >= x_max and x < x_min raises a ValueError.

The FunctionInterpolator mainly serves to speed up computations since we do not need to do expensive Python object calls once it is initialized.

Construct a FunctionInterpolator from a function

Parameters:
  • function (callable object) – the function to be sampled and interpolated
  • points (interpolation) – number of points at which the function needs to be sampled
  • x_min (float) – lower boundary of sample points
  • x_max (float) – upper boundary of sample points
__call__(*args, **kwargs)

Overloaded function.

  1. __call__(self: catana.basictypes.FunctionInterpolator, x: float) -> float

Evaluate the FunctionInterpolator at the given value x.

Warning

x must be within the boundaries [x_min, x_max) for which the FunctionInterpolator was set up.

Parameters:x (float) – evaluation point
  1. __call__(self: catana.basictypes.FunctionInterpolator, x: numpy.ndarray[float64]) -> object

Evaluate the FunctionInterpolator at the given values x.

Warning

each element in x must be within the boundaries [x_min, x_max) for which the FunctionInterpolator was set up.

Parameters:x (numpy.ndarray[float]) – evaluation points