Skip to content

Commit

Permalink
V0.2.1 (#30)
Browse files Browse the repository at this point in the history
* update environment, change to pyproject.toml convention

* update test and score list in readme

* update environment

* update environment
  • Loading branch information
rgutzen authored Dec 21, 2023
1 parent 6997ddd commit 773dda4
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 94 deletions.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018, NetworkUnit authors and contributors
Copyright (c) 2018-2023, NetworkUnit authors and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -7,4 +7,4 @@ Redistribution and use in source and binary forms, with or without modification,
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

51 changes: 29 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,53 +58,60 @@ accessible via the launch-binder button at the top.

Overview of tests
-----------------
=================================== ======================= ===================================================
=================================== ======================= ======================================================
Class name Parent class Prediction measure
=================================== ======================= ===================================================
=================================== ======================= ======================================================
two_sample_test \- \-
firing_rate_test two_sample_test firing rates
isi_variation_test two_sample_test inter-spike-intervals, their CV, CV2, LV, or LVR
covariance_test two_sample_test covariances
correlation_test two_sample_test \-
correlation_dist_test correlation_test correlation coefficients
correlation_matrix_test correlation_test correlation coefficient matrix
avg_std_correlation_test correlation_test avg or std of correlation coefficients
generalized_correlation_matrix_test correlation_matrix_test matrix of derived cross-correlation measures
eigenvalue_test correlation_test eigenvalues of the correlation coefficient matrix
covariance_test two_sample_test covariances
firing_rate_test two_sample_test firing rates
isi_variation_test two_sample_test inter-spike-intervals, their CV, or LV
power_spectrum_test two_sample_test power spectral density values
freqband_power_test power_spectrum_test power spectral density values in frequency band
timescale_test two_sample_test spike train timescale
graph_centrality_helperclass sciunit.Test graph centrality measures of given adjacency matrix
=================================== ======================= ===================================================
joint_test two_sample_test joining other test classes for multivariate evaluation
=================================== ======================= ======================================================

Inheritance order in case of multiple inheritance for derived test classes:

.. code:: python
.. code:: Python
class new_test(sciunit.TestM2M, graph_centrality_helperclass, <base_test_class>)
class new_test(sciunit.TestM2M, graph_centrality_helperclass, <base_test_class>)
Overview of scores
------------------
================ =============================== ===================
Class name Test name Comparison measure
================ =============================== ===================
students_t Student't test sample mean
ks_distance Kolmogorov-Smirnov test sample distribution
kl_divergence Kullback-Leibler divergence sample entropy
mwu_statistic Mann-Whitney U test rank sum
levene_score Levene's test sample variance
effect_size Effect size standardized mean
best_effect_size Bayesian estimation effect size standardized mean
================ =============================== ===================
==================== =============================== ===========================
Class name Test name Comparison measure
==================== =============================== ===========================
students_t Student't test sample mean
ks_distance Kolmogorov-Smirnov test sample distribution
kl_divergence Kullback-Leibler divergence sample entropy
mwu_statistic Mann-Whitney U test rank sum
levene_score Levene's test sample variance
effect_size Effect size standardized mean
best_effect_size Bayesian estimation effect size standardized mean
wasserstein_distance Wasserstein Distance multivariate score distance
eigenangle Eigenangle Test eigenangle similarity
==================== =============================== ===========================
Overview of model classes
-------------------------
=================== =================== =============== ==================================
=================== =================== ===================== ==================================
Model name Capability Parent class Purpose
=================== =================== =============== ==================================
=================== =================== ===================== ==================================
loaded_spiketrains ProducesSpikeTrains sciunit.RunnableModel loading simulated spiking data
stochastic_activity ProducesSpikeTrains sciunit.RunnableModel generating stochastic spiking data
nest_simulation ProducesSpikeTrains sciunit.RunnableModel template for NEST models
=================== =================== =============== ==================================
=================== =================== ===================== ==================================
Other validation test repositories
----------------------------------
Expand Down
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: networkunit_env
channels:
- damianavila82
- defaults
dependencies:
- rise
- pip
- pip:
- jupyter==1.0.0
Expand Down
2 changes: 1 addition & 1 deletion networkunit/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0dev
0.2.1
6 changes: 4 additions & 2 deletions networkunit/scores/best_effect_size.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
The Baysian Estimation Effect Size is introduced in Kruschke, J. (2012)
doi:10.1037/a0029146
"""
from __future__ import division
import numpy as np
import sciunit
Expand All @@ -16,8 +20,6 @@
class best_effect_size(sciunit.Score):
"""
Baysian Estimation Effect Size according to Kruschke, J. (2012)
'Bayesian estimation supersedes the t-test',
Journal of Experimental Psychology
Requires the test parameters:
mcmc_iter : int (default 110000)
Expand Down
7 changes: 5 additions & 2 deletions networkunit/scores/eigenangle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""
The Eigenangle Test is introduced in Gutzen, Grün, Denker (2023)
doi:10.1016/j.biosystems.2022.104813
"""
import numpy as np
from scipy.linalg import eigh
from scipy.special import binom
from scipy.integrate import quad
import matplotlib.pyplot as plt
import seaborn as sns
Expand All @@ -18,7 +21,7 @@ class eigenangle(sciunit.Score):
similar non-random elements by calculating the significance of the angles
between the corresponding eigenvectors.
Either the bin_size or the number of bins must be provides to perform the
signficnace test.
significance test.
"""
score = np.nan

Expand Down
2 changes: 1 addition & 1 deletion networkunit/tests/timescale_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def generate_prediction(self, model):

def calc_timescales(self, spiketrain):
if len(spiketrain.times) >= self.params['min_spikecount']:
bst = BinnedSpikeTrain(st, bin_size=self.params['bin_size'])
bst = BinnedSpikeTrain(spiketrain, bin_size=self.params['bin_size'])
tau = timescale(bst, self.params['tau_max'])
tau = tau.rescale('ms').magnitude
else:
Expand Down
68 changes: 68 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[project]
name = "networkunit"
description = "A SciUnit library for validation testing of spiking networks."
version = "0.2.1"
readme = "README.rst"
authors = [
{ name = "NetworkUnit authors and contributors", email = "[email protected]" }
]

requires-python = ">=3.8"
dependencies = [
"nbconvert == 7.12.0", #remove when updating sciunit version
"sciunit == 0.2.7",
"elephant >= 0.7.0",
"neo >= 0.9",
"networkx >= 2.1",
"tabulate >= 0.8.2",
"seaborn >= 0.8.1",
"numpy >= 1.15.3",
"opencv-python"
]

[metadata]
description-file = "README.md"
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD-3-Clause",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules"
]

