def from_hdf5(cls, hdf5_handle): shape = from_hdf5(hdf5_handle['shape']) dimension = hdf5_handle['dimension'].value try: positions = [tuple(x) for x in hdf5_handle['positions'].value] except AttributeError: positions = from_hdf5(hdf5_handle['positions']) return cls(positions=positions, dimension=dimension, shape=shape)
def from_hdf5(cls, hdf5_handle): try: path_labels = from_hdf5(hdf5_handle['path_labels']) special_points = from_hdf5(hdf5_handle['special_points']) except ValueError: path_labels = _hdf5_utils.nested_list_from_hdf5( hdf5_handle['path_labels']) special_points = _hdf5_utils.dict_from_hdf5( hdf5_handle['special_points']) kpoint_distance = hdf5_handle['kpoint_distance'][()] unit_cell = hdf5_handle['unit_cell'][()] return cls(paths=path_labels, special_points=special_points, kpoint_distance=kpoint_distance, unit_cell=unit_cell)
def from_hdf5(cls, hdf5_handle): """ Derialize the object from the given HDF5 handle. """ graph_group = hdf5_handle['graph'] graph = nx.Graph() graph.add_nodes_from([tuple(n) for n in graph_group['nodes']]) graph.add_edges_from([(tuple(p1), tuple(p2)) for p1, p2 in graph_group['edges']]) degree_count = from_hdf5(hdf5_handle['degree_count']) return cls(graph=graph, degree_count=degree_count)
def from_hdf5(cls, hdf5_handle): return cls(symmetries=from_hdf5(hdf5_handle['symmetries']), full_group=hdf5_handle['full_group'].value)