Skip to content

Commit

Permalink
fixing limits
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpiet committed Feb 23, 2023
1 parent 29d5305 commit 18efb1f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
29 changes: 10 additions & 19 deletions visual_behavior_glm/GLM_perturbation_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,6 @@ def get_points(df,ellipse=True):
y=y+this_y
return np.array([x,y]).T

def get_ellipse_points(df):
plt.figure()
for index, row in df.iterrows():
plt.plot(row.x,row.y,'ro')
plt.plot([row.x1,row.x2],[row.y,row.y],'r-')
plt.plot([row.x,row.x],[row.y1,row.y2],'r-')
r1 = (row.x2-row.x1)/2
r2 = (row.y2-row.y1)/2
n=20
xpoints = [
r1*np.cos(theta)+row.x
for theta in (np.pi*2 * i/n for i in range(n))
]
ypoints = [
r2*np.sin(theta)+row.y
for theta in (np.pi*2 * i/n for i in range(n))
]
plt.plot(xpoints, ypoints, 'b-')
def demonstrate_iterative_ch(Fvisual,kernel='omissions',show_steps=True,
x='Slc17a7-IRES2-Cre',y='y'):
'''
Expand Down Expand Up @@ -393,6 +375,15 @@ def plot_multiple(weights_df, run_params,savefig=False):
def plot_perturbation(weights_df, run_params, kernel,experience_level="Familiar",
savefig=False,lims = None,show_steps=False,ax=None,col1=False,row1=False,multi=False,
x = 'Slc17a7-IRES2-Cre',y='Vip-IRES-Cre'):

limit_list = {
'Slc17a7-IRES2-Cre':[-.0005,0.002],
'Sst-IRES-Cre':[-0.006,0.0125],
'Vip-IRES-Cre':[-0.005,0.025],
'y':[0,0.01],
}
lims=[limit_list[x], limit_list[y]]

visual, timing = get_perturbation(weights_df, run_params,kernel,experience_level)
time = visual['time']
offset = 0
Expand Down Expand Up @@ -471,7 +462,7 @@ def plot_perturbation(weights_df, run_params, kernel,experience_level="Familiar"

if savefig:
filepath = run_params['figure_dir']+\
'/strategy/'+kernel+'_strategy_perturbation_{}.svg'.format(experience_level)
'/strategy/'+kernel+'_strategy_perturbation_{}_{}_{}.svg'.format(experience_level,x,y)
print('Figure saved to: '+filepath)
plt.savefig(filepath)

Expand Down
8 changes: 7 additions & 1 deletion visual_behavior_glm/GLM_strategy_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ def kernels_by_cre(weights_beh, run_params, kernel='omissions',
savefig=False, sharey=False, depth_filter=[0,1000]):

cres = ['Vip-IRES-Cre','Sst-IRES-Cre','Slc17a7-IRES2-Cre']
limit_list = {
'Slc17a7-IRES2-Cre':[-.0005,0.002],
'Sst-IRES-Cre':[-.006,0.0125],
'Vip-IRES-Cre':[-0.005,0.025],
}
for dex, cre in enumerate(cres):
height = 4
width=8
Expand Down Expand Up @@ -129,7 +134,8 @@ def kernels_by_cre(weights_beh, run_params, kernel='omissions',
ax.set_title(string_mapper(cre),fontsize=16)
ax.set_ylabel(kernel+' weights\n(Ca$^{2+}$ events)',fontsize=16)

ylim=ax.get_ylim()
#ylim=ax.get_ylim()
ylim = limit_list[cre]
ax.set_ylim(ylim)
if kernel =='omissions':
out[2].plot(0,ylim[0],'co',zorder=10,clip_on=False)
Expand Down
2 changes: 1 addition & 1 deletion visual_behavior_glm/strategy_paper_figure_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
gst.kernels_by_cre(weights_beh, run_params, 'misses')

# Plot state space plots
gpt.plot_perturbation(weights_beh, run_params. 'all-images')
gpt.plot_perturbation(weights_beh, run_params, 'all-images')
gpt.plot_perturbation(weights_beh, run_params, 'omissions')
gpt.plot_perturbation(weights_beh, run_params, 'hits')
gpt.plot_perturbation(weights_beh, run_params, 'misses')
Expand Down

0 comments on commit 18efb1f

Please sign in to comment.