-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path__init__.py
40 lines (33 loc) · 1.34 KB
/
__init__.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
print('Importing a bunch of stuff, hang tight!')
import os, shutil
# Workaround for scipy altering KeyboardInterrupt behavior
os.environ['FOR_DISABLE_CONSOLE_CTRL_HANDLER'] = '1'
from .Utilities import save
# Set experiment data path
try:
print('Current experiment: %s' %save.get_experiment_data_dir())
except:
pass
print('Use save.set_experiment_data_dir to change experiments')
# Check for remote data server connection
if not os.path.exists(save.get_data_server_path()):
print('''SAMBASHARE not connected. Could not find path %s.''' %save.get_data_server_path())
# Make a setup file. This file contains all desired imports.
setup_path = os.path.join(os.path.dirname(__file__),
'Utilities',
'setup',
save.get_computer_name() + '.py'
)
if not os.path.exists(setup_path):
print('\nSetup file %s created.' %setup_path)
template_path = os.path.join(os.path.dirname(__file__),
'Utilities',
'setup',
'template.py'
)
shutil.copy(template_path, setup_path)
# Run the setup file.
from IPython import get_ipython, display
ip = get_ipython()
if ip: # if we are in an IPython/Jupyter environment
ip.magic('run \"%s\"' %setup_path)