[project.urls]
"Homepage" = "https://github.com/INM-6/networkunit"
"Bug Tracker" = "https://github.com/INM-6/networkunit/issues"

[project.scripts]

[project.optional-dependencies]
dev = [
"black",
"bump2version",
"flake8",
"mypy",
"pre-commit",
"pydocstyle",
"pylint",
"pytest",
"pytest-black",
"pytest-cov",
"pytest-flake8",
"pytest-mypy",
"pytest-pydocstyle",
"pytest-pylint",
"pytest-xdist",
]
doc = [
"sphinx",
"sphinx-autodoc-typehints",
"numpydoc>=1.1.0",
"sphinx-tabs>=1.3.0",
"sphinx-argparse>=0.4.0",
"pygments",
"recommonmark",
]

[build-system]
build-backend = "flit_core.buildapi"
requires = ["flit_core >=3.2,<4"]
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

50 changes: 4 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,6 @@
# -*- coding: utf-8 -*-
# encoding: utf8
'Packaging configuration.'

from setuptools import setup
import os
import sys
from setuptools import setup # type: ignore

long_description = open("README.rst").read()
with open('requirements.txt', 'r') as fp:
install_requires = fp.read()
extras_require = {}
for extra in ['docs']:
with open('requirements-{0}.txt'.format(extra)) as fp:
extras_require[extra] = fp.read()

setup(
name="networkunit",
version='0.2.0',
packages=['networkunit', 'figures', 'examples'],
package_data={'networkunit':[
os.path.join('tests','*.py'),
os.path.join('models','*.py'),
os.path.join('models/backends','*.py'),
os.path.join('capabilities','*.py'),
os.path.join('scores','*.py'),
os.path.join('plots','*.py'),
'VERSION'],
'figures':['*.png'],
'examples':['*.py', '*.ipynb']
},
install_requires=install_requires,
extras_require=extras_require,

author="NetworkUnit authors and contributors",
author_email="[email protected]",
description="A SciUnit library for validation testing of neural network models.",
long_description=long_description,
license="BSD",
url='https://github.com/INM-6/NetworkUnit',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering']
)
setup() # everything configured via pyproject.toml
22 changes: 22 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[pytest]
addopts = -n 0 --doctest-modules --pycodestyle --mypy --pylint --pylint-rcfile=.pylintrc --pydocstyle --cov --ignore=conda --ignore=env --ignore=.git --ignore=__pycache__

[pycodestyle]
count = False
#ignore = E226,E302,E41
exclude = .git/, .snakemake/, .pytest_cache/, sync-test-env/, conda/, env/
max-line-length = 120
statistics = True

# as suggested by pylint docs for joint usage with other tools
# http://pylint.pycqa.org/en/latest/faq.html?highlight=pylintrc#i-am-using-another-popular-linter-alongside-pylint-which-messages-should-i-disable-to-avoid-duplicates

[pylint]
options = unneeded-not, line-too-long, unnecessary-semicolon, trailing-whitespace, missing-final-newline, bad-indentation, multiple-statements, bare-except

[pydocstyle]
convention = numpy
add-ignore = D300

[mypy]
exclude = .git/, .snakemake/, .pytest_cache/, sync-test-env/, conda/, env/

0 comments on commit 773dda4

Please sign in to comment.