- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateDecodePlotsScript.py
More file actions
Latest commit
103 lines (79 loc) · 3.24 KB
/
Copy pathGenerateDecodePlotsScript.py
File metadata and controls
103 lines (79 loc) · 3.24 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 5 15:38:09 2019
@author: thugwithyoyo
"""
importnumpyasnp
importpandasaspd
fromPeriEventTraceFuncLibimport*
fromcollectionsimportdefaultdict
importos
importtkinterastk
fromtkinter.filedialogimportaskopenfilename
#RestoreFilePath = SavePath +'.dat'
root=tk.Tk()
RestoreFilePath=askopenfilename()
root.withdraw()
# Open workspace.
#exec(open('./RestoreShelvedWorkspaceScript.py').read())
try:
exec(open('./RestoreShelvedWorkspaceScript.py').read())
except:
print('Unshelving error. Will attempt to continue...')
drive, path_and_file=os.path.splitdrive(RestoreFilePath)
path, file=os.path.split(path_and_file)
FigureTitle=file[0:19]
# Initialize figure
fig1, axs1=plt.subplots()
fig1.suptitle(FigureTitle)
# Plot performance and performance control plots
PlotSpecDict= {'measure': 'performance',
'measure_median': 'performance_median',
# 'measure_bars': 'performance_CLs',
'measure_bars': 'performance_SE_bounds',
'color':'orange'}
GenerateConfIntsPlot(ConfInts, Performance, PlotSpecDict,
axs1, 'fw_sliding')
PlotSpecDict= {'measure': 'performance_median',
'measure_median': 'performance_median',
# 'measure_bars': 'performance_CLs',
'measure_bars': 'performance_SE_bounds',
'color':'gray'}
GenerateConfIntsPlot(EventsShuffled, EventsShuffled, PlotSpecDict,
axs1, 'fw_sliding')
axs1.set_xbound(lower=ParamsDict['BoundaryWindow'][0],
upper=ParamsDict['BoundaryWindow'][1])
axs1.set_ybound(lower=0., upper=1.)
axs1.set_yticks([0., 0.5, 1.])
axs1.set_yticklabels(['0', '50', '100'])
# Save figure
PerfFigSavePath= (path+os.sep+file[0:19] +'_Perf_'+'SW_w'+
str(int(1000.*ParamsDict['WindowWidth'])) +'ms_i'+
str(int(1000.*ParamsDict['StepWidth'])) +'ms.svg')
fig1.savefig(PerfFigSavePath)
# Plot mutual information and mutual information control plots
fig2, axs2=plt.subplots()
fig2.suptitle(FigureTitle)
PlotSpecDict= {'measure': 'mutual_info',
'measure_median': 'mutual_info_median',
# 'measure_bars': 'mutual_info_CLs',
'measure_bars': 'mutual_info_SE_bounds',
'color':'orange'}
GenerateConfIntsPlot(ConfInts, Performance, PlotSpecDict,
axs2, 'fw_sliding')
PlotSpecDict= {'measure': 'mutual_info_median',
'measure_median': 'mutual_info_median',
# 'measure_bars': 'mutual_info_CLs',
'measure_bars': 'mutual_info_SE_bounds',
'color':'gray'}
GenerateConfIntsPlot(EventsShuffled, EventsShuffled, PlotSpecDict,
axs2, 'fw_sliding')
axs2.set_xbound(lower=ParamsDict['BoundaryWindow'][0],
upper=ParamsDict['BoundaryWindow'][1])
axs2.set_ybound(lower=0., upper=1.)
# Save figure
MutInfFigSavePath= (path+os.sep+file[0:19] +'_MutInf_'+'SW_w'+
str(int(1000.*ParamsDict['WindowWidth'])) +'ms_i'+
str(int(1000.*ParamsDict['StepWidth'])) +'ms.svg')
fig2.savefig(MutInfFigSavePath)