diff --git a/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb b/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb index 7addec20de6a64199821d9029ccd96d136653126..424e235ba560e9c0035f828a2996190b8a05b1d8 100644 --- a/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb +++ b/.ipynb_checkpoints/multi-area-model-checkpoint.ipynb @@ -58,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "06e7f341-c226-4782-a913-4868027d7d06", "metadata": {}, "outputs": [], @@ -76,34 +76,12 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "96517739", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " -- N E S T --\n", - " Copyright (C) 2004 The NEST Initiative\n", - "\n", - " Version: 3.4\n", - " Built: May 17 2023 20:48:31\n", - "\n", - " This program is provided AS IS and comes with\n", - " NO WARRANTY. See the file LICENSE for details.\n", - "\n", - " Problems or suggestions?\n", - " Visit https://www.nest-simulator.org\n", - "\n", - " Type 'nest.help()' to find out more about NEST.\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# Import dependencies\n", "%matplotlib inline\n", @@ -121,48 +99,22 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "7e07b0d0", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: nested_dict in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (1.61)\n", - "Requirement already satisfied: dicthash in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (0.0.2)\n", - "Requirement already satisfied: future in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (from dicthash) (0.18.2)\n" - ] - } - ], + "outputs": [], "source": [ "!pip install nested_dict dicthash" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "1d440c07-9b69-4e52-8573-26b13493bc5a", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "<style>\n", - "table {float:left}\n", - "</style>\n" - ], - "text/plain": [ - "<IPython.core.display.HTML object>" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Jupyter notebook display format setting\n", "style = \"\"\"\n", @@ -240,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "60265d52", "metadata": {}, "outputs": [], @@ -269,7 +221,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "6e4bed8d", "metadata": {}, "outputs": [], @@ -360,70 +312,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ab25f9f8", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Initializing network from dictionary.\n", - "RAND_DATA_LABEL 4294\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440: RuntimeWarning:Mean of empty slice.\n", - "/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/_methods.py:189: RuntimeWarning:invalid value encountered in double_scalars\n", - "Error in library(\"aod\") : there is no package called ‘aod’\n", - "Execution halted\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No R installation or IndexError, taking hard-coded SLN fit parameters.\n", - "\n", - "\n", - "========================================\n", - "Customized parameters\n", - "--------------------\n", - "{'K_scaling': 0.005,\n", - " 'N_scaling': 0.005,\n", - " 'connection_params': {'K_stable': 'K_stable.npy',\n", - " 'av_indegree_V1': 3950.0,\n", - " 'fac_nu_ext_5E': 1.125,\n", - " 'fac_nu_ext_6E': 1.41666667,\n", - " 'fac_nu_ext_TH': 1.2,\n", - " 'g': -11.0,\n", - " 'replace_non_simulated_areas': 'het_poisson_stat'},\n", - " 'fullscale_rates': 'tests/fullscale_rates.json',\n", - " 'input_params': {'rate_ext': 10.0},\n", - " 'neuron_params': {'V0_mean': -150.0, 'V0_sd': 50.0}}\n", - "========================================\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/dicthash/dicthash.py:47: UserWarning:Float too small for safe conversion tointeger. Rounding down to zero.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Simulation label: 27d81076e6d6e9e591684be053078477\n", - "Copied files.\n", - "Initialized simulation class.\n" - ] - } - ], + "outputs": [], "source": [ "M = MultiAreaModel(network_params, \n", " simulation=True,\n", @@ -442,19 +334,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "6a7ddf0e", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Iteration: 0\n", - "Mean-field theory predicts an average firing rate of 29.588 spikes/s across all populations.\n" - ] - } - ], + "outputs": [], "source": [ "p, r = M.theory.integrate_siegert()\n", "print(\"Mean-field theory predicts an average \"\n", @@ -487,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "6316ac24", "metadata": {}, "outputs": [], @@ -507,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "445a722a", "metadata": {}, "outputs": [], @@ -535,85 +418,10 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "15778e9c", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Prepared simulation in 0.00 seconds.\n", - "Rank 0: created area V1 with 0 local nodes\n", - "Memory after V1 : 1911.26 MB\n", - "Rank 0: created area V2 with 0 local nodes\n", - "Memory after V2 : 1937.84 MB\n", - "Rank 0: created area VP with 0 local nodes\n", - "Memory after VP : 1967.04 MB\n", - "Rank 0: created area V3 with 0 local nodes\n", - "Memory after V3 : 1995.29 MB\n", - "Rank 0: created area V3A with 0 local nodes\n", - "Memory after V3A : 2015.20 MB\n", - "Rank 0: created area MT with 0 local nodes\n", - "Memory after MT : 2040.86 MB\n", - "Rank 0: created area V4t with 0 local nodes\n", - "Memory after V4t : 2065.80 MB\n", - "Rank 0: created area V4 with 0 local nodes\n", - "Memory after V4 : 2092.75 MB\n", - "Rank 0: created area VOT with 0 local nodes\n", - "Memory after VOT : 2118.06 MB\n", - "Rank 0: created area MSTd with 0 local nodes\n", - "Memory after MSTd : 2139.53 MB\n", - "Rank 0: created area PIP with 0 local nodes\n", - "Memory after PIP : 2160.92 MB\n", - "Rank 0: created area PO with 0 local nodes\n", - "Memory after PO : 2182.43 MB\n", - "Rank 0: created area DP with 0 local nodes\n", - "Memory after DP : 2202.58 MB\n", - "Rank 0: created area MIP with 0 local nodes\n", - "Memory after MIP : 2224.23 MB\n", - "Rank 0: created area MDP with 0 local nodes\n", - "Memory after MDP : 2245.59 MB\n", - "Rank 0: created area VIP with 0 local nodes\n", - "Memory after VIP : 2267.52 MB\n", - "Rank 0: created area LIP with 0 local nodes\n", - "Memory after LIP : 2291.56 MB\n", - "Rank 0: created area PITv with 0 local nodes\n", - "Memory after PITv : 2316.88 MB\n", - "Rank 0: created area PITd with 0 local nodes\n", - "Memory after PITd : 2342.02 MB\n", - "Rank 0: created area MSTl with 0 local nodes\n", - "Memory after MSTl : 2363.48 MB\n", - "Rank 0: created area CITv with 0 local nodes\n", - "Memory after CITv : 2382.79 MB\n", - "Rank 0: created area CITd with 0 local nodes\n", - "Memory after CITd : 2402.08 MB\n", - "Rank 0: created area FEF with 0 local nodes\n", - "Memory after FEF : 2423.46 MB\n", - "Rank 0: created area TF with 0 local nodes\n", - "Memory after TF : 2439.15 MB\n", - "Rank 0: created area AITv with 0 local nodes\n", - "Memory after AITv : 2461.86 MB\n", - "Rank 0: created area FST with 0 local nodes\n", - "Memory after FST : 2478.59 MB\n", - "Rank 0: created area 7a with 0 local nodes\n", - "Memory after 7a : 2499.80 MB\n", - "Rank 0: created area STPp with 0 local nodes\n", - "Memory after STPp : 2518.41 MB\n", - "Rank 0: created area STPa with 0 local nodes\n", - "Memory after STPa : 2537.55 MB\n", - "Rank 0: created area 46 with 0 local nodes\n", - "Memory after 46 : 2553.03 MB\n", - "Rank 0: created area AITd with 0 local nodes\n", - "Memory after AITd : 2575.56 MB\n", - "Rank 0: created area TH with 0 local nodes\n", - "Memory after TH : 2588.26 MB\n", - "Created areas and internal connections in 2.22 seconds.\n", - "Created cortico-cortical connections in 22.70 seconds.\n", - "Simulated network in 70.32 seconds.\n" - ] - } - ], + "outputs": [], "source": [ "# run the simulation, depending on the model parameter and downscale ratio, the running time varies largely.\n", "M.simulation.simulate()" @@ -656,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dc3b1820", "metadata": {}, "outputs": [], @@ -690,7 +498,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "e7eb052e", "metadata": {}, "outputs": [], @@ -713,7 +521,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "902f2800", "metadata": {}, "outputs": [], @@ -755,7 +563,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "f5b58845-4d1a-430f-83f4-402fdf918aef", "metadata": { "tags": [] @@ -768,20 +576,12 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "6607a73d-1c74-4848-9603-081ad0e7cae8", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "loading spikes\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Analysis class.\n", @@ -812,7 +612,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "c471e9c8-b1e4-43e4-a6a1-443b8b8963be", "metadata": { "tags": [] @@ -827,21 +627,12 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "1870cf34-ee62-4614-bc25-c36bc9a7377c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Stored data have been computed with different parameters\n", - "Computing population rates\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate time-averaged population rates and store them in member pop_rates.\n", @@ -868,25 +659,18 @@ " If set to 'complete', all populations the respective areas\n", " are included. Defaults to 'complete'.\n", "\"\"\"\n", - "A.create_pop_rates()" + "A.create_pop_rates()\n", + "print(\"Computing population rates done\")" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "50b7df89", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing synchrony\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate synchrony as the coefficient of variation of the population rate\n", @@ -913,25 +697,18 @@ "resolution : float, optional\n", " Resolution of the population rate. Defaults to 1 ms.\n", "\"\"\"\n", - "A.create_synchrony()" + "A.create_synchrony()\n", + "print(\"Computing synchrony done\")" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "d43b493c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing population LvR\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate poulation-averaged LvR (see Shinomoto et al. 2009) and\n", @@ -953,38 +730,18 @@ " If set to 'complete', all populations the respective areas\n", " are included. Defaults to 'complete'.\n", "\"\"\"\n", - "A.create_pop_LvR()" + "A.create_pop_LvR()\n", + "print(\"Computing population LvR done\")" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "401ece2d-47c8-4775-80ae-92a8e432520c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing rate time series\n" - ] - }, - { - "ename": "TypeError", - "evalue": "'float' object cannot be interpreted as an integer", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [29]\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124;03mCalculate time series of population- and area-averaged firing rates.\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124;03mUses ah.pop_rate_time_series.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[38;5;124;03m - 'rect_time_window' : width of the moving rectangular function\u001b[39;00m\n\u001b[1;32m 32\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m---> 33\u001b[0m \u001b[43mA\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_rate_time_series\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/MAM2EBRAINS/multiarea_model/analysis.py:446\u001b[0m, in \u001b[0;36mAnalysis.create_rate_time_series\u001b[0;34m(self, **keywords)\u001b[0m\n\u001b[1;32m 439\u001b[0m time_series \u001b[38;5;241m=\u001b[39m ah\u001b[38;5;241m.\u001b[39mpop_rate_time_series(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspike_data[area][pop],\n\u001b[1;32m 440\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnetwork\u001b[38;5;241m.\u001b[39mN[area][pop],\n\u001b[1;32m 441\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt_min\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 442\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt_max\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 443\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresolution\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 444\u001b[0m kernel\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mkernel\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[1;32m 445\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 446\u001b[0m time_series \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mnan\u001b[38;5;241m*\u001b[39m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mones\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mt_max\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mt_min\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 447\u001b[0m d_pops[area][pop] \u001b[38;5;241m=\u001b[39m time_series\n\u001b[1;32m 449\u001b[0m total_spikes \u001b[38;5;241m=\u001b[39m ah\u001b[38;5;241m.\u001b[39marea_spike_train(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspike_data[area])\n", - "File \u001b[0;32m/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/numeric.py:204\u001b[0m, in \u001b[0;36mones\u001b[0;34m(shape, dtype, order, like)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m like \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _ones_with_like(shape, dtype\u001b[38;5;241m=\u001b[39mdtype, order\u001b[38;5;241m=\u001b[39morder, like\u001b[38;5;241m=\u001b[39mlike)\n\u001b[0;32m--> 204\u001b[0m a \u001b[38;5;241m=\u001b[39m \u001b[43mempty\u001b[49m\u001b[43m(\u001b[49m\u001b[43mshape\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdtype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43morder\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 205\u001b[0m multiarray\u001b[38;5;241m.\u001b[39mcopyto(a, \u001b[38;5;241m1\u001b[39m, casting\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124munsafe\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 206\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m a\n", - "\u001b[0;31mTypeError\u001b[0m: 'float' object cannot be interpreted as an integer" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate time series of population- and area-averaged firing rates.\n", @@ -1018,7 +775,8 @@ " - 'alpha_time_window' : time constant of the alpha function\n", " - 'rect_time_window' : width of the moving rectangular function\n", "\"\"\"\n", - "A.create_rate_time_series()" + "A.create_rate_time_series()\n", + "print(\"Computing rate time series done\")" ] }, { @@ -1061,7 +819,6 @@ "cell_type": "markdown", "id": "38ddd973", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -1090,7 +847,6 @@ "cell_type": "markdown", "id": "ae19bcc3", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ diff --git a/multi-area-model.ipynb b/multi-area-model.ipynb index 6bd2724fa1adc3a3289080a712057c3e26bfdab3..424e235ba560e9c0035f828a2996190b8a05b1d8 100644 --- a/multi-area-model.ipynb +++ b/multi-area-model.ipynb @@ -58,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "06e7f341-c226-4782-a913-4868027d7d06", "metadata": {}, "outputs": [], @@ -76,34 +76,12 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "96517739", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " -- N E S T --\n", - " Copyright (C) 2004 The NEST Initiative\n", - "\n", - " Version: 3.4\n", - " Built: May 17 2023 20:48:31\n", - "\n", - " This program is provided AS IS and comes with\n", - " NO WARRANTY. See the file LICENSE for details.\n", - "\n", - " Problems or suggestions?\n", - " Visit https://www.nest-simulator.org\n", - "\n", - " Type 'nest.help()' to find out more about NEST.\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "# Import dependencies\n", "%matplotlib inline\n", @@ -121,48 +99,22 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "7e07b0d0", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: nested_dict in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (1.61)\n", - "Requirement already satisfied: dicthash in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (0.0.2)\n", - "Requirement already satisfied: future in /srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/._view/6axslmv6jvf4v2nte3uwlayg4vhsjoha/lib/python3.8/site-packages (from dicthash) (0.18.2)\n" - ] - } - ], + "outputs": [], "source": [ "!pip install nested_dict dicthash" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "1d440c07-9b69-4e52-8573-26b13493bc5a", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "<style>\n", - "table {float:left}\n", - "</style>\n" - ], - "text/plain": [ - "<IPython.core.display.HTML object>" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# Jupyter notebook display format setting\n", "style = \"\"\"\n", @@ -240,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "60265d52", "metadata": {}, "outputs": [], @@ -269,7 +221,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "6e4bed8d", "metadata": {}, "outputs": [], @@ -360,70 +312,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ab25f9f8", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Initializing network from dictionary.\n", - "RAND_DATA_LABEL 1337\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440: RuntimeWarning:Mean of empty slice.\n", - "/srv/main-spack-instance-2302/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0/py-numpy-1.21.6-6fewtq7oarp3vtwlxrrcofz5sxwt55s7/lib/python3.8/site-packages/numpy/core/_methods.py:189: RuntimeWarning:invalid value encountered in double_scalars\n", - "Error in library(\"aod\") : there is no package called ‘aod’\n", - "Execution halted\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "No R installation or IndexError, taking hard-coded SLN fit parameters.\n", - "\n", - "\n", - "========================================\n", - "Customized parameters\n", - "--------------------\n", - "{'K_scaling': 0.005,\n", - " 'N_scaling': 0.005,\n", - " 'connection_params': {'K_stable': 'K_stable.npy',\n", - " 'av_indegree_V1': 3950.0,\n", - " 'fac_nu_ext_5E': 1.125,\n", - " 'fac_nu_ext_6E': 1.41666667,\n", - " 'fac_nu_ext_TH': 1.2,\n", - " 'g': -11.0,\n", - " 'replace_non_simulated_areas': 'het_poisson_stat'},\n", - " 'fullscale_rates': 'tests/fullscale_rates.json',\n", - " 'input_params': {'rate_ext': 10.0},\n", - " 'neuron_params': {'V0_mean': -150.0, 'V0_sd': 50.0}}\n", - "========================================\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/srv/main-spack-instance-2302/spack/var/spack/environments/ebrains-23-02/.spack-env/view/lib/python3.8/site-packages/dicthash/dicthash.py:47: UserWarning:Float too small for safe conversion tointeger. Rounding down to zero.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Simulation label: 27d81076e6d6e9e591684be053078477\n", - "Copied files.\n", - "Initialized simulation class.\n" - ] - } - ], + "outputs": [], "source": [ "M = MultiAreaModel(network_params, \n", " simulation=True,\n", @@ -442,19 +334,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "6a7ddf0e", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Iteration: 0\n", - "Mean-field theory predicts an average firing rate of 29.588 spikes/s across all populations.\n" - ] - } - ], + "outputs": [], "source": [ "p, r = M.theory.integrate_siegert()\n", "print(\"Mean-field theory predicts an average \"\n", @@ -487,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "6316ac24", "metadata": {}, "outputs": [], @@ -507,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "445a722a", "metadata": {}, "outputs": [], @@ -535,85 +418,10 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "15778e9c", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Prepared simulation in 0.00 seconds.\n", - "Rank 0: created area V1 with 0 local nodes\n", - "Memory after V1 : 1912.18 MB\n", - "Rank 0: created area V2 with 0 local nodes\n", - "Memory after V2 : 1938.77 MB\n", - "Rank 0: created area VP with 0 local nodes\n", - "Memory after VP : 1967.96 MB\n", - "Rank 0: created area V3 with 0 local nodes\n", - "Memory after V3 : 1996.37 MB\n", - "Rank 0: created area V3A with 0 local nodes\n", - "Memory after V3A : 2016.16 MB\n", - "Rank 0: created area MT with 0 local nodes\n", - "Memory after MT : 2041.82 MB\n", - "Rank 0: created area V4t with 0 local nodes\n", - "Memory after V4t : 2066.77 MB\n", - "Rank 0: created area V4 with 0 local nodes\n", - "Memory after V4 : 2093.83 MB\n", - "Rank 0: created area VOT with 0 local nodes\n", - "Memory after VOT : 2119.02 MB\n", - "Rank 0: created area MSTd with 0 local nodes\n", - "Memory after MSTd : 2140.49 MB\n", - "Rank 0: created area PIP with 0 local nodes\n", - "Memory after PIP : 2161.88 MB\n", - "Rank 0: created area PO with 0 local nodes\n", - "Memory after PO : 2183.39 MB\n", - "Rank 0: created area DP with 0 local nodes\n", - "Memory after DP : 2203.54 MB\n", - "Rank 0: created area MIP with 0 local nodes\n", - "Memory after MIP : 2225.20 MB\n", - "Rank 0: created area MDP with 0 local nodes\n", - "Memory after MDP : 2246.55 MB\n", - "Rank 0: created area VIP with 0 local nodes\n", - "Memory after VIP : 2268.49 MB\n", - "Rank 0: created area LIP with 0 local nodes\n", - "Memory after LIP : 2292.55 MB\n", - "Rank 0: created area PITv with 0 local nodes\n", - "Memory after PITv : 2317.89 MB\n", - "Rank 0: created area PITd with 0 local nodes\n", - "Memory after PITd : 2343.11 MB\n", - "Rank 0: created area MSTl with 0 local nodes\n", - "Memory after MSTl : 2364.57 MB\n", - "Rank 0: created area CITv with 0 local nodes\n", - "Memory after CITv : 2383.63 MB\n", - "Rank 0: created area CITd with 0 local nodes\n", - "Memory after CITd : 2403.08 MB\n", - "Rank 0: created area FEF with 0 local nodes\n", - "Memory after FEF : 2424.43 MB\n", - "Rank 0: created area TF with 0 local nodes\n", - "Memory after TF : 2440.11 MB\n", - "Rank 0: created area AITv with 0 local nodes\n", - "Memory after AITv : 2462.79 MB\n", - "Rank 0: created area FST with 0 local nodes\n", - "Memory after FST : 2479.56 MB\n", - "Rank 0: created area 7a with 0 local nodes\n", - "Memory after 7a : 2500.77 MB\n", - "Rank 0: created area STPp with 0 local nodes\n", - "Memory after STPp : 2519.49 MB\n", - "Rank 0: created area STPa with 0 local nodes\n", - "Memory after STPa : 2538.51 MB\n", - "Rank 0: created area 46 with 0 local nodes\n", - "Memory after 46 : 2554.00 MB\n", - "Rank 0: created area AITd with 0 local nodes\n", - "Memory after AITd : 2576.55 MB\n", - "Rank 0: created area TH with 0 local nodes\n", - "Memory after TH : 2589.27 MB\n", - "Created areas and internal connections in 2.19 seconds.\n", - "Created cortico-cortical connections in 22.45 seconds.\n", - "Simulated network in 78.41 seconds.\n" - ] - } - ], + "outputs": [], "source": [ "# run the simulation, depending on the model parameter and downscale ratio, the running time varies largely.\n", "M.simulation.simulate()" @@ -656,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dc3b1820", "metadata": {}, "outputs": [], @@ -690,7 +498,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "e7eb052e", "metadata": {}, "outputs": [], @@ -713,7 +521,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "902f2800", "metadata": {}, "outputs": [], @@ -755,7 +563,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "f5b58845-4d1a-430f-83f4-402fdf918aef", "metadata": { "tags": [] @@ -768,20 +576,12 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "6607a73d-1c74-4848-9603-081ad0e7cae8", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "loading spikes\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Analysis class.\n", @@ -812,7 +612,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "c471e9c8-b1e4-43e4-a6a1-443b8b8963be", "metadata": { "tags": [] @@ -827,21 +627,12 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "1870cf34-ee62-4614-bc25-c36bc9a7377c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Stored data have been computed with different parameters\n", - "Computing population rates\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate time-averaged population rates and store them in member pop_rates.\n", @@ -868,25 +659,18 @@ " If set to 'complete', all populations the respective areas\n", " are included. Defaults to 'complete'.\n", "\"\"\"\n", - "A.create_pop_rates()" + "A.create_pop_rates()\n", + "print(\"Computing population rates done\")" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "50b7df89", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing synchrony\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate synchrony as the coefficient of variation of the population rate\n", @@ -913,25 +697,18 @@ "resolution : float, optional\n", " Resolution of the population rate. Defaults to 1 ms.\n", "\"\"\"\n", - "A.create_synchrony()" + "A.create_synchrony()\n", + "print(\"Computing synchrony done\")" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d43b493c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing population LvR\n" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate poulation-averaged LvR (see Shinomoto et al. 2009) and\n", @@ -953,37 +730,18 @@ " If set to 'complete', all populations the respective areas\n", " are included. Defaults to 'complete'.\n", "\"\"\"\n", - "A.create_pop_LvR()" + "A.create_pop_LvR()\n", + "print(\"Computing population LvR done\")" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "401ece2d-47c8-4775-80ae-92a8e432520c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing rate time series\n" - ] - }, - { - "ename": "TypeError", - "evalue": "object of type 'float' has no len()", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [21]\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124;03mCalculate time series of population- and area-averaged firing rates.\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124;03mUses ah.pop_rate_time_series.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[38;5;124;03m - 'rect_time_window' : width of the moving rectangular function\u001b[39;00m\n\u001b[1;32m 32\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m---> 33\u001b[0m \u001b[43mA\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_rate_time_series\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/MAM2EBRAINS/multiarea_model/analysis.py:446\u001b[0m, in \u001b[0;36mAnalysis.create_rate_time_series\u001b[0;34m(self, **keywords)\u001b[0m\n\u001b[1;32m 439\u001b[0m time_series \u001b[38;5;241m=\u001b[39m ah\u001b[38;5;241m.\u001b[39mpop_rate_time_series(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspike_data[area][pop],\n\u001b[1;32m 440\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnetwork\u001b[38;5;241m.\u001b[39mN[area][pop],\n\u001b[1;32m 441\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt_min\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 442\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt_max\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 443\u001b[0m params[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mresolution\u001b[39m\u001b[38;5;124m'\u001b[39m],\n\u001b[1;32m 444\u001b[0m kernel\u001b[38;5;241m=\u001b[39mparams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mkernel\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[1;32m 445\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 446\u001b[0m time_series \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mnan\u001b[38;5;241m*\u001b[39mnp\u001b[38;5;241m.\u001b[39mones(\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mt_max\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mt_min\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 447\u001b[0m d_pops[area][pop] \u001b[38;5;241m=\u001b[39m time_series\n\u001b[1;32m 449\u001b[0m total_spikes \u001b[38;5;241m=\u001b[39m ah\u001b[38;5;241m.\u001b[39marea_spike_train(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mspike_data[area])\n", - "\u001b[0;31mTypeError\u001b[0m: object of type 'float' has no len()" - ] - } - ], + "outputs": [], "source": [ "\"\"\"\n", "Calculate time series of population- and area-averaged firing rates.\n", @@ -1017,7 +775,8 @@ " - 'alpha_time_window' : time constant of the alpha function\n", " - 'rect_time_window' : width of the moving rectangular function\n", "\"\"\"\n", - "A.create_rate_time_series()" + "A.create_rate_time_series()\n", + "print(\"Computing rate time series done\")" ] }, { diff --git a/multiarea_model/.ipynb_checkpoints/analysis-checkpoint.py b/multiarea_model/.ipynb_checkpoints/analysis-checkpoint.py index 878910dcfa11537c14f693b5f0e2fbce6d28bf6f..9c1fd318f52697bd90815dc6829c084ff6b06eab 100644 --- a/multiarea_model/.ipynb_checkpoints/analysis-checkpoint.py +++ b/multiarea_model/.ipynb_checkpoints/analysis-checkpoint.py @@ -443,7 +443,7 @@ class Analysis: params['resolution'], kernel=params['kernel']) else: - time_series = np.nan*np.ones(len(params['t_max'] - params['t_min'])) + time_series = np.nan*np.ones(int(params['t_max'] - params['t_min'])) d_pops[area][pop] = time_series total_spikes = ah.area_spike_train(self.spike_data[area]) diff --git a/multiarea_model/analysis.py b/multiarea_model/analysis.py index 878910dcfa11537c14f693b5f0e2fbce6d28bf6f..9c1fd318f52697bd90815dc6829c084ff6b06eab 100644 --- a/multiarea_model/analysis.py +++ b/multiarea_model/analysis.py @@ -443,7 +443,7 @@ class Analysis: params['resolution'], kernel=params['kernel']) else: - time_series = np.nan*np.ones(len(params['t_max'] - params['t_min'])) + time_series = np.nan*np.ones(int(params['t_max'] - params['t_min'])) d_pops[area][pop] = time_series total_spikes = ah.area_spike_train(self.spike_data[area])