diff --git a/paper/fig2.ipynb b/paper/fig2.ipynb index d387d32..0ee84c3 100644 --- a/paper/fig2.ipynb +++ b/paper/fig2.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "00059128", "metadata": { "execution": { @@ -14,21 +14,32 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Done\n" + "ename": "ModuleNotFoundError", + "evalue": "No module named 'matplotlib'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mget_ipython\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_line_magic\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmatplotlib\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43minline\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mpathlib\u001b[39;00m\n", + "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/IPython/core/interactiveshell.py:2456\u001b[0m, in \u001b[0;36mInteractiveShell.run_line_magic\u001b[0;34m(self, magic_name, line, _stack_depth)\u001b[0m\n\u001b[1;32m 2454\u001b[0m kwargs[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlocal_ns\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_local_scope(stack_depth)\n\u001b[1;32m 2455\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuiltin_trap:\n\u001b[0;32m-> 2456\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2458\u001b[0m \u001b[38;5;66;03m# The code below prevents the output from being displayed\u001b[39;00m\n\u001b[1;32m 2459\u001b[0m \u001b[38;5;66;03m# when using magics with decorator @output_can_be_silenced\u001b[39;00m\n\u001b[1;32m 2460\u001b[0m \u001b[38;5;66;03m# when the last Python token in the expression is a ';'.\u001b[39;00m\n\u001b[1;32m 2461\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(fn, magic\u001b[38;5;241m.\u001b[39mMAGIC_OUTPUT_CAN_BE_SILENCED, \u001b[38;5;28;01mFalse\u001b[39;00m):\n", + "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/IPython/core/magics/pylab.py:99\u001b[0m, in \u001b[0;36mPylabMagics.matplotlib\u001b[0;34m(self, line)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAvailable matplotlib backends: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m backends_list)\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 99\u001b[0m gui, backend \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshell\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menable_matplotlib\u001b[49m\u001b[43m(\u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlower\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgui\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 100\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_show_matplotlib_backend(args\u001b[38;5;241m.\u001b[39mgui, backend)\n", + "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/IPython/core/interactiveshell.py:3630\u001b[0m, in \u001b[0;36mInteractiveShell.enable_matplotlib\u001b[0;34m(self, gui)\u001b[0m\n\u001b[1;32m 3609\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21menable_matplotlib\u001b[39m(\u001b[38;5;28mself\u001b[39m, gui\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m 3610\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Enable interactive matplotlib and inline figure support.\u001b[39;00m\n\u001b[1;32m 3611\u001b[0m \n\u001b[1;32m 3612\u001b[0m \u001b[38;5;124;03m This takes the following steps:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 3628\u001b[0m \u001b[38;5;124;03m display figures inline.\u001b[39;00m\n\u001b[1;32m 3629\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 3630\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmatplotlib_inline\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackend_inline\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m configure_inline_support\n\u001b[1;32m 3632\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mIPython\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m pylabtools \u001b[38;5;28;01mas\u001b[39;00m pt\n\u001b[1;32m 3633\u001b[0m gui, backend \u001b[38;5;241m=\u001b[39m pt\u001b[38;5;241m.\u001b[39mfind_gui_and_backend(gui, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpylab_gui_select)\n", + "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/matplotlib_inline/__init__.py:1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m backend_inline, config \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[1;32m 2\u001b[0m __version__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m0.1.7\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;66;03m# noqa\u001b[39;00m\n", + "File \u001b[0;32m~/Library/Python/3.9/lib/python/site-packages/matplotlib_inline/backend_inline.py:6\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;124;03m\"\"\"A matplotlib backend for publishing figures via display_data\"\"\"\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# Copyright (c) IPython Development Team.\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Distributed under the terms of the BSD 3-Clause License.\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmatplotlib\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m colors\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbackends\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m backend_agg\n", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'matplotlib'" ] } ], "source": [ "%matplotlib inline\n", "\n", - "import os, pathlib\n", + "import os\n", + "import pathlib\n", "import pickle\n", "from importlib import reload\n", - "import logging, warnings\n", - "logging.basicConfig(level=logging.ERROR)\n", + "import logging\n", + "import warnings\n", + "logging.basicConfig(level = logging.ERROR)\n", "warnings.simplefilter(\"ignore\")\n", "\n", "import PyPDF2 as ppdf\n", @@ -60,11 +71,11 @@ " import params\n", " monkey_defs = params.monkey_defs\n", "\n", - " set_rc = params.set_rc_params\n", + " set_rc = params.set_rc_params\n", " set_rc()\n", " root = params.root\n", "\n", - " os.chdir(RepoPath / 'monkey')\n", + " os.chdir(RepoPath/'monkey')\n", " %run \"_dataset-selection.ipynb\"\n", "\n", " finally:\n", @@ -72,7 +83,7 @@ " print('Done')\n", "\n", "FIGPATH = params.figPath / 'fig2'\n", - "FIGPATH.mkdir(exist_ok=True, parents=True)" + "FIGPATH.mkdir(exist_ok = True, parents = True)" ] }, { @@ -110,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "34430f31", "metadata": { "execution": { @@ -143,55 +154,55 @@ } ], "source": [ - "figsize=params.LargeFig\n", - "fig=plt.figure(figsize=figsize)\n", + "figsize = params.LargeFig\n", + "fig = plt.figure(figsize = figsize)\n", "\n", - "gs2_1 = utility.add_gridspec_abs(fig, nrows=1, ncols=monkey_defs.n_targets,\n", - " left=params.panels.schmatic[0],\n", - " bottom=figsize[1]-params.panels.schmatic[1]+params.panels.velocity[1],\n", - " width=params.panels.raster[0], \n", - " height=params.panels.raster[1])\n", - "gs2_2 = utility.add_gridspec_abs(fig, nrows=1, ncols=monkey_defs.n_targets,\n", - " right=figsize[0],\n", - " top=figsize[1],\n", - " width=params.panels.raster[0], \n", - " height=params.panels.raster[1])\n", + "gs2_1 = utility.add_gridspec_abs(fig, nrows = 1, ncols = monkey_defs.n_targets,\n", + " left = params.panels.schmatic[0],\n", + " bottom = figsize[1]-params.panels.schmatic[1]+params.panels.velocity[1],\n", + " width = params.panels.raster[0], \n", + " height = params.panels.raster[1])\n", + "gs2_2 = utility.add_gridspec_abs(fig, nrows = 1, ncols = monkey_defs.n_targets,\n", + " right = figsize[0],\n", + " top = figsize[1],\n", + " width = params.panels.raster[0], \n", + " height = params.panels.raster[1])\n", "\n", - "gs2_3 = utility.add_gridspec_abs(fig, nrows=1, ncols=monkey_defs.n_targets,\n", - " left=params.panels.schmatic[0],\n", - " bottom=figsize[1]-params.panels.schmatic[1],\n", - " width=params.panels.raster[0], \n", - " height=params.panels.velocity[1])\n", - "gs2_4 = utility.add_gridspec_abs(fig, nrows=1, ncols=monkey_defs.n_targets,\n", - " right=figsize[0],\n", - " top=figsize[1]-params.panels.raster[1],\n", - " width=params.panels.raster[0], \n", - " height=params.panels.velocity[1])\n", + "gs2_3 = utility.add_gridspec_abs(fig, nrows = 1, ncols = monkey_defs.n_targets,\n", + " left = params.panels.schmatic[0],\n", + " bottom = figsize[1]-params.panels.schmatic[1],\n", + " width = params.panels.raster[0], \n", + " height = params.panels.velocity[1])\n", + "gs2_4 = utility.add_gridspec_abs(fig, nrows = 1, ncols = monkey_defs.n_targets,\n", + " right = figsize[0],\n", + " top = figsize[1]-params.panels.raster[1],\n", + " width = params.panels.raster[0], \n", + " height = params.panels.velocity[1])\n", "\n", "axes2_1 = rt.plot_fr_raster(raster_example_df[0], gs2_1, fig, range(monkey_defs.n_targets))\n", "axes2_2 = rt.plot_fr_raster(raster_example_df[1], gs2_2, fig, range(monkey_defs.n_targets))\n", - "utility.phantom_axes(fig.add_subplot(gs2_1[:])).set_title('Monkey $C_L$', pad=8)\n", - "utility.phantom_axes(fig.add_subplot(gs2_2[:])).set_title('Monkey $M$', pad=8)\n", + "utility.phantom_axes(fig.add_subplot(gs2_1[:])).set_title('Monkey $C_L$', pad = 8)\n", + "utility.phantom_axes(fig.add_subplot(gs2_2[:])).set_title('Monkey $M$', pad = 8)\n", "\n", "axes2_3 = rt.plot_pos_ex(raster_example_df[0], gs2_3, fig, range(monkey_defs.n_targets))\n", "axes2_4 = rt.plot_pos_ex(raster_example_df[1], gs2_4, fig, range(monkey_defs.n_targets))\n", "\n", "axes2_3[0].set_ylabel('Position\\n(centred)')\n", - "axes2_3[0].set_xlabel('Time relative to movement onset',loc='left')\n", - "X_line = mlines.Line2D([], [], color='blue', label='$X$')\n", - "Y_line = mlines.Line2D([], [], color='red', label='$Y$')\n", - "axes2_4[-1].legend(handles=[X_line, Y_line], loc=(1.1,.1))\n", + "axes2_3[0].set_xlabel('Time relative to movement onset',loc = 'left')\n", + "X_line = mlines.Line2D([], [], color = 'blue', label = '$X$')\n", + "Y_line = mlines.Line2D([], [], color = 'red', label = '$Y$')\n", + "axes2_4[-1].legend(handles = [X_line, Y_line], loc = (1.1,0.1))\n", " \n", - "gs2_c = utility.add_gridspec_abs(fig, nrows=1, ncols=1, \n", - " height=params.panels.raster[1]-.15, \n", - " width=.1, \n", - " left=figsize[0]+.2, \n", - " bottom=figsize[1]-params.panels.schmatic[1]+params.panels.velocity[1])\n", + "gs2_c = utility.add_gridspec_abs(fig, nrows = 1, ncols = 1, \n", + " height = params.panels.raster[1]-0.15, \n", + " width = 0.1, \n", + " left = figsize[0]+0.2, \n", + " bottom = figsize[1]-params.panels.schmatic[1]+params.panels.velocity[1])\n", "cax2 = fig.add_subplot(gs2_c[:])\n", - "fig.colorbar(cm.ScalarMappable(),cax=cax2, ticks=(0,1),drawedges=False)\n", + "fig.colorbar(cm.ScalarMappable(),cax = cax2, ticks = (0,1),drawedges = False)\n", "cax2.set_title('Normalised\\nfiring rate')\n", "\n", - "fig.savefig(FIGPATH / 'rasters.pdf', format='pdf', bbox_inches='tight')\n" + "fig.savefig(FIGPATH / 'rasters.pdf', format = 'pdf', bbox_inches = 'tight')\n" ] }, { @@ -204,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "fe0ea7e3-7def-41da-9fb9-7d6deae34b2d", "metadata": { "execution": { @@ -218,38 +229,38 @@ "source": [ "@utility.report\n", "def plot_monkey_pc_example(raster_example_df, gs): \n", - " fig=gs.figure\n", + " fig = gs.figure\n", " \n", " colors = utility.get_colors(8)\n", - " dfs=[]\n", - " axes=[]\n", + " dfs = []\n", + " axes = []\n", " for i,df in enumerate(raster_example_df):\n", - " rates = np.concatenate(df['M1_rates'].values, axis=0)\n", - " rates_model = PCA(n_components=10, svd_solver='full').fit(rates)\n", + " rates = np.concatenate(df['M1_rates'].values, axis = 0)\n", + " rates_model = PCA(n_components = 10, svd_solver = 'full').fit(rates)\n", " df_ = pyal.apply_dim_reduce_model(df, rates_model, 'M1_rates', '_pca');\n", " dfs.append(df_)\n", - " ax = fig.add_subplot(gs[i], projection='3d',fc='None')\n", + " ax = fig.add_subplot(gs[i], projection = '3d',fc = 'None')\n", " axes.append(ax)\n", " for tar in range(monkey_defs.n_targets):\n", - " df__ = pyal.select_trials(df_, df_.target_id==tar)\n", + " df__ = pyal.select_trials(df_, df_.target_id == tar)\n", " ex = pyal.get_sig_by_trial(df__,'_pca')\n", - " ex = np.mean(ex, axis=2)[:,:3]\n", - " ax.plot(ex[:,0],ex[:,1],ex[:,2],color=colors[tar],lw=1)\n", + " ex = np.mean(ex, axis = 2)[:,:3]\n", + " ax.plot(ex[:,0],ex[:,1],ex[:,2],color = colors[tar],lw = 1)\n", " ax.view_init(60,-47)\n", "\n", - " AllData = dt.get_data_array(raster_example_df, area='M1', model=10)\n", + " AllData = dt.get_data_array(raster_example_df, area = 'M1', model = 10)\n", " data1 = np.reshape(AllData[0,...], (-1,10))\n", " data2 = np.reshape(AllData[1,...], (-1,10))\n", - " A,B,*_ = cca.canoncorr(data1,data2,fullReturn=True)\n", + " A,B,*_ = cca.canoncorr(data1,data2,fullReturn = True)\n", " coef_ = [A,B]\n", " for i,sessionData in enumerate(AllData):\n", - " ax = fig.add_subplot(gs[i+3], projection='3d',fc='None')\n", - " U, _, Vh = linalg.svd(coef_[i], full_matrices=False, compute_uv=True, overwrite_a=False, check_finite=False)\n", + " ax = fig.add_subplot(gs[i+3], projection = '3d',fc = 'None')\n", + " U, _, Vh = linalg.svd(coef_[i], full_matrices = False, compute_uv = True, overwrite_a = False, check_finite = False)\n", " axes.append(ax)\n", " for tar in range(8):\n", - " ex = np.mean(sessionData[tar,...], axis=0)\n", + " ex = np.mean(sessionData[tar,...], axis = 0)\n", " ex = ex @ U @ Vh\n", - " ax.plot(ex[:,0],ex[:,1],ex[:,2],color=colors[tar],lw=1)\n", + " ax.plot(ex[:,0],ex[:,1],ex[:,2],color = colors[tar],lw = 1)\n", " ax.view_init(60,-47)\n", "\n", " titles=[r'Monkey $C_L$ (\\textit{unaligned})',r'Monkey $M$ (\\textit{unaligned})',\n", @@ -259,27 +270,27 @@ " ax.set_xticks([])\n", " ax.set_yticks([])\n", " ax.set_zticks([])\n", - " ax.set_xlabel(f'{labels[i]}1', labelpad=-15)\n", - " ax.set_ylabel(f'{labels[i]}2', labelpad=-15)\n", - " ax.set_zlabel(f'{labels[i]}3', labelpad=-15)\n", - " ax.set_title(titles[i], y=.9, loc='center')\n", + " ax.set_xlabel(f'{labels[i]}1', labelpad =- 15)\n", + " ax.set_ylabel(f'{labels[i]}2', labelpad =- 15)\n", + " ax.set_zlabel(f'{labels[i]}3', labelpad =- 15)\n", + " ax.set_title(titles[i], y = 0.9, loc='center')\n", " \n", " #======== add the arrow\n", " \n", - " ax = fig.add_subplot(gs[2], fc='None')\n", + " ax = fig.add_subplot(gs[2], fc = 'None')\n", " ax = utility.phantom_axes(ax)\n", - " ax.arrow(0,0,1,0,length_includes_head=True, width=.005, head_width=.015,head_length=.1, ec='k', fc='k')\n", - " ax.set_ylim([-.1,.1])\n", - " ax.set_xlim([-.5,1.1])\n", - " ax.text(0.5,0.01,'CCA', ha='center', va='bottom')\n", - " ax.text(0.5,-0.01,'(alignment)', ha='center', va='top')\n", + " ax.arrow(0,0,1,0,length_includes_head = True, width = 0.005, head_width = 0.015,head_length = 0.1, ec = 'k', fc = 'k')\n", + " ax.set_ylim([-0.1,0.1])\n", + " ax.set_xlim([-0.5,1.1])\n", + " ax.text(0.5,0.01,'CCA', ha = 'center', va = 'bottom')\n", + " ax.text(0.5,-0.01,'(alignment)', ha = 'center', va = 'top')\n", " \n", " return axes" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "4141aee8", "metadata": { "execution": { @@ -309,26 +320,26 @@ } ], "source": [ - "figsize=params.LargeFig\n", - "fig=plt.figure(figsize=figsize)\n", - "gs3 =utility.add_gridspec_abs(fig, nrows=1, ncols=5, left=0, \n", - " bottom=figsize[1]-params.panels.schmatic[1]-params.panels.proj_3d_align[1]-.3,\n", - " width=params.panels.proj_3d_align[0], \n", - " height=params.panels.proj_3d_align[1])\n", + "figsize = params.LargeFig\n", + "fig = plt.figure(figsize = figsize)\n", + "gs3 = utility.add_gridspec_abs(fig, nrows = 1, ncols = 5, left = 0, \n", + " bottom = figsize[1]-params.panels.schmatic[1]-params.panels.proj_3d_align[1]-.3,\n", + " width = params.panels.proj_3d_align[0], \n", + " height = params.panels.proj_3d_align[1])\n", "\n", "axes3 = plot_monkey_pc_example(raster_example_df, gs3)\n", "\n", "\n", - "gs3_c = utility.add_gridspec_abs(fig, nrows=1, ncols=1, left=0,\n", - " bottom=(axes3[0].get_position().y0+axes3[0].get_position().y1)/2*figsize[1],\n", - " width=.2, height=0.2)\n", - "cax3 = fig.add_subplot(gs3_c[0],zorder=10)\n", + "gs3_c = utility.add_gridspec_abs(fig, nrows = 1, ncols = 1, left = 0,\n", + " bottom = (axes3[0].get_position().y0+axes3[0].get_position().y1)/2*figsize[1],\n", + " width = 0.2, height = 0.2)\n", + "cax3 = fig.add_subplot(gs3_c[0],zorder = 10)\n", "\n", "utility.plot_targets(cax3,3)\n", "cax3.set_xlim(np.array(cax3.get_xlim())*1.15)\n", "cax3.set_ylim(np.array(cax3.get_ylim())*1.15)\n", "\n", - "fig.savefig(FIGPATH / '3d-dynamics-example.pdf', format='pdf', bbox_inches='tight')\n" + "fig.savefig(FIGPATH / '3d-dynamics-example.pdf', format = 'pdf', bbox_inches = 'tight')\n" ] }, { @@ -341,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "06a6550f-b95d-42fa-bc58-b6f5c4aa544f", "metadata": { "execution": { @@ -368,17 +379,17 @@ "\n", "fig, ax = plt.subplots()\n", "cca.plot_cca_for_ex(ax, example_dfs, \n", - " monkey_defs.exec_epoch, \n", - " monkey_defs.areas[2], \n", - " monkey_defs.n_components)\n", + " monkey_defs.exec_epoch, \n", + " monkey_defs.areas[2], \n", + " monkey_defs.n_components)\n", "\n", - "fig.savefig(FIGPATH / 'monkey-cca-example.pdf', format='pdf', bbox_inches='tight')" + "fig.savefig(FIGPATH / 'monkey-cca-example.pdf', format = 'pdf', bbox_inches = 'tight')" ] } ], "metadata": { "kernelspec": { - "display_name": "workshop", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -392,7 +403,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.16" + "version": "3.9.6" } }, "nbformat": 4,