""" import numpy as np import matplotlib.pyplot as plt import texplot import plotfuncs as plf from scipy import stats data = np.load('/home/ycan/Documents/thesis/analysis_auxillary_files/' 'thesis_csiplotting.npz') cells = data['cells'] csi = data['csi'] include = data['include'] colors = data['colors'] colorcategories = data['colorcategories'] fig = texplot.texfig(.9, .8) axes = fig.subplots(len(colorcategories), 1, sharex=True) csichange = csi[1, :] - csi[0, :] changes = [] groups = [] bins = np.arange(-.2, .35+0.05, 0.05) for i, color in enumerate(colorcategories): group = [index for index, c in enumerate(colors) if c == color] ax = axes[i] change = csichange[group] groups.append(group) changes.append(change) if i == 0: csichange_on = np.copy(change) elif i == 1:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 14 08:50:54 2018 @author: ycan """ import numpy as np import matplotlib.pyplot as plt import iofuncs as iof import plotfuncs as plf import texplot import scalebars texplot.texfig(1.1, 1) data = np.load('/home/ycan/Documents/thesis/' 'analysis_auxillary_files/thesis_csiplotting.npz') cells = data['cells'] groups = data['groups'] bias = data['bias'] csi = data['csi'] colorcategories = data['colorcategories'] colorlabels = data['colorlabels'] toplot = [ ['20180124', '02001'], # Increasing bias ['20180207', '03503'], # Decreasing bias ]
bias = data['bias'] groups = data['groups'] colorcategories = data['colorcategories'] colorlabels = data['colorlabels'] biaschange = bias[1, ] - bias[0, ] csichange = csi[1, ] - csi[0, ] scatterkwargs = { 'linewidths': .7, # 'alpha':.8, 'edgecolor': 'k' } linekwargs = {'color': 'k', 'alpha': .5, 'linestyle': 'dashed', 'linewidth': 1} fig = texplot.texfig(.85, aspect=1.85) ax = plt.subplot2grid((4, 3), (0, 0), colspan=3, rowspan=2) # Create an array for all the colors to use with plt.legend() patches = [] for color, label in zip(colorcategories, colorlabels): patches.append(mpatches.Patch(color=color, label=label)) ax.legend(handles=patches, fontsize='xx-small') for group, color in zip(groups, colorcategories): ax.scatter(csichange[group], biaschange[group], c=color, **scatterkwargs) ax.axhline(0, **linekwargs) ax.axvline(0, **linekwargs) plf.subplottext('A', ax, x=-0.05)
import os import warnings import numpy as np import matplotlib.pyplot as plt import gaussfitter as gfit import iofuncs as iof import miscfuncs as msc import plotfuncs as plf import analysis_scripts as asc from matplotlib.patches import Rectangle from matplotlib.offsetbox import OffsetImage, AnnotationBbox import scalebars import texplot fig = texplot.texfig(1.2) spikecutoff=1000 ratingcutoff=4 staqualcutoff=0 inner_b=2 outer_b=4 exp_name = '20180207' stim_nr = 11 exp_dir = iof.exp_dir_fixer(exp_name) stim_nr = str(stim_nr) savefolder = 'surroundplots'
x = [np.nanmin(csi), np.nanmax(csi)] scatterkwargs = { 'c': colors, 'alpha': .8, 'linewidths': .5, 'edgecolor': 'k', 's': 35 } # Create an array for all the colors to use with plt.legend() patches = [] for color, label in zip(colorcategories, colorlabels): patches.append(mpatches.Patch(color=color, label=label)) fig = texplot.texfig(.90, aspect=1.85) ax = plt.subplot2grid((5, 3), (0, 0), colspan=3, rowspan=3) ax.plot(x, x, 'k--', alpha=.5, linewidth=.8) plf.subplottext('A', ax, x=-0.05, y=1.03) ax.scatter(csi[0, :], csi[1, :], **scatterkwargs) # Mark the example cells with an asterisk asterixes = [ (0.03443051, 0.19385925), # Example ON cell 20180207 03001 (0.03238909, 0.29553824) ] # Example OFF cell 20180118 23102 for asterix in asterixes: ax.text(*asterix, '*', color='k') ax.legend(handles=patches, fontsize='xx-small')
('20180124', '07401', 'offweird1'), ('20180207', '02001', 'offweird2'), ('20180124', '04001', 'offweird3'), ] rows = 2 columns = 2 for i, (exp_name, clustertoplot, label) in enumerate(toplot): if '20180124' in exp_name or '20180207' in exp_name: stripeflicker = [6, 12] elif '20180118' in exp_name: stripeflicker = [7, 14] fig = texplot.texfig(1, aspect=.8) axes = [fig.add_subplot(rows, columns, i+1) for i in range(rows*columns)] for j, stimnr in enumerate(stripeflicker): exp_dir = iof.exp_dir_fixer(exp_name) _, metadata = asc.read_spikesheet(exp_dir) px_size = metadata['pixel_size(um)'] data = iof.load(exp_name, stimnr) clusters = data['clusters'] stas = data['stas'] max_inds = data['max_inds'] filter_length = data['filter_length']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 14 08:50:54 2018 @author: ycan """ import numpy as np import matplotlib.pyplot as plt import iofuncs as iof import plotfuncs as plf import texplot import scalebars texplot.texfig(1.2, .6) data = np.load('/home/ycan/Documents/thesis/' 'analysis_auxillary_files/thesis_csiplotting.npz') cells = data['cells'] groups = data['groups'] bias = data['bias'] csi = data['csi'] colorcategories = data['colorcategories'] toplot = [ ['20180124', '02001'], # Increasing bias ['20180207', '03503'], # Decreasing bias ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 14 08:50:54 2018 @author: ycan """ import numpy as np import matplotlib.pyplot as plt import iofuncs as iof import plotfuncs as plf import texplot import scalebars texplot.texfig(1.2, 1) data = np.load('/home/ycan/Documents/thesis/' 'analysis_auxillary_files/thesis_csiplotting.npz') cells = data['cells'] groups = data['groups'] bias = data['bias'] csi = data['csi'] colorcategories = data['colorcategories'] colorlabels = data['colorlabels'] toplot = [ ['20180124', '02001'], # Increasing bias ['20180207', '03503'], # Decreasing bias ]
@author: ycan """ import numpy as np import matplotlib.pyplot as plt import plotfuncs as plf import texplot data = np.load('/home/ycan/Documents/thesis/analysis_auxillary_files/' 'thesis_csiplotting.npz') cells = data['cells'] csi = data['csi'] bias = data['bias'] groups = data['groups'] colorcategories = data['colorcategories'] #plt.figure(figsize=(6,6)) texplot.texfig(.8, 1) ax3 = plt.subplot(111) for color, group in zip(colorcategories, groups): ax3.plot(bias[:, group], color=color, linewidth=.4) #plt.axis('equal') ax3.set_xticks([0, 1]) ax3.set_xticklabels(['Mesopic', 'Photopic']) ax3.set_ylabel('Polarity Index') plf.spineless(ax3) texplot.savefig('polarityindexchange') plt.show()