Skip to content

Commit

Permalink
Merge branch 'fix_tau_m'
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzlayer committed Mar 5, 2022
2 parents 07a62ca + 42ecf18 commit a1e7593
Show file tree
Hide file tree
Showing 17 changed files with 305 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
author = 'Moritz Layer, Johanna Senk, Simon Essink, Alexander van Meegen, Hannah Bos, Moritz Helias'

# The full version, including alpha/beta/rc tags
release = '1.0.1'
release = '1.0.2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/lif.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Here you find how variables of LIF neurons are named in NNMT:
* - Standard deviation of synaptic input
- :math:`\boldsymbol{\sigma}`
- ``sigma``
* - Membrane time constant
* - Post-synaptic membrane time constant
- :math:`\tau_\mathrm{m}`
- ``tau_m``
* - Refractory time
Expand Down
14 changes: 14 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
Release notes
=============

**********
NNMT 1.0.2
**********

- Fix calculation of mean input and std input for lif.exp. Previously ``tau_m``
was multiplied with the firing rates before the dot product with the
connectivity. However, as ``tau_m`` is representing the post-synaptic
membrane time constant, it should be multiplied after performing the dot
product.
- Fix explanation of ``tau_m`` in docstrings.
- Add new integration test for lif.exp._firing_rates with vector parameters.
- Fix docopt usage in fixture creation for unit and integration fixtures.


**********
NNMT 1.0.1
**********
Expand Down
2 changes: 1 addition & 1 deletion nnmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
from . import models
from . import lif

__version__ = '1.0.1'
__version__ = '1.0.2'
8 changes: 4 additions & 4 deletions nnmt/lif/_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _mean_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand All @@ -245,7 +245,7 @@ def _mean_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
Array of mean inputs to each population in V.
"""
# contribution from within the network
m0 = np.dot(K * J, tau_m * nu)
m0 = tau_m * np.dot(K * J, nu)
# contribution from external sources
m_ext = tau_m * np.dot(K_ext * J_ext, nu_ext)
# add them up
Expand All @@ -268,7 +268,7 @@ def _std_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand All @@ -282,7 +282,7 @@ def _std_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
Array of standard deviation of inputs to each population in V.
"""
# contribution from within the network to variance
var0 = np.dot(K * J**2, tau_m * nu)
var0 = tau_m * np.dot(K * J**2, nu)
# contribution from external sources to variance
var_ext = tau_m * np.dot(K_ext * J_ext**2, nu_ext)
# add them up
Expand Down
14 changes: 7 additions & 7 deletions nnmt/lif/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _firing_rates(J, K, V_0_rel, V_th_rel, tau_m, tau_r, J_ext, K_ext, nu_ext,
V_th_rel : [float | 1d array]
Relative threshold potential in V.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
J_ext : np.array
Expand Down Expand Up @@ -163,7 +163,7 @@ def _firing_rates_for_given_input(V_0_rel, V_th_rel, mu, sigma, tau_m, tau_r):
sigma : [float | 1d array]
Standard deviation of input to population of neurons.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
Expand Down Expand Up @@ -326,7 +326,7 @@ def _mean_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand All @@ -340,7 +340,7 @@ def _mean_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
Array of mean inputs to each population in V.
"""
return _general._mean_input(nu, J, K, tau_m,
J_ext, K_ext, nu_ext)
J_ext, K_ext, nu_ext)


def std_input(network):
Expand Down Expand Up @@ -390,7 +390,7 @@ def _std_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand All @@ -404,7 +404,7 @@ def _std_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
Array of mean inputs to each population in V.
"""
return _general._std_input(nu, J, K, tau_m,
J_ext, K_ext, nu_ext)
J_ext, K_ext, nu_ext)


