-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainRDIlab.py
79 lines (63 loc) · 2.38 KB
/
mainRDIlab.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Main program for the RDIgraph analyzer
Created on June 18 2018
@author: Jesús Cid Sueiro
# For profiling: kernprof -lv mainRDIgraph.py ...
"""
import os
import argparse
# Local imports
from rdigraphs.menu_navigator.menu_navigator import MenuNavigator
from rdigraphs.labtaskmanager import LabTaskManager
# ########################
# Main body of application
# ########################
# ####################
# Read input arguments
# settings
parser = argparse.ArgumentParser()
parser.add_argument('--p', type=str, default=None,
help="path to a new or an existing evaluation project")
parser.add_argument('--source', type=str, default='../source_data',
help="path to the source data folder")
args = parser.parse_args()
# Read project_path
project_path = args.p
if args.p is None:
while project_path is None or project_path == "":
project_path = input('-- Write the path to the project to load or '
'create: ')
if os.path.isdir(args.p):
option = 'load'
else:
option = 'create'
active_options = None
query_needed = False
# Create SuperGraph Project
# paths2data stores the path to all source data that might be needed by the
# task manager
paths2data = {'topicmodels': os.path.join(args.source, 'topic_models'),
'agents': os.path.join(args.source, 'agents'),
'ACL_models': os.path.join(args.source, 'ACL_models')}
tm = LabTaskManager(project_path, paths2data)
# ########################
# Prepare user interaction
# ########################
# paths2data stores the path to all folders that might be needed by the
# menu navigator. They may differ from those needed by the task manager
paths2data = {'graphs': os.path.join(project_path, 'graphs'),
'bigraphs': os.path.join(project_path, 'bigraphs'),
'topicmodels': os.path.join(args.source, 'topic_models'),
'agents': os.path.join(args.source, 'agents'),
'ACL_models': os.path.join(args.source,
'ACL_models/models/tm'),
'validation': os.path.join(project_path, 'output', 'validation')}
path2menu = 'lab_menu.yaml'
# ##############
# Call navigator
# ##############
menu = MenuNavigator(tm, path2menu, paths2data)
menu.front_page(title="RDI Graph Analyzer")
menu.navigate(option, active_options)