diff --git a/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb b/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb index 695572184de83896a2d267ffc61402e3b9702e5c..8d9e415d5397d6eec829f6e3c2529a3a2d68b888 100644 --- a/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb +++ b/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb @@ -116,7 +116,8 @@ "# Import the MultiAreaModel class\n", "from multiarea_model import MultiAreaModel\n", "from multiarea_model import Analysis\n", - "from config import base_path, data_path" + "from config import base_path, data_path\n", + "from figures import MAM2EBRAINS as M2E" ] }, { @@ -1112,15 +1113,17 @@ } ], "source": [ - "fig, ax = plt.subplots()\n", - "ax.plot(tsteps, rate)\n", - "ax.plot(tsteps, np.average(rate)*np.ones(len(tsteps)), label='mean')\n", - "ax.set_title('Instantaneous and mean firing rate across all populations')\n", - "ax.set_xlabel('time (ms)')\n", - "ax.set_ylabel('firing rate (spikes / s)')\n", - "ax.set_xlim(0, sim_params['t_sim'])\n", - "ax.set_ylim(0, 50)\n", - "ax.legend()" + "plot_instan_mean_firing _rate(tsteps, rate)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e91c436e-db94-4cd7-a531-29c032efeeae", + "metadata": {}, + "outputs": [], + "source": [ + "### 5.2 Resting state plots <a class=\"anchor\" id=\"section_5_2\"></a>" ] }, { @@ -1178,28 +1181,7 @@ } ], "source": [ - "\"\"\"\n", - "Create raster display of a single area with populations stacked onto each other. Excitatory neurons in blue, inhibitory neurons in red.\n", - "\n", - "Parameters\n", - "----------\n", - "area : string {area}\n", - " Area to be plotted.\n", - "frac_neurons : float, [0,1]\n", - " Fraction of cells to be considered.\n", - "t_min : float, optional\n", - " Minimal time in ms of spikes to be shown. Defaults to 0 ms.\n", - "t_max : float, optional\n", - " Minimal time in ms of spikes to be shown. Defaults to simulation time.\n", - "output : {'pdf', 'png', 'eps'}, optional\n", - " If given, the function stores the plot to a file of the given format.\n", - "\"\"\"\n", - "t_min = 0.\n", - "t_max = 500.\n", - "areas = ['V1', 'V2', 'FEF']\n", - "frac_neurons = 1.\n", - "for area in areas:\n", - " A.single_dot_display(area, frac_neurons, t_min, t_max)" + "plot_raster_plot(A)" ] }, { @@ -1817,9 +1799,9 @@ ], "metadata": { "kernelspec": { - "display_name": "EBRAINS-23.02", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ebrains-23.02" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1831,7 +1813,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.11" + "version": "3.8.10" } }, "nbformat": 4, diff --git a/figures/.ipynb_checkpoints/MAM2EBRAINS-checkpoint.py b/figures/.ipynb_checkpoints/MAM2EBRAINS-checkpoint.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/figures/MAM2EBRAINS.py b/figures/MAM2EBRAINS.py new file mode 100644 index 0000000000000000000000000000000000000000..9a60aa419efe9e3589baf63111b55603fc551b62 --- /dev/null +++ b/figures/MAM2EBRAINS.py @@ -0,0 +1,36 @@ +# Instantaneous and mean firing rate across all populations + +def plot_instan_mean_firing _rate(tsteps, rate): + fig, ax = plt.subplots() + ax.plot(tsteps, rate) + ax.plot(tsteps, np.average(rate)*np.ones(len(tsteps)), label='mean') + ax.set_title('Instantaneous and mean firing rate across all populations') + ax.set_xlabel('time (ms)') + ax.set_ylabel('firing rate (spikes / s)') + ax.set_xlim(0, sim_params['t_sim']) + ax.set_ylim(0, 50) + ax.legend() + +def plot_raster_plot(A): + """ + Create raster display of a single area with populations stacked onto each other. Excitatory neurons in blue, inhibitory neurons in red. + + Parameters + ---------- + area : string {area} + Area to be plotted. + frac_neurons : float, [0,1] + Fraction of cells to be considered. + t_min : float, optional + Minimal time in ms of spikes to be shown. Defaults to 0 ms. + t_max : float, optional + Minimal time in ms of spikes to be shown. Defaults to simulation time. + output : {'pdf', 'png', 'eps'}, optional + If given, the function stores the plot to a file of the given format. + """ + t_min = 0. + t_max = 500. + areas = ['V1', 'V2', 'FEF'] + frac_neurons = 1. + for area in areas: + A.single_dot_display(area, frac_neurons, t_min, t_max) \ No newline at end of file diff --git a/multi-area-model.ipynb b/multi-area-model.ipynb index 695572184de83896a2d267ffc61402e3b9702e5c..8d9e415d5397d6eec829f6e3c2529a3a2d68b888 100644 --- a/multi-area-model.ipynb +++ b/multi-area-model.ipynb @@ -116,7 +116,8 @@ "# Import the MultiAreaModel class\n", "from multiarea_model import MultiAreaModel\n", "from multiarea_model import Analysis\n", - "from config import base_path, data_path" + "from config import base_path, data_path\n", + "from figures import MAM2EBRAINS as M2E" ] }, { @@ -1112,15 +1113,17 @@ } ], "source": [ - "fig, ax = plt.subplots()\n", - "ax.plot(tsteps, rate)\n", - "ax.plot(tsteps, np.average(rate)*np.ones(len(tsteps)), label='mean')\n", - "ax.set_title('Instantaneous and mean firing rate across all populations')\n", - "ax.set_xlabel('time (ms)')\n", - "ax.set_ylabel('firing rate (spikes / s)')\n", - "ax.set_xlim(0, sim_params['t_sim'])\n", - "ax.set_ylim(0, 50)\n", - "ax.legend()" + "plot_instan_mean_firing _rate(tsteps, rate)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e91c436e-db94-4cd7-a531-29c032efeeae", + "metadata": {}, + "outputs": [], + "source": [ + "### 5.2 Resting state plots <a class=\"anchor\" id=\"section_5_2\"></a>" ] }, { @@ -1178,28 +1181,7 @@ } ], "source": [ - "\"\"\"\n", - "Create raster display of a single area with populations stacked onto each other. Excitatory neurons in blue, inhibitory neurons in red.\n", - "\n", - "Parameters\n", - "----------\n", - "area : string {area}\n", - " Area to be plotted.\n", - "frac_neurons : float, [0,1]\n", - " Fraction of cells to be considered.\n", - "t_min : float, optional\n", - " Minimal time in ms of spikes to be shown. Defaults to 0 ms.\n", - "t_max : float, optional\n", - " Minimal time in ms of spikes to be shown. Defaults to simulation time.\n", - "output : {'pdf', 'png', 'eps'}, optional\n", - " If given, the function stores the plot to a file of the given format.\n", - "\"\"\"\n", - "t_min = 0.\n", - "t_max = 500.\n", - "areas = ['V1', 'V2', 'FEF']\n", - "frac_neurons = 1.\n", - "for area in areas:\n", - " A.single_dot_display(area, frac_neurons, t_min, t_max)" + "plot_raster_plot(A)" ] }, { @@ -1817,9 +1799,9 @@ ], "metadata": { "kernelspec": { - "display_name": "EBRAINS-23.02", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ebrains-23.02" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1831,7 +1813,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.11" + "version": "3.8.10" } }, "nbformat": 4,