trim_nd

trim_nd(tree, selection)[source]

Return an IntervalTree with each dimension trimmed to the specified set of ranges.

The data selection for each dimension is specified as a sequence of (begin, end) tuples; the data selection for the tree as a whole is a sequence of these dimension sequences. For example, the data selection

[ [(1, 3)], [(0, 5), (7, 8)] ]

would select 1-3 from the first dimension and 0-5, and 7 from the second dimension.

Parameters:
  • tree -- the IntervalTree to trim

  • selection -- the sequence of data selections for each dimension

Returns: