astropy.stats.fold_intervals(intervals)[source] [edit on github]

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).

intervals : list of three-element tuples (ai,bi,wi)

The intervals to fold; ai and bi are the limits of the interval, and wi is the weight to apply to the interval.

breaks : array of floats length N

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

weights : array of floats of length N-1

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.