def _derivative_of_firing_rates_wrt_mean_input(V_0_rel, V_th_rel, mu, sigma,
Expand All @@ -425,7 +425,7 @@ def _derivative_of_firing_rates_wrt_mean_input(V_0_rel, V_th_rel, mu, sigma,
sigma : float
Standard deviation of neuron activity in V.
tau_m : float
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : float
Refractory time in s.
Expand Down
34 changes: 17 additions & 17 deletions nnmt/lif/exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def _firing_rates(J, K, V_0_rel, V_th_rel, tau_m, tau_r, tau_s, J_ext, K_ext,
V_th_rel : [float | 1d array]
Relative threshold potential in V.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
tau_s : float
Expand Down Expand Up @@ -254,7 +254,7 @@ def _firing_rate_shift(V_0_rel, V_th_rel, mu, sigma, tau_m, tau_r, tau_s):
sigma : [float | np.array]
Standard deviation of neuron activity in V.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
tau_s : float
Expand Down Expand Up @@ -302,7 +302,7 @@ def _firing_rate_taylor(V_0_rel, V_th_rel, mu, sigma, tau_m, tau_r, tau_s):
sigma : [float | np.array]
Standard deviation of neuron activity in V.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
tau_s : float
Expand Down Expand Up @@ -436,7 +436,7 @@ def mean_input(network):
K : np.array
Indegree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand Down Expand Up @@ -479,7 +479,7 @@ def _mean_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand Down Expand Up @@ -543,7 +543,7 @@ def _std_input(nu, J, K, tau_m, J_ext, K_ext, nu_ext):
K : np.array
In-degree matrix.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J_ext : np.array
External weight matrix in V.
K_ext : np.array
Expand Down Expand Up @@ -637,7 +637,7 @@ def _transfer_function(mu, sigma, tau_m, tau_s, tau_r, V_th_rel, V_0_rel,
sigma : [float | np.array]
Standard deviation of neuron activity of one population in V.
tau_m : [float | np.array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_s : float
Pre-synaptic time constant in s.
tau_r : [float | np.array]
Expand Down Expand Up @@ -703,7 +703,7 @@ def _transfer_function_shift(mu, sigma, tau_m, tau_s, tau_r, V_th_rel,
sigma : [float | np.array]
Standard deviation of neuron activity of one population in V.
tau_m : [float | np.array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_s : float
Pre-synaptic time constant in s.
tau_r : [float | np.array]
Expand Down Expand Up @@ -795,7 +795,7 @@ def _transfer_function_taylor(mu, sigma, tau_m, tau_s, tau_r, V_th_rel,
sigma : [float | np.array]
Standard deviation of neuron activity of one population in V.
tau_m : [float | np.array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_s : float
Pre-synaptic time constant in s.
tau_r : [float | np.array]
Expand Down Expand Up @@ -933,7 +933,7 @@ def _fit_transfer_function(transfer_function, omegas, tau_m, J, K):
omegas : [float | np.ndarray]
Input frequencies to population in Hz.
tau_m : float
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
J : np.array
Weight matrix in V.
K : np.array
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def _derivative_of_firing_rates_wrt_mean_input(V_0_rel, V_th_rel, mu, sigma,
Parameters
----------
tau_m : [float | np.ndarray]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_s : float
Pre-synaptic time constant in s.
tau_r : [float | np.ndarray]
Expand Down Expand Up @@ -1053,9 +1053,9 @@ def _Phi(s):
def _Psi(z, x):
"""
Calcs Psi(z,x)=exp(x**2/4)*U(z,x), with U(z,x) the parabolic cylinder func.
The mpmath.pcfu() is equivalent to Eq. 19.12.3 in:cite:t:`Abramowitz74`
with U(a,-x). The arguments (a, z) of mpmath.pcfu() used in the
with U(a,-x). The arguments (a, z) of mpmath.pcfu() used in the
documentation https://mpmath.org/doc/current/functions/bessel.html?highlight=pcfu#mpmath.pcfu
are renamed to (z, x) here.
"""
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def _derivative_of_firing_rates_wrt_input_rate(
sigma :
Standard deviation of neuron activity in V.
tau_m : [float | np.ndarray]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_s : float
Pre-synaptic time constant in s.
tau_r : [float | np.ndarray]
Expand Down Expand Up @@ -1232,7 +1232,7 @@ def _effective_connectivity(transfer_function, D, J, K, tau_m):
K : np.ndarray
Indegree matrix.
tau_m : float
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
Returns
-------
Expand Down Expand Up @@ -1790,7 +1790,7 @@ def _power_spectra(nu, effective_connectivity, J, K, N, tau_m):
N : np.ndarray
Number of neurons in each population.
tau_m : [float | np.narray]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
Returns
-------
Expand Down Expand Up @@ -1883,7 +1883,7 @@ def _external_rates_for_fixed_input(mu_set, sigma_set,
V_0_rel : [float | np.array]
Relative reset potential in V.
tau_m : [float | 1d array]
Membrane time constant in s.
Membrane time constant of post-synatic neuron in s.
tau_r : [float | 1d array]
Refractory time in s.
tau_s : float
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='nnmt',
version='1.0.1',
version='1.0.2',
description='Neuronal Network Meanfield Toolbox',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down
Loading

0 comments on commit a1e7593

Please sign in to comment.