-
Notifications
You must be signed in to change notification settings - Fork 0
/
___paper_fig16_extracellularActivation_loading.py
53 lines (42 loc) · 1.32 KB
/
___paper_fig16_extracellularActivation_loading.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
import matplotlib.pyplot as plt
import numpy as np
import os
import cPickle as pickle
import Tkinter as tk
import tkFileDialog as filedialog
# doesn't work
# root = tk.Tk()
# root.withdraw()
# filepath = filedialog.askopenfilename()
filepath = 'activationExtracellular/activationPaper1.dict'
saveDict = pickle.load(open(os.path.join(filepath), "rb" ))
RDCs = saveDict['RDCs']
amplitudes = saveDict['amplitudes']
diameters = saveDict['diameters']
activationMatrix = saveDict['activationMatrix']
print 'amplitudes:'
print amplitudes
print 'RDCs:'
print RDCs
print 'diameters:'
print diameters
(f, axarr) = plt.subplots(len(RDCs), 1)
for RDCInd, RDC in enumerate(RDCs):
if isinstance(axarr, np.ndarray):
axis = axarr[RDCInd]
else:
axis = axarr
cax = axis.matshow(activationMatrix[:, RDCInd, :], vmin=0, vmax=np.max(activationMatrix))
print 'RDC %f, sum %f' % (RDC, np.sum(activationMatrix[:, RDCInd, :]))
axis.set_xticks(range(len(amplitudes)))
xTicks = []
for amplitude in amplitudes:
xTicks.append('%4.0f' % amplitude)
axis.set_xticklabels(xTicks)
axis.set_yticks(range(len(diameters)))
axis.set_yticklabels(diameters)
# axis.set_title('RDC = ' + str(RDC))
f.subplots_adjust(right=0.8)
cbar_ax = f.add_axes([0.85, 0.15, 0.05, 0.7])
f.colorbar(cax, cax=cbar_ax)
plt.show()