from analyze_by_deflection import * import pandas as pd import plotVG3D import os import seaborn as sns # ============================ # # edit here # # ============================ # p_save = os.path.join(os.environ['BOX_PATH'], r'__VG3D/_deflection_trials/_NEO/results') cell_list = ['201711B2', '201708D1'] figsize = plotVG3D.set_fig_style()[1] sns.set_style('ticks') # ================================= # Plot PCA variance explained dat = pd.read_csv(os.path.join(p_save, 'PCA_decompositions_new_eigennames.csv')) wd = figsize[0] / 3 ht = wd / .75 f = plt.figure(figsize=(wd, ht)) pvt = dat2.pivot_table(index=dat2.index, columns='id', values='ExplainedVarianceRatio') exp_var = np.array([pvt[x].as_matrix() for x in pvt.columns]).T plt.plot(exp_var, 'k', alpha=.15, linewidth=1) plt.plot(np.mean(exp_var, axis=1), 'o-', color=[182 / 255., 0, 0], linewidth=2,
import pandas as pd import os import matplotlib.pyplot as plt import seaborn as sns import matplotlib as mpl from cycler import cycler from plotVG3D import set_fig_style figsize, ext = set_fig_style()[1:3] cmap = mpl.cm.get_cmap('Greys') import numpy as np mpl.rcParams['axes.prop_cycle'] = cycler( color=cmap(np.linspace(100, 205, 5).astype('int'))) ## ================================ ##j ## ==== large NLIN comparisons ==== ## ## ================================ ## fname_large = 'K_testing_large_nlin.csv' fname_small = 'K_testing_small_nlin.csv' sigma = 16 p_load = '__VG3D/_deflection_trials/_NEO/results' p_load = os.path.join(os.environ['BOX_PATH'], p_load) p_save = p_load df1 = pd.read_csv(os.path.join(p_load, fname_large)) df2 = pd.read_csv(os.path.join(p_load, fname_small)) for cell in df1.id.unique(): sub_df1 = df1[df1.id == cell] sub_df1.plot( x='sigma', linewidth=1.5,
import varTuning import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns import plotVG3D # =================== dpi_res, figsize, ext = plotVG3D.set_fig_style() p_save = os.path.join(os.environ['BOX_PATH'], r'__VG3D\_deflection_trials\_NEO\results') is_stim = pd.read_csv(os.path.join(p_save, r'cell_id_stim_responsive.csv')) df = pd.read_csv(os.path.join(p_save, 'regularity_by_contact.csv')) df = df.merge(is_stim, on='id') df = df[df.stim_responsive] cell_list = ['201708D1c0'] # ======================================= if len(cell_list) == 0: cell_list = df.id.unique() # Plot regularity by direction for a cell wd = figsize[0] / 3 ht = wd for cell in cell_list: sub_df = df[df.id == cell] df_dir = sub_df.groupby('dir_idx') theta = df_dir.med_dir.mean() # ========================= plt.figure(figsize=(wd, ht)) med_CV = df_dir.CV.quantile(0.5) lower_CV = df_dir.CV.quantile(0.25) upper_CV = df_dir.CV.quantile(0.75)