-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
60 lines (46 loc) · 1.72 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
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 16 15:22:04 2021
This is the global configuration file that stores user-specific information.
The datadirectory should be indicated here.
@author: Simon Kern
"""
import os
import getpass
import platform
import hashlib
def md5hash(array):
if isinstance(array, str):
xbytes = array.encode()
else:
xbytes = array.tobytes()
return hashlib.shake_256(xbytes).hexdigest(5)
def stim2desc(string):
if not isinstance(string, str):
string = str(string)
num = string.split('/')[-1]
scene_cat, typ, behaviour, memory = num
convd = {0: {1: 'man-made', 2:'natural'},
1: {0: 'new', 1:'old'},
2: {1: 'hit', 2:'miss', 3:'false-alarm',
4:'correct-rejection', 9: 'N/A'},
3: {0: 'remembered', 1: 'forgotten', 9:'N/A'}}
desc = [convd[i][int(n)] for i, n in enumerate(num)]
return '/'.join(desc)
###############################
###USER SPECIFIC CONFIGURATION
###############################
username = getpass.getuser().lower() # your login name
host = platform.node().lower() # the name of this computer
system = platform.system().lower() # linux, windows or mac.
home = os.path.expanduser('~')
cache_dir = None
if username == 'simon' and md5hash(host)=='245f2c5750':
data_dir = 'z:/EEGManyPipelines/'
cache_dir = 'z:/cache/'
elif username == 'simon.kern' and md5hash(host)=='a994e83fa0':
data_dir = '/data/Simon/EEGManyPipelines/'
cache_dir = '/data/Simon/joblib-cache/eegmanypipeliens/'
else:
print('Username {} on host {} with {} has no configuration.\n'.format(username,host,system) + \
'please set user specific information in config.py')