hikari.utility.interval

Classes

Interval

A class handling [A, B] line segments and numpy operations on them.

Module Contents

class hikari.utility.interval.Interval(left, right)[source]

A class handling [A, B] line segments and numpy operations on them. The following magic methods have been implemented for Interval:

  • creation using Interval(A, B) syntax (if A == B, represents a point)

  • comparison operations with numbers (True if holds for the whole Interval)

  • arithmetic operations, which act element-wise for left and right edge

  • access methods: A == Interval(A, B)[0] == Interval(A, B).left

  • container methods: 5 and 6.2 are in Interval(5, 7), but 7. might not be

left
right
__eq__(other)[source]
__lt__(other)[source]
__gt__(other)[source]
__le__(other)[source]
__ge__(other)[source]
__pos__()[source]
__neg__()[source]
__add__(other)[source]
__sub__(other)[source]
__mul__(other)[source]
__truediv__(other)[source]
__str__()[source]
__repr__()[source]
__iter__()[source]
__getitem__(key)[source]
__setitem__(key, value)[source]
__contains__(item)[source]
__len__()[source]
static _min(item)[source]

Recursively returns minimum of args if possible, otherwise args

static _max(item)[source]

Recursively returns maximum of args if possible, otherwise args

arange(step=1)[source]

Return a 1D-list of values from left to right every step :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of values from left to right (including right) every step :rtype: np.array

comb_with(*others, step=1)[source]

Return combinations of self.arange(step) with every other.arange(step) :param others: interval or iterable of intervals to comb self with :type others: Interval or tuple or list :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of all combinations found in numpy.meshgrid every step :rtype: np.array

mesh_with(*others, step=1)[source]

Return a numpy.mesh of self.arange(step) with every other.arange(step) :param others: interval or iterable of intervals to mesh self with :type others: Interval or tuple or list :param step: spacing between adjacent values, default 1. :type step: int or float :return: array of values meshed by numpy.meshgrid every step :rtype: np.array