-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlamina_preprocessing.py
executable file
·45 lines (37 loc) · 1.19 KB
/
lamina_preprocessing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
import argparse
from pprint import pprint
import os.path
from glob import glob
from cx_analysis.config import parse_cfg_file
from cx_analysis.connectome import Connectome
from cx_analysis.utils import load_preprocessed_connectome
def main():
analysis_dir = handle_args().cfg_path
cfg = parse_cfg_file(analysis_dir)
if len(glob(os.path.join(analysis_dir, "*preprocessed.pickle"))) == 0:
C = Connectome(cfg)
if cfg.save:
C.save_connectome()
else:
print(f"Preprocessed connectome data found at: {analysis_dir}. "
f"Use an empty directory to preform a new fetch")
C = load_preprocessed_connectome(cfg.out_dir)
C.save_linkdf()
C.save_cxdf()
'''
C.save_linkdf(cfg.out_dir)
C.save_cxdf()
'''
print(C.adj_mat[0])
# Do anything else with C
def handle_args():
ap = argparse.ArgumentParser()
ap.add_argument("cfg_path", help="Path to .json containing configurations", type=str)
a = ap.parse_args()
a.cfg_path = os.path.expanduser(a.cfg_path)
if not os.path.exists(a.cfg_path):
raise Exception(f'Directory not found: {a.cfg_path}')
else:
return a
main()