-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
65 lines (58 loc) · 2.14 KB
/
config.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
"""Project config file."""
import os
from utils import py_utils
class Config:
"""Config class with global project variables."""
def __init__(self, **kwargs):
"""Global config file for normalization experiments."""
self.data_root = '/media/data_cifs/image_datasets/'
self.project_directory = '/media/data_cifs/contextual_circuit/'
self.tf_records = os.path.join(
self.project_directory,
'tf_records')
self.checkpoints = os.path.join(
self.project_directory,
'checkpoints')
self.summaries = os.path.join(
self.project_directory,
'summaries')
self.experiment_evaluations = os.path.join(
self.project_directory,
'experiment_evaluations')
self.condition_evaluations = os.path.join(
self.project_directory,
'condition_evaluations')
self.visualizations = os.path.join(
self.project_directory,
'visualizations')
self.plots = os.path.join(
self.project_directory,
'plots')
self.results = 'results'
self.log_dir = os.path.join(self.project_directory, 'logs')
self.dataset_info = 'dataset_processing' # local dataset classes
# DB
self.db_ssh_forward = False
machine_name = os.uname()[1]
if len(machine_name) == 12 or (
'serre' in machine_name and machine_name != 'serrep3'):
# Docker container or master p-node
self.db_ssh_forward = True
# Create directories if they do not exist
check_dirs = [
self.tf_records,
self.checkpoints,
self.experiment_evaluations,
self.condition_evaluations,
self.visualizations,
self.plots,
self.log_dir,
self.dataset_info
]
[py_utils.make_dir(x) for x in check_dirs]
def __getitem__(self, name):
"""Get item from class."""
return getattr(self, name)
def __contains__(self, name):
"""Check if class contains field."""
return hasattr(self, name)