def _graphs(self): """ volumetric numpy array, shape (n, v, v), accounting for isolate nodes by unioning the vertices of all component edgelists, sorted in the same order as `self.files`. Returns ------- graphs : np.ndarray, shape (n, v, v), 3D Volumetric numpy array, n vxv adjacency matrices corresponding to each edgelist. graphs[0, :, :] corresponds to files[0].D """ list_of_arrays = import_edgelist(self.files, delimiter=self.delimiter) if not isinstance(list_of_arrays, list): list_of_arrays = [list_of_arrays] return np.atleast_3d(list_of_arrays)
def load_HNU1(ptr=None, return_subid=False): path = Path(MODULE_PATH).parents[1] / "data/raw/HNU1/" f = sorted(path.glob('*.ssv')) df = pd.read_csv(path / "HNU1.csv") subid = [int(fname.stem.split('_')[0].split('-')[1][-5:]) for fname in f] y = np.array([np.unique(df.SEX[df.SUBID == s])[0] - 1 for s in subid]) g = np.array(import_edgelist(f, 'ssv')) if ptr is not None: g = np.array([pass_to_ranks(x) for x in g]) if return_subid: return g, y, subid else: return g, y
def load_BNU1(ptr=None): path = Path(MODULE_PATH).parents[1] / "data/raw/BNU1/" f = sorted(path.glob('*.ssv')) df = pd.read_csv(path / "BNU1_phenotypic_data.csv") subid = [int(fname.stem.split('_')[0].split('-')[1][-5:]) for fname in f] y = np.array([ np.unique(df.SEX[(df.SUBID == s) & (df.SESSION == 'Baseline')])[0] for s in subid ]).astype(int) y -= 1 g = np.array(import_edgelist(f, 'ssv')) if ptr is not None: g = np.array([pass_to_ranks(x) for x in g]) return g, y