-
Notifications
You must be signed in to change notification settings - Fork 0
/
uoicorr_imports.py
47 lines (35 loc) · 1.15 KB
/
uoicorr_imports.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
# %load uoicorr_imports.py
%load_ext autoreload
%autoreload 2
import h5py
import numpy as np
import matplotlib.pyplot as plt
import sys, os, pdb
if os.name == 'posix':
pass
else:
# Hack to import pyuoi
parent_path, current_dir = os.path.split(os.path.abspath('.'))
while current_dir not in ['nse']:
parent_path, current_dir = os.path.split(parent_path)
p = os.path.join(parent_path, current_dir)
# Add analysis
if p not in sys.path:
sys.path.append(p)
import subprocess
hname = subprocess.check_output('hostname')
if 'ankitnse'.encode() in hname:
if '%s/uoicorr' % p not in sys.path:
sys.path.append('%s/uoicorr' % p)
if '%s/PyUoI' % p not in sys.path:
sys.path.append('%s/PyUoI' % p)
elif os.name == 'posix':
pass
else:
# And standard list of subdirectories
if '%s\\pyuoi' % p not in sys.path:
sys.path.append('%s\\pyuoi' % p)
if '%s\\uoicorr' % p not in sys.path:
sys.path.append('%s\\uoicorr' % p)
from postprocess import postprocess_file, postprocess_dir
from utils import FNR, FPR, selection_accuracy