def assign_y_coordinates(self, tree_height_scale, max_tree_height):
    tree_height_scale = check_tree_height_scale(tree_height_scale)
    max_tree_height = check_max_tree_height(max_tree_height, (tree_height_scale != 'rank'))
    ts = self.tree.tree_sequence
    node_time = ts.tables.nodes.time
    if (tree_height_scale == 'rank'):
        assert (tree_height_scale == 'rank')
        if (max_tree_height == 'tree'):
            t = (np.zeros_like(node_time) + node_time[self.tree.left_root])
            for u in self.tree.nodes():
                t[u] = node_time[u]
            node_time = t
        depth = {t: (2 * j) for (j, t) in enumerate(np.unique(node_time))}
        node_height = [depth[node_time[u]] for u in range(ts.num_nodes)]
        max_tree_height = max(depth.values())
    else:
        assert (tree_height_scale in ['time', 'log_time'])
        if (max_tree_height == 'tree'):
            max_tree_height = max((self.tree.time(root) for root in self.tree.roots))
        elif (max_tree_height == 'ts'):
            max_tree_height = ts.max_root_time
        if (tree_height_scale == 'log_time'):
            node_height = np.log((ts.tables.nodes.time + 1))
        elif (tree_height_scale == 'time'):
            node_height = node_time
    assert (float(max_tree_height) == max_tree_height)
    if (max_tree_height == 0):
        max_tree_height = 1
    label_padding = 10
    y_padding = (self.treebox_y_offset + (2 * label_padding))
    mutations_over_root = any((any(((tree.parent(mut.node) == NULL) for mut in tree.mutations())) for tree in ts.trees()))
    root_branch_length = 0
    height = self.image_size[1]
    if mutations_over_root:
        root_branch_length = (height / 10)
    padding_numerator = ((height - root_branch_length) - (2 * y_padding))
    if (tree_height_scale == 'log_time'):
        y_scale = (padding_numerator / np.log((max_tree_height + 1)))
    else:
        y_scale = (padding_numerator / max_tree_height)
    self.node_y_coord_map = [((height - (y_scale * node_height[u])) - y_padding) for u in range(ts.num_nodes)]
def assign_y_coordinates(self, tree_height_scale, max_tree_height):
    tree_height_scale = check_tree_height_scale(tree_height_scale)
    max_tree_height = check_max_tree_height(max_tree_height, (tree_height_scale != 'rank'))
    ts = self.tree.tree_sequence
    node_time = ts.tables.nodes.time
    if (tree_height_scale == 'rank'):
        assert (tree_height_scale == 'rank')
        if (max_tree_height == 'tree'):
            t = (np.zeros_like(node_time) + node_time[self.tree.left_root])
            for u in self.tree.nodes():
                t[u] = node_time[u]
            node_time = t
        depth = {t: (2 * j) for (j, t) in enumerate(np.unique(node_time))}
        node_height = [depth[node_time[u]] for u in range(ts.num_nodes)]
        max_tree_height = max(depth.values())
    else:
        assert (tree_height_scale in ['time', 'log_time'])
        if (max_tree_height == 'tree'):
            max_tree_height = max((self.tree.time(root) for root in self.tree.roots))
        elif (max_tree_height == 'ts'):
            max_tree_height = ts.max_root_time
        if (tree_height_scale == 'log_time'):
            node_height = np.log((ts.tables.nodes.time + 1))
        elif (tree_height_scale == 'time'):
            node_height = node_time
    assert (float(max_tree_height) == max_tree_height)
    if (max_tree_height == 0):
        max_tree_height = 1
    label_padding = 10
    y_padding = (self.treebox_y_offset + (2 * label_padding))
    mutations_over_root = any((any(((tree.parent(mut.node) == NULL) for mut in tree.mutations())) for tree in ts.trees()))
    root_branch_length = 0
    height = self.image_size[1]
    if mutations_over_root:
        root_branch_length = (height / 10)
    padding_numerator = ((height - root_branch_length) - (2 * y_padding))
    if (tree_height_scale == 'log_time'):
        y_scale = (padding_numerator / np.log((max_tree_height + 1)))
    else:
        y_scale = (padding_numerator / max_tree_height)
    self.node_y_coord_map = [((height - (y_scale * node_height[u])) - y_padding) for u in range(ts.num_nodes)]