Tools for working with intervals and dyadic segmentation in Python.
For now, the only way to install this package is to download from GitHub and build from source. This can be done using pip.
python3 -m pip install git+https://github.com/datasig-ac-uk/pysegments.git
The segment
function in this module can be used to perform dyadic segmentation of a base interval to isolate the parts of this interval for which a characteristic function return true. These "parts" are generated by partitioning the base interval into dyadic intervals of given length, and then removing those dyadic intervals on which the characteristic function is not constantly 1. A simple example of its use is as follows.
from pysegments import Interval, segment
def char_function(interval):
return interval.inf >= 0.3 and interval.sup <= 0.752
base = Interval(-5, 5)
segments = segment(base, char_function, 2)
# segments = [Interval(0.50000, 0.750000)]