fold_intervals

astropy.stats.fold_intervals(intervals)[source]

Fold the weighted intervals to the interval (0,1).

Convert a list of intervals (ai, bi, wi) to a list of non-overlapping intervals covering (0,1). Each output interval has a weight equal to the sum of the wis of all the intervals that include it. All intervals are interpreted modulo 1, and weights are accumulated counting multiplicity. This is appropriate, for example, if you have one or more blocks of observation and you want to determine how much observation time was spent on different parts of a system’s orbit (the blocks should be converted to units of the orbital period first).

Parameters:
intervalspython:list of (3,) python:tuple

For each tuple (ai,bi,wi); ai and bi are the limits of the interval, and wi is the weight to apply to the interval.

Returns:
breaks(N,) array of python:float

The endpoints of a set of intervals covering [0,1]; breaks[0]=0 and breaks[-1] = 1

weights(N-1,) array of python:float

The ith element is the sum of number of times the interval breaks[i],breaks[i+1] is included in each interval times the weight associated with that interval.