

@data_factory(label='Dendrogram', identifier=is_dendro, priority=1000)
def load_dendro(file):
    '\n    Load a dendrogram saved by the astrodendro package\n\n    :param file: Path to a dendrogram file\n    :returns: A list of 2 glue Data objects: the original dataset, and dendrogram.\n    '
    dg = Dendrogram.load_from(file)
    structs = np.arange(len(dg))
    parent = np.array([(dg[i].parent.idx if (dg[i].parent is not None) else (- 1)) for i in structs])
    height = np.array([dg[i].height for i in structs])
    pk = np.array([dg[i].get_peak(True)[1] for i in structs])
    dendro = Data(parent=parent, height=height, peak=pk, label='Dendrogram')
    im = Data(intensity=dg.data, structure=dg.index_map)
    im.join_on_key(dendro, 'structure', dendro.pixel_component_ids[0])
    return [dendro, im]

dataset/ETHPy150Open glue-viz/glue/glue/plugins/dendro_viewer/data_factory.py load_dendro/original