-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplotting_functions.py
More file actions
executable file
·47 lines (37 loc) · 1.65 KB
/
plotting_functions.py
File metadata and controls
executable file
·47 lines (37 loc) · 1.65 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
import cbgt as cbgt
from frontendhelpers import *
from tracetype import *
import init_params as par
import popconstruct as popconstruct
import qvalues as qval
import generateepochs as gen
from agentmatrixinit import *
from agent_timestep import timestep_mutator, multitimestep_mutator
import pipeline_creation as pl_creat
import seaborn as sns
import matplotlib.pyplot as plt
figure_dir = "./Figures/"
def rename_columns(results):
results['popdata']['newname'] = results['popdata']['name']+'_'+results['popdata']['action']
new_names = dict()
for i in results['popdata'].index[:-2]:
temp = untrace(results['popdata']['newname'].iloc[i])
#print(type(temp))
if 'LIP' in temp:
temp1 = "Cx_"+temp.split('_')[1]
temp = temp1
new_names[i] = temp
new_names[i+1]='FSI_common'
new_names[i+2]='CxI_common'
results['popfreqs'] = results['popfreqs'].rename(columns=new_names)
return results
def plot_fr(results):
# Plot Population firing rates
results_local = results['popfreqs'].copy()
results_local_melt = results_local.melt("Time (ms)")
results_local_melt["nuclei"] = [ x.split('_')[0] for x in results_local_melt["variable"]]
results_local_melt["channel"] = [ x.split('_')[1] for x in results_local_melt["variable"]]
#print(results_local_melt)
results_local_melt = results_local_melt.rename(columns={"value":"firing_rate"})
g1 = sns.relplot(x="Time (ms)", y ="firing_rate", hue="channel",col="nuclei",data=results_local_melt,col_wrap=3,kind="line",facet_kws={'sharey': False, 'sharex': True})
g1.fig.savefig(figure_dir+'ActualFR.png', dpi=400)