def _construct_mass_map(self, ix, start_pile, interval,
                            horizontal_spacing):

        size = float(len(self.nodes[ix].members))

        ## get children
        children = _np.array(self.nodes[ix].children)
        n_child = len(children)

        ## if there's no children, just one segment at the interval mean
        if n_child == 0:
            xpos = _np.mean(interval)
            end_pile = start_pile + size / len(self.density)
            segments = {}
            segmap = [ix]
            splits = {}
            splitmap = []
            segments[ix] = ([xpos, start_pile], [xpos, end_pile])

        else:
            parent_range = interval[1] - interval[0]
            segments = {}
            segmap = [ix]
            splits = {}
            splitmap = []

            census = _np.array([len(self.nodes[x].members) for x in children],
                               dtype=_np.float)
            weights = census / sum(census)

            seniority = _np.argsort(weights)[::-1]
            children = children[seniority]
            weights = weights[seniority]

            ## get relative branch intervals
            if horizontal_spacing == 'proportional':
                child_intervals = _np.cumsum(weights)
                child_intervals = _np.insert(child_intervals, 0, 0.0)
            else:
                child_intervals = _np.linspace(0.0, 1.0, n_child + 1)

            ## find height of the branch
            end_pile = start_pile + (size - sum(census)) / len(self.density)

            ## loop over the children
            for j, child in enumerate(children):

                ## translate local interval to absolute interval
                branch_interval = (
                    interval[0] + child_intervals[j] * parent_range,
                    interval[0] + child_intervals[j + 1] * parent_range)

                ## recurse on the child
                branch = self._construct_mass_map(child, end_pile,
                                                  branch_interval,
                                                  horizontal_spacing)
                branch_segs, branch_splits, branch_segmap, \
                    branch_splitmap = branch

                segmap += branch_segmap
                splitmap += branch_splitmap
                splits = dict(splits.items() + branch_splits.items())
                segments = dict(segments.items() + branch_segs.items())

            ## find the middle of the children's x-position and make vertical
            ## segment ix
            children_xpos = _np.array([segments[k][0][0] for k in children])
            xpos = _np.mean(children_xpos)

            ## add horizontal segments to the list
            for child in children:
                splitmap.append(child)
                child_xpos = segments[child][0][0]
                splits[child] = ([xpos, end_pile], [child_xpos, end_pile])

            ## add vertical segment for current node
            segments[ix] = ([xpos, start_pile], [xpos, end_pile])

        return segments, splits, segmap, splitmap
Returns delta if datetime values are within a time period.
dataset/ETHPy150Open CoAxLab/DeBaCl/debacl/level_set_tree.py/LevelSetTree._construct_mass_map--crossover with--dataset/ETHPy150Open google/simian/src/simian/mac/cron/reports_cache.py/IsTimeDelta