-
Notifications
You must be signed in to change notification settings - Fork 3
/
__init__.py
105 lines (83 loc) · 2.84 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#%% Setup for google colab
import sys
import os
from time import sleep as _sleep
if 'google.colab' in sys.modules:
#MDAnalysis setup
cont=True
install=True
count=0
while cont:
try:
import MDAnalysis as _
cont=False
except:
if install:
os.popen('pip3 install MDAnalysis')
install=False
else:
_sleep(2)
count+=1
if count==60:
cont=False
print('Timeout on MDAnalysis installation (2 minutes)')
# NGLviewer setup
try:
import nglview as _
except:
os.popen('pip install -q nglview')
from google.colab import output as _
_.enable_custom_widget_manager()
#%% Init file for all of pyDR
clsDict=dict()
from pyDR.Defaults import Defaults
from pyDR import Selection
from pyDR.Selection.MolSys import MolSys,MolSelect
#from pyDR import FRET
from pyDR.Data import Data,Plotting
from pyDR import Fitting
from pyDR import MDtools
from pyDR import Sens
from pyDR.misc.tools import tools
import sys as _sys
if 'MDAnalysis' in _sys.modules:
from pyDR import Frames
else:
print('MDAnalysis not available, MD processing will not be possible')
from pyDR import IO
from pyDR.iRED.iRED import iRED, Data_iRED
if 'MDAnalysis' in _sys.modules:
from pyDR.Frames.eval_fr import md2data,md2iRED
from pyDR.chimeraX.CMXRemote import CMXRemote
from pyDR.chimeraX.Movies import Movies
from pyDR.Project import Project,Source
from pyDR.Entropy import EntropyCC
clsDict.update({'Data':Data,'Data_iRED':Data_iRED,'Source':Source,'Info':Sens.Info,
'Sens':Sens.Sens,'Detector':Sens.Detector,'NMR':Sens.NMR,'MD':Sens.MD,'SolnNMR':Sens.SolnNMR,
'MolSys':MolSys,'MolSelect':MolSelect,'Project':Project,
'FrameObj':Frames.FrameObj,'Ctcalc':MDtools.Ctcalc,
'DataPlots':Plotting.DataPlots,'CMXRemote':CMXRemote,'Movies':Movies,
'EntropyCC':EntropyCC})
from pyDR import PCA
#%% Edit matlabplot subplotspec behavior to be consistent across versions
from matplotlib.axes import Subplot as _Subplot
from matplotlib.gridspec import SubplotSpec as _SubplotSpec
if hasattr(_SubplotSpec,'is_first_col'):
def _fun(self):
return self.get_subplotspec().is_first_col()
_Subplot.is_first_col=_fun
def _fun(self):
return self.get_subplotspec().is_first_row()
_Subplot.is_first_row=_fun
def _fun(self):
return self.get_subplotspec().is_last_col()
_Subplot.is_last_col=_fun
def _fun(self):
return self.get_subplotspec().is_last_row()
_Subplot.is_last_row=_fun
#%% Warning handling
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
warnings.filterwarnings('ignore', module='MDAnalysis')