-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_functionality.py
More file actions
71 lines (58 loc) · 2.91 KB
/
Copy pathbase_functionality.py
File metadata and controls
71 lines (58 loc) · 2.91 KB
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
import platform
import os
import sys
def device_paths(raise_if_nas_missing=True):
which_os = platform.system()
user = os.getlogin()
# print(f"OS: {which_os}, User: {user}")
nas_dir, local_data_dir, project_dir = None, None, None
if which_os == 'Linux' and user == 'houmanjava':
nas_dir = "/mnt/SpatialSequenceLearning/"
local_data_dir = "/home/houmanjava/local_data/"
project_dir = "/home/houmanjava/VirtualReality"
elif which_os == 'Linux' and user == 'vrmaster':
nas_dir = "/mnt/SpatialSequenceLearning/"
local_data_dir = "/home/vrmaster/local_data/"
project_dir = "/home/vrmaster/Projects/VirtualReality/"
elif which_os == 'Linux' and user == 'simon':
nas_dir = "/BMI/VirtualReality/SpatialSequenceLearning/"
local_data_dir = "/home/simon/local_data/"
project_dir = "/home/simon/VirtualReality/"
elif which_os == 'Linux' and user == 'samed':
nas_dir = "/BMI/VirtualReality/SpatialSequenceLearning/"
local_data_dir = "/home/samed/local_data/"
project_dir = "/home/samed/VirtualReality/"
elif which_os == "Darwin" and user == "root":
nas_dir = "/Volumes/large/BMI/VirtualReality/SpatialSequenceLearning/"
folders = [f for f in os.listdir("/Users") if os.path.isdir(os.path.join("/Users", f))]
if "loaloa" in folders:
local_data_dir = "/Users/loaloa/local_data/analysisVR_cache"
project_dir = "/Users/loaloa/homedataAir/phd/ratvr/VirtualReality/"
elif "yaohaotian" in folders:
local_data_dir = "/Users/yaohaotian/Downloads/Study/BME/Research/MasterThesis/code/data/analysisVR_cache"
project_dir = "/Users/yaohaotian/Downloads/Study/BME/Research/MasterThesis/code/"
elif "Sam" in folders:
local_data_dir = "/Users/sam/eth_master/local_data/analysisVR_cache"
project_dir = "/Users/sam/eth_master/VirtualReality/"
else:
raise ValueError(f"Unknown user OS: {which_os}, User: {user}")
else:
raise ValueError("Unknown user. Edit base_functionality.py in "
"baseVR repo to add user-specific paths.")
if not os.path.exists(nas_dir) or os.listdir(nas_dir) == []:
msg = f"NAS directory not found: {nas_dir} - VPN connected?"
print(msg)
if raise_if_nas_missing:
raise FileNotFoundError(msg)
return nas_dir, local_data_dir, project_dir
def init_import_paths():
_, _, project_dir = device_paths()
paths = (project_dir,
os.path.join(project_dir, 'ephysVR'),
os.path.join(project_dir, 'baseVR'),
os.path.join(project_dir, 'analysisVR'))
for p in paths:
if not os.path.exists(p):
print(f"Warning: missing repository: {os.path.basename(p)}. Add to project root dir.")
if p not in sys.path:
sys.path.append(p)