hnn-core 0.4rc4__tar.gz → 0.4.2.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hnn_core-0.4.2.dev1/PKG-INFO +215 -0
- hnn_core-0.4.2.dev1/README.md +121 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_batch_simulate.py +55 -18
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_connectivity.py +11 -1
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_simulate_mpi_backend.py +1 -1
- hnn_core-0.4.2.dev1/examples/workflows/README.txt +15 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/__init__.py +8 -2
- hnn_core-0.4.2.dev1/hnn_core/batch_simulate.py +496 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/cell.py +168 -136
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/cell_response.py +180 -108
- hnn_core-0.4.2.dev1/hnn_core/cells_default.py +444 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/check.py +5 -5
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/dipole.py +197 -126
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/docs.py +6 -18
- hnn_core-0.4.2.dev1/hnn_core/drives.py +485 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/externals/bayesopt.py +15 -12
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/externals/mne.py +367 -138
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/extracellular.py +203 -128
- hnn_core-0.4.2.dev1/hnn_core/gui/__init__.py +1 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/gui/_viz_manager.py +577 -361
- hnn_core-0.4.2.dev1/hnn_core/gui/gui.py +2760 -0
- hnn_core-0.4.2.dev1/hnn_core/hnn_io.py +505 -0
- hnn_core-0.4.2.dev1/hnn_core/mod/vecevent.mod +175 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mpi_child.py +20 -17
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/network.py +699 -411
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/network_builder.py +97 -83
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/network_models.py +190 -141
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/optimization/general_optimization.py +107 -72
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/optimization/objective_functions.py +39 -20
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/optimization/optimize_evoked.py +280 -208
- hnn_core-0.4.2.dev1/hnn_core/parallel_backends.py +1026 -0
- hnn_core-0.4.2.dev1/hnn_core/params.py +863 -0
- hnn_core-0.4.2.dev1/hnn_core/params_default.py +316 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/conftest.py +55 -34
- hnn_core-0.4.2.dev1/hnn_core/tests/regenerate_test_network.py +121 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_batch_simulate.py +317 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_cell.py +51 -65
- hnn_core-0.4.2.dev1/hnn_core/tests/test_cell_response.py +206 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_cells_default.py +20 -14
- hnn_core-0.4.2.dev1/hnn_core/tests/test_dipole.py +346 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_drives.py +739 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_extracellular.py +346 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_general_optimization.py +391 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_gui.py +558 -328
- hnn_core-0.4.2.dev1/hnn_core/tests/test_io.py +347 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_mpi_child.py +47 -38
- hnn_core-0.4.2.dev1/hnn_core/tests/test_network.py +1470 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_optimize_evoked.py +230 -0
- hnn_core-0.4.2.dev1/hnn_core/tests/test_parallel_backends.py +438 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_params.py +71 -72
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/tests/test_utils.py +12 -9
- hnn_core-0.4.2.dev1/hnn_core/tests/test_viz.py +703 -0
- hnn_core-0.4.2.dev1/hnn_core/utils.py +138 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/viz.py +897 -350
- hnn_core-0.4.2.dev1/hnn_core.egg-info/PKG-INFO +215 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core.egg-info/SOURCES.txt +2 -3
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core.egg-info/requires.txt +16 -10
- hnn_core-0.4.2.dev1/pyproject.toml +20 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/setup.cfg +0 -4
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/setup.py +10 -11
- hnn_core-0.4rc4/PKG-INFO +0 -290
- hnn_core-0.4rc4/README.rst +0 -216
- hnn_core-0.4rc4/examples/workflows/README.txt +0 -17
- hnn_core-0.4rc4/hnn_core/batch_simulate.py +0 -450
- hnn_core-0.4rc4/hnn_core/cells_default.py +0 -436
- hnn_core-0.4rc4/hnn_core/drives.py +0 -440
- hnn_core-0.4rc4/hnn_core/gui/__init__.py +0 -1
- hnn_core-0.4rc4/hnn_core/gui/gui.py +0 -2257
- hnn_core-0.4rc4/hnn_core/hnn_io.py +0 -494
- hnn_core-0.4rc4/hnn_core/mod/vecevent.mod +0 -69
- hnn_core-0.4rc4/hnn_core/parallel_backends.py +0 -742
- hnn_core-0.4rc4/hnn_core/param/base.json +0 -208
- hnn_core-0.4rc4/hnn_core/param/empty.json +0 -1
- hnn_core-0.4rc4/hnn_core/params.py +0 -785
- hnn_core-0.4rc4/hnn_core/params_default.py +0 -364
- hnn_core-0.4rc4/hnn_core/tests/test_batch_simulate.py +0 -282
- hnn_core-0.4rc4/hnn_core/tests/test_cell_response.py +0 -165
- hnn_core-0.4rc4/hnn_core/tests/test_dipole.py +0 -302
- hnn_core-0.4rc4/hnn_core/tests/test_drives.py +0 -534
- hnn_core-0.4rc4/hnn_core/tests/test_extracellular.py +0 -288
- hnn_core-0.4rc4/hnn_core/tests/test_general_optimization.py +0 -305
- hnn_core-0.4rc4/hnn_core/tests/test_io.py +0 -366
- hnn_core-0.4rc4/hnn_core/tests/test_network.py +0 -1147
- hnn_core-0.4rc4/hnn_core/tests/test_optimize_evoked.py +0 -180
- hnn_core-0.4rc4/hnn_core/tests/test_parallel_backends.py +0 -262
- hnn_core-0.4rc4/hnn_core/tests/test_viz.py +0 -404
- hnn_core-0.4rc4/hnn_core/utils.py +0 -97
- hnn_core-0.4rc4/hnn_core.egg-info/PKG-INFO +0 -290
- hnn_core-0.4rc4/pyproject.toml +0 -9
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/LICENSE +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/MANIFEST.in +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/README.txt +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/README.txt +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/optimize_evoked.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/optimize_rhythmic.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_firing_pattern.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_hnn_animation.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/howto/plot_record_extracellular_potentials.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/workflows/plot_simulate_alpha.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/workflows/plot_simulate_beta.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/workflows/plot_simulate_evoked.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/workflows/plot_simulate_gamma.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/examples/workflows/plot_simulate_somato.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/externals/__init__.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/gui/_logging.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/gui/hnn_widget.ipynb +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/ar.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/ca.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/cad.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/cat.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/dipole.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/dipole_pp.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/hh2.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/kca.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/mod/km.mod +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/optimization/__init__.py +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/param/N20.json +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/param/default.json +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/param/gamma_L5weak_L2weak.json +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core/param/jones2009_base.json +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core.egg-info/dependency_links.txt +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core.egg-info/entry_points.txt +0 -0
- {hnn_core-0.4rc4 → hnn_core-0.4.2.dev1}/hnn_core.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hnn-core
|
|
3
|
+
Version: 0.4.2.dev1
|
|
4
|
+
Summary: Code for biophysical simulation of a cortical column using Neuron
|
|
5
|
+
Home-page:
|
|
6
|
+
Download-URL: http://github.com/jonescompneurolab/hnn-core
|
|
7
|
+
Maintainer: Mainak Jas
|
|
8
|
+
Maintainer-email: mainakjas@gmail.com
|
|
9
|
+
License: BSD (3-clause)
|
|
10
|
+
Platform: any
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Topic :: Software Development
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Operating System :: MacOS
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=1.14
|
|
25
|
+
Requires-Dist: NEURON>=7.7; platform_system != "Windows"
|
|
26
|
+
Requires-Dist: matplotlib>=3.5.3
|
|
27
|
+
Requires-Dist: scipy
|
|
28
|
+
Requires-Dist: h5io
|
|
29
|
+
Provides-Extra: opt
|
|
30
|
+
Requires-Dist: scikit-learn; extra == "opt"
|
|
31
|
+
Provides-Extra: parallel
|
|
32
|
+
Requires-Dist: joblib; extra == "parallel"
|
|
33
|
+
Requires-Dist: psutil; extra == "parallel"
|
|
34
|
+
Provides-Extra: test
|
|
35
|
+
Requires-Dist: codespell; extra == "test"
|
|
36
|
+
Requires-Dist: pytest; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-xdist; extra == "test"
|
|
39
|
+
Requires-Dist: ruff; extra == "test"
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
Requires-Dist: mne; extra == "docs"
|
|
42
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
43
|
+
Requires-Dist: nibabel; extra == "docs"
|
|
44
|
+
Requires-Dist: numpydoc; extra == "docs"
|
|
45
|
+
Requires-Dist: pillow; extra == "docs"
|
|
46
|
+
Requires-Dist: pooch; extra == "docs"
|
|
47
|
+
Requires-Dist: pydata-sphinx-theme; extra == "docs"
|
|
48
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
49
|
+
Requires-Dist: sphinx-gallery; extra == "docs"
|
|
50
|
+
Requires-Dist: sphinx-copybutton; extra == "docs"
|
|
51
|
+
Requires-Dist: tdqm; extra == "docs"
|
|
52
|
+
Provides-Extra: gui
|
|
53
|
+
Requires-Dist: ipywidgets>=8.0.0; extra == "gui"
|
|
54
|
+
Requires-Dist: ipykernel; extra == "gui"
|
|
55
|
+
Requires-Dist: ipympl; extra == "gui"
|
|
56
|
+
Requires-Dist: voila; extra == "gui"
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: scikit-learn; extra == "dev"
|
|
59
|
+
Requires-Dist: joblib; extra == "dev"
|
|
60
|
+
Requires-Dist: psutil; extra == "dev"
|
|
61
|
+
Requires-Dist: codespell; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest; extra == "dev"
|
|
63
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
64
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
65
|
+
Requires-Dist: ruff; extra == "dev"
|
|
66
|
+
Requires-Dist: mne; extra == "dev"
|
|
67
|
+
Requires-Dist: myst-parser; extra == "dev"
|
|
68
|
+
Requires-Dist: nibabel; extra == "dev"
|
|
69
|
+
Requires-Dist: numpydoc; extra == "dev"
|
|
70
|
+
Requires-Dist: pillow; extra == "dev"
|
|
71
|
+
Requires-Dist: pooch; extra == "dev"
|
|
72
|
+
Requires-Dist: pydata-sphinx-theme; extra == "dev"
|
|
73
|
+
Requires-Dist: sphinx; extra == "dev"
|
|
74
|
+
Requires-Dist: sphinx-gallery; extra == "dev"
|
|
75
|
+
Requires-Dist: sphinx-copybutton; extra == "dev"
|
|
76
|
+
Requires-Dist: tdqm; extra == "dev"
|
|
77
|
+
Requires-Dist: ipywidgets>=8.0.0; extra == "dev"
|
|
78
|
+
Requires-Dist: ipykernel; extra == "dev"
|
|
79
|
+
Requires-Dist: ipympl; extra == "dev"
|
|
80
|
+
Requires-Dist: voila; extra == "dev"
|
|
81
|
+
Dynamic: classifier
|
|
82
|
+
Dynamic: description
|
|
83
|
+
Dynamic: description-content-type
|
|
84
|
+
Dynamic: download-url
|
|
85
|
+
Dynamic: license
|
|
86
|
+
Dynamic: license-file
|
|
87
|
+
Dynamic: maintainer
|
|
88
|
+
Dynamic: maintainer-email
|
|
89
|
+
Dynamic: platform
|
|
90
|
+
Dynamic: provides-extra
|
|
91
|
+
Dynamic: requires-dist
|
|
92
|
+
Dynamic: requires-python
|
|
93
|
+
Dynamic: summary
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<h1 align="center">
|
|
97
|
+
<img src="https://raw.githubusercontent.com/jonescompneurolab/jones-website/master/images/frontpage/logos/logo-hnn-medium.png" width="300">
|
|
98
|
+
</h1><br>
|
|
99
|
+
|
|
100
|
+
# hnn-core
|
|
101
|
+
|
|
102
|
+
[](https://github.com/jonescompneurolab/hnn-core/actions/?query=branch:master+event:push)
|
|
103
|
+
[](https://circleci.com/gh/jonescompneurolab/hnn-core)
|
|
104
|
+
[](https://codecov.io/gh/jonescompneurolab/hnn-core)
|
|
105
|
+
[](https://pypi.org/project/hnn-core/)
|
|
106
|
+
[](https://gitter.im/jonescompneurolab/hnn-core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
107
|
+
[](https://doi.org/10.21105/joss.05848)
|
|
108
|
+
|
|
109
|
+

|
|
110
|
+
|
|
111
|
+
# About
|
|
112
|
+
|
|
113
|
+
This is a leaner and cleaner version of the code based off the [HNN
|
|
114
|
+
repository](https://github.com/jonescompneurolab/hnn).
|
|
115
|
+
|
|
116
|
+
The **Human Neocortical Neurosolver (HNN)** is an open-source neural modeling
|
|
117
|
+
tool designed to help researchers/clinicians interpret human brain imaging
|
|
118
|
+
data. Based off the original [HNN
|
|
119
|
+
repository](https://github.com/jonescompneurolab/hnn), **HNN-core** provides a
|
|
120
|
+
convenient way to run simulations of an anatomically and biophysically detailed
|
|
121
|
+
dynamical system model of human thalamocortical brain circuits with only a few
|
|
122
|
+
lines of code. Given its modular, object-oriented design, HNN-core makes it
|
|
123
|
+
easy to generate and evaluate hypotheses on the mechanistic origin of signals
|
|
124
|
+
measured with magnetoencephalography (MEG), electroencephalography (EEG), or
|
|
125
|
+
intracranial electrocorticography (ECoG). A unique feature of the HNN model is
|
|
126
|
+
that it accounts for the biophysics generating the primary electric currents
|
|
127
|
+
underlying such data, so simulation results are directly comparable to source
|
|
128
|
+
localized data (current dipoles in units of nano-Ampere-meters); this enables
|
|
129
|
+
precise tuning of model parameters to match characteristics of recorded
|
|
130
|
+
signals. Multimodal neurophysiology data such as local field potential (LFP),
|
|
131
|
+
current-source density (CSD), and spiking dynamics can also be simulated
|
|
132
|
+
simultaneously with current dipoles.
|
|
133
|
+
|
|
134
|
+
While the HNN-core API is designed to be flexible and serve users with varying
|
|
135
|
+
levels of coding expertise, the HNN-core GUI is designed to be useful to
|
|
136
|
+
researchers with no formal computational neural modeling or coding experience.
|
|
137
|
+
|
|
138
|
+
For more information visit <https://hnn.brown.edu>. There, we describe the use
|
|
139
|
+
of HNN in studying the circuit-level origin of some of the most commonly
|
|
140
|
+
measured MEG/EEG and ECoG signals: event related potentials (ERPs) and low
|
|
141
|
+
frequency rhythms (alpha/beta/gamma).
|
|
142
|
+
|
|
143
|
+
Contributors are very welcome! Please read our [Contributing Guide][] if you are interested.
|
|
144
|
+
|
|
145
|
+
Please consider supporting HNN development efforts by voluntarily [providing your demographic information here](https://docs.google.com/forms/d/e/1FAIpQLSfN2F4IkGATs6cy1QBO78C6QJqvm9y14TqsCUsuR4Rrkmr1Mg/viewform)! Note that any demographic information we collect is anonymized and aggregated for reporting on the grants that fund the continued development of HNN. All questions are voluntary.
|
|
146
|
+
|
|
147
|
+
# Installation
|
|
148
|
+
|
|
149
|
+
See [Installation Guide][]. To install `hnn-core` with the minimum dependencies
|
|
150
|
+
on Mac or Linux, simply do:
|
|
151
|
+
|
|
152
|
+
$ pip install hnn_core
|
|
153
|
+
|
|
154
|
+
Note that `hnn-core` currently only supports Python 3.8, 3.9, 3.10, 3.11, and 3.12, but *not* 3.13.
|
|
155
|
+
|
|
156
|
+
If you want to track the latest developments of `hnn-core`, you can
|
|
157
|
+
install the current version of the code (nightly) with:
|
|
158
|
+
|
|
159
|
+
$ pip install --upgrade https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master
|
|
160
|
+
|
|
161
|
+
If you are interested in features like GUI, Optimization, or Parallel support, or are on Windows, then please see our [Installation Guide][].
|
|
162
|
+
|
|
163
|
+
# Documentation and examples
|
|
164
|
+
|
|
165
|
+
Once you have installed `hnn_core` and the dependencies for the features you
|
|
166
|
+
want, we recommend downloading and executing the [example
|
|
167
|
+
scripts](https://jonescompneurolab.github.io/hnn-core/stable/auto_examples/index.html)
|
|
168
|
+
provided on the [documentation
|
|
169
|
+
pages](https://jonescompneurolab.github.io/hnn-core/) (as well as in the
|
|
170
|
+
[GitHub repository](https://github.com/jonescompneurolab/hnn-core)).
|
|
171
|
+
|
|
172
|
+
Note that `python` plots are by default non-interactive (blocking): each
|
|
173
|
+
plot must thus be closed before the code execution continues. We
|
|
174
|
+
recommend using and 'interactive' python interpreter such as
|
|
175
|
+
`ipython`:
|
|
176
|
+
|
|
177
|
+
$ ipython --matplotlib
|
|
178
|
+
|
|
179
|
+
and executing the scripts using the `%run`-magic:
|
|
180
|
+
|
|
181
|
+
%run plot_simulate_evoked.py
|
|
182
|
+
|
|
183
|
+
When executed in this manner, the scripts will execute entirely, after
|
|
184
|
+
which all plots will be shown. For an even more interactive experience,
|
|
185
|
+
in which you execute code and interrogate plots in sequential blocks, we
|
|
186
|
+
recommend editors such as [VS Code](https://code.visualstudio.com) and
|
|
187
|
+
[Spyder](https://docs.spyder-ide.org/current/index.html).
|
|
188
|
+
|
|
189
|
+
# Bug reports
|
|
190
|
+
|
|
191
|
+
Use the [GitHub Issues
|
|
192
|
+
tracker](https://github.com/jonescompneurolab/hnn-core/issues) to report
|
|
193
|
+
bugs. For user questions and scientific discussions, please see our
|
|
194
|
+
[GitHub Discussions
|
|
195
|
+
page](https://github.com/jonescompneurolab/hnn-core/discussions).
|
|
196
|
+
|
|
197
|
+
# Interested in Contributing?
|
|
198
|
+
|
|
199
|
+
Please read our [Contributing Guide][] and make sure to abide by our [Code of Conduct](https://github.com/jonescompneurolab/hnn-core/blob/master/CODE_OF_CONDUCT.md).
|
|
200
|
+
|
|
201
|
+
# Governance Structure
|
|
202
|
+
|
|
203
|
+
Our [governance structure can be found here](https://jonescompneurolab.github.io/hnn-core/stable/governance.html).
|
|
204
|
+
|
|
205
|
+
# Citing
|
|
206
|
+
|
|
207
|
+
If you use HNN-core in your work, please cite our [publication in
|
|
208
|
+
JOSS](https://doi.org/10.21105/joss.05848):
|
|
209
|
+
|
|
210
|
+
> Jas et al., (2023). HNN-core: A Python software for cellular and
|
|
211
|
+
> circuit-level interpretation of human MEG/EEG. *Journal of Open Source
|
|
212
|
+
> Software*, 8(92), 5848, <https://doi.org/10.21105/joss.05848>
|
|
213
|
+
|
|
214
|
+
[Contributing Guide]: https://jonescompneurolab.github.io/hnn-core/stable/contributing.html
|
|
215
|
+
[Installation Guide]: https://jonescompneurolab.github.io/hnn-core/stable/install.html
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
<h1 align="center">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/jonescompneurolab/jones-website/master/images/frontpage/logos/logo-hnn-medium.png" width="300">
|
|
4
|
+
</h1><br>
|
|
5
|
+
|
|
6
|
+
# hnn-core
|
|
7
|
+
|
|
8
|
+
[](https://github.com/jonescompneurolab/hnn-core/actions/?query=branch:master+event:push)
|
|
9
|
+
[](https://circleci.com/gh/jonescompneurolab/hnn-core)
|
|
10
|
+
[](https://codecov.io/gh/jonescompneurolab/hnn-core)
|
|
11
|
+
[](https://pypi.org/project/hnn-core/)
|
|
12
|
+
[](https://gitter.im/jonescompneurolab/hnn-core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
13
|
+
[](https://doi.org/10.21105/joss.05848)
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
# About
|
|
18
|
+
|
|
19
|
+
This is a leaner and cleaner version of the code based off the [HNN
|
|
20
|
+
repository](https://github.com/jonescompneurolab/hnn).
|
|
21
|
+
|
|
22
|
+
The **Human Neocortical Neurosolver (HNN)** is an open-source neural modeling
|
|
23
|
+
tool designed to help researchers/clinicians interpret human brain imaging
|
|
24
|
+
data. Based off the original [HNN
|
|
25
|
+
repository](https://github.com/jonescompneurolab/hnn), **HNN-core** provides a
|
|
26
|
+
convenient way to run simulations of an anatomically and biophysically detailed
|
|
27
|
+
dynamical system model of human thalamocortical brain circuits with only a few
|
|
28
|
+
lines of code. Given its modular, object-oriented design, HNN-core makes it
|
|
29
|
+
easy to generate and evaluate hypotheses on the mechanistic origin of signals
|
|
30
|
+
measured with magnetoencephalography (MEG), electroencephalography (EEG), or
|
|
31
|
+
intracranial electrocorticography (ECoG). A unique feature of the HNN model is
|
|
32
|
+
that it accounts for the biophysics generating the primary electric currents
|
|
33
|
+
underlying such data, so simulation results are directly comparable to source
|
|
34
|
+
localized data (current dipoles in units of nano-Ampere-meters); this enables
|
|
35
|
+
precise tuning of model parameters to match characteristics of recorded
|
|
36
|
+
signals. Multimodal neurophysiology data such as local field potential (LFP),
|
|
37
|
+
current-source density (CSD), and spiking dynamics can also be simulated
|
|
38
|
+
simultaneously with current dipoles.
|
|
39
|
+
|
|
40
|
+
While the HNN-core API is designed to be flexible and serve users with varying
|
|
41
|
+
levels of coding expertise, the HNN-core GUI is designed to be useful to
|
|
42
|
+
researchers with no formal computational neural modeling or coding experience.
|
|
43
|
+
|
|
44
|
+
For more information visit <https://hnn.brown.edu>. There, we describe the use
|
|
45
|
+
of HNN in studying the circuit-level origin of some of the most commonly
|
|
46
|
+
measured MEG/EEG and ECoG signals: event related potentials (ERPs) and low
|
|
47
|
+
frequency rhythms (alpha/beta/gamma).
|
|
48
|
+
|
|
49
|
+
Contributors are very welcome! Please read our [Contributing Guide][] if you are interested.
|
|
50
|
+
|
|
51
|
+
Please consider supporting HNN development efforts by voluntarily [providing your demographic information here](https://docs.google.com/forms/d/e/1FAIpQLSfN2F4IkGATs6cy1QBO78C6QJqvm9y14TqsCUsuR4Rrkmr1Mg/viewform)! Note that any demographic information we collect is anonymized and aggregated for reporting on the grants that fund the continued development of HNN. All questions are voluntary.
|
|
52
|
+
|
|
53
|
+
# Installation
|
|
54
|
+
|
|
55
|
+
See [Installation Guide][]. To install `hnn-core` with the minimum dependencies
|
|
56
|
+
on Mac or Linux, simply do:
|
|
57
|
+
|
|
58
|
+
$ pip install hnn_core
|
|
59
|
+
|
|
60
|
+
Note that `hnn-core` currently only supports Python 3.8, 3.9, 3.10, 3.11, and 3.12, but *not* 3.13.
|
|
61
|
+
|
|
62
|
+
If you want to track the latest developments of `hnn-core`, you can
|
|
63
|
+
install the current version of the code (nightly) with:
|
|
64
|
+
|
|
65
|
+
$ pip install --upgrade https://api.github.com/repos/jonescompneurolab/hnn-core/zipball/master
|
|
66
|
+
|
|
67
|
+
If you are interested in features like GUI, Optimization, or Parallel support, or are on Windows, then please see our [Installation Guide][].
|
|
68
|
+
|
|
69
|
+
# Documentation and examples
|
|
70
|
+
|
|
71
|
+
Once you have installed `hnn_core` and the dependencies for the features you
|
|
72
|
+
want, we recommend downloading and executing the [example
|
|
73
|
+
scripts](https://jonescompneurolab.github.io/hnn-core/stable/auto_examples/index.html)
|
|
74
|
+
provided on the [documentation
|
|
75
|
+
pages](https://jonescompneurolab.github.io/hnn-core/) (as well as in the
|
|
76
|
+
[GitHub repository](https://github.com/jonescompneurolab/hnn-core)).
|
|
77
|
+
|
|
78
|
+
Note that `python` plots are by default non-interactive (blocking): each
|
|
79
|
+
plot must thus be closed before the code execution continues. We
|
|
80
|
+
recommend using and 'interactive' python interpreter such as
|
|
81
|
+
`ipython`:
|
|
82
|
+
|
|
83
|
+
$ ipython --matplotlib
|
|
84
|
+
|
|
85
|
+
and executing the scripts using the `%run`-magic:
|
|
86
|
+
|
|
87
|
+
%run plot_simulate_evoked.py
|
|
88
|
+
|
|
89
|
+
When executed in this manner, the scripts will execute entirely, after
|
|
90
|
+
which all plots will be shown. For an even more interactive experience,
|
|
91
|
+
in which you execute code and interrogate plots in sequential blocks, we
|
|
92
|
+
recommend editors such as [VS Code](https://code.visualstudio.com) and
|
|
93
|
+
[Spyder](https://docs.spyder-ide.org/current/index.html).
|
|
94
|
+
|
|
95
|
+
# Bug reports
|
|
96
|
+
|
|
97
|
+
Use the [GitHub Issues
|
|
98
|
+
tracker](https://github.com/jonescompneurolab/hnn-core/issues) to report
|
|
99
|
+
bugs. For user questions and scientific discussions, please see our
|
|
100
|
+
[GitHub Discussions
|
|
101
|
+
page](https://github.com/jonescompneurolab/hnn-core/discussions).
|
|
102
|
+
|
|
103
|
+
# Interested in Contributing?
|
|
104
|
+
|
|
105
|
+
Please read our [Contributing Guide][] and make sure to abide by our [Code of Conduct](https://github.com/jonescompneurolab/hnn-core/blob/master/CODE_OF_CONDUCT.md).
|
|
106
|
+
|
|
107
|
+
# Governance Structure
|
|
108
|
+
|
|
109
|
+
Our [governance structure can be found here](https://jonescompneurolab.github.io/hnn-core/stable/governance.html).
|
|
110
|
+
|
|
111
|
+
# Citing
|
|
112
|
+
|
|
113
|
+
If you use HNN-core in your work, please cite our [publication in
|
|
114
|
+
JOSS](https://doi.org/10.21105/joss.05848):
|
|
115
|
+
|
|
116
|
+
> Jas et al., (2023). HNN-core: A Python software for cellular and
|
|
117
|
+
> circuit-level interpretation of human MEG/EEG. *Journal of Open Source
|
|
118
|
+
> Software*, 8(92), 5848, <https://doi.org/10.21105/joss.05848>
|
|
119
|
+
|
|
120
|
+
[Contributing Guide]: https://jonescompneurolab.github.io/hnn-core/stable/contributing.html
|
|
121
|
+
[Installation Guide]: https://jonescompneurolab.github.io/hnn-core/stable/install.html
|
|
@@ -8,6 +8,12 @@ efficiently run multiple simulations with different parameters
|
|
|
8
8
|
for comprehensive analysis.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
+
###############################################################################
|
|
12
|
+
# Note that batch simulation requires you to install HNN-core with Joblib
|
|
13
|
+
# parallel support, which you can do by installing it with
|
|
14
|
+
# ``pip install "hnn_core[parallel]"``
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
# Authors: Abdul Samad Siddiqui <abdulsamadsid1@gmail.com>
|
|
12
18
|
# Nick Tolley <nicholas_tolley@brown.edu>
|
|
13
19
|
# Ryan Thorpe <ryan_thorpe@brown.edu>
|
|
@@ -20,17 +26,30 @@ for comprehensive analysis.
|
|
|
20
26
|
|
|
21
27
|
import matplotlib.pyplot as plt
|
|
22
28
|
import numpy as np
|
|
29
|
+
|
|
23
30
|
from hnn_core.batch_simulate import BatchSimulate
|
|
24
31
|
from hnn_core import jones_2009_model
|
|
25
32
|
|
|
26
33
|
# The number of cores may need modifying depending on your current machine.
|
|
27
|
-
n_jobs =
|
|
34
|
+
n_jobs = 4
|
|
28
35
|
###############################################################################
|
|
36
|
+
# The `add_evoked_drive` function simulates external input to the network,
|
|
37
|
+
# mimicking sensory stimulation or other external events.
|
|
38
|
+
#
|
|
39
|
+
# - `evprox` indicates a proximal drive, targeting dendrites near the cell
|
|
40
|
+
# bodies.
|
|
41
|
+
# - `mu=40` and `sigma=5` define the timing (mean and spread) of the input.
|
|
42
|
+
# - `weights_ampa` and `synaptic_delays` control the strength and
|
|
43
|
+
# timing of the input.
|
|
44
|
+
#
|
|
45
|
+
# This evoked drive causes the initial positive deflection in the dipole
|
|
46
|
+
# signal, triggering a cascade of activity through the network and
|
|
47
|
+
# resulting in the complex waveforms observed.
|
|
29
48
|
|
|
30
49
|
|
|
31
50
|
def set_params(param_values, net=None):
|
|
32
51
|
"""
|
|
33
|
-
Set parameters
|
|
52
|
+
Set parameters for the network drives.
|
|
34
53
|
|
|
35
54
|
Parameters
|
|
36
55
|
----------
|
|
@@ -57,16 +76,16 @@ def set_params(param_values, net=None):
|
|
|
57
76
|
synaptic_delays=synaptic_delays)
|
|
58
77
|
|
|
59
78
|
###############################################################################
|
|
60
|
-
#
|
|
79
|
+
# Next, we define a parameter grid for the batch simulation.
|
|
61
80
|
|
|
62
81
|
|
|
63
82
|
param_grid = {
|
|
64
|
-
'weight_basket': np.logspace(-4 -
|
|
65
|
-
'weight_pyr': np.logspace(-4, -1,
|
|
83
|
+
'weight_basket': np.logspace(-4, -1, 20),
|
|
84
|
+
'weight_pyr': np.logspace(-4, -1, 20)
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
###############################################################################
|
|
69
|
-
#
|
|
88
|
+
# We then define a function to calculate summary statistics.
|
|
70
89
|
|
|
71
90
|
|
|
72
91
|
def summary_func(results):
|
|
@@ -95,12 +114,8 @@ def summary_func(results):
|
|
|
95
114
|
###############################################################################
|
|
96
115
|
# Run the batch simulation and collect the results.
|
|
97
116
|
|
|
98
|
-
# Comment off this code, if dask and distributed Python packages are installed
|
|
99
|
-
# from dask.distributed import Client
|
|
100
|
-
# client = Client(threads_per_worker=1, n_workers=5, processes=False)
|
|
101
|
-
|
|
102
117
|
|
|
103
|
-
#
|
|
118
|
+
# Initialize the network model and run the batch simulation.
|
|
104
119
|
net = jones_2009_model(mesh_shape=(3, 3))
|
|
105
120
|
batch_simulation = BatchSimulate(net=net,
|
|
106
121
|
set_params=set_params,
|
|
@@ -108,23 +123,45 @@ batch_simulation = BatchSimulate(net=net,
|
|
|
108
123
|
simulation_results = batch_simulation.run(param_grid,
|
|
109
124
|
n_jobs=n_jobs,
|
|
110
125
|
combinations=False,
|
|
111
|
-
backend='
|
|
112
|
-
|
|
126
|
+
backend='loky')
|
|
127
|
+
|
|
113
128
|
print("Simulation results:", simulation_results)
|
|
114
129
|
###############################################################################
|
|
115
130
|
# This plot shows an overlay of all smoothed dipole waveforms from the
|
|
116
|
-
# batch simulation. Each line represents a different set of
|
|
117
|
-
# allowing us to visualize the range of responses
|
|
131
|
+
# batch simulation. Each line represents a different set of synaptic strength
|
|
132
|
+
# parameters (`weight_basket`), allowing us to visualize the range of responses
|
|
133
|
+
# across the parameter space.
|
|
134
|
+
# The colormap represents synaptic strengths, from weaker (purple)
|
|
135
|
+
# to stronger (yellow).
|
|
136
|
+
#
|
|
137
|
+
# As drive strength increases, dipole responses show progressively larger
|
|
138
|
+
# amplitudes and more distinct features, reflecting heightened network
|
|
139
|
+
# activity. Weak drives (purple lines) produce smaller amplitude signals with
|
|
140
|
+
# simpler waveforms, while stronger drives (yellow lines) generate
|
|
141
|
+
# larger responses with more pronounced oscillatory features, indicating
|
|
142
|
+
# more robust network activity.
|
|
143
|
+
#
|
|
144
|
+
# The y-axis represents dipole amplitude in nAm (nanoAmpere-meters), which is
|
|
145
|
+
# the product of current flow and distance in the neural tissue.
|
|
146
|
+
#
|
|
147
|
+
# Stronger synaptic connections (yellow lines) generally show larger
|
|
148
|
+
# amplitude responses and more pronounced features throughout the simulation.
|
|
118
149
|
|
|
119
|
-
dpl_waveforms = []
|
|
150
|
+
dpl_waveforms, param_values = [], []
|
|
120
151
|
for data_list in simulation_results['simulated_data']:
|
|
121
152
|
for data in data_list:
|
|
122
153
|
dpl_smooth = data['dpl'][0].copy().smooth(window_len=30)
|
|
123
154
|
dpl_waveforms.append(dpl_smooth.data['agg'])
|
|
155
|
+
param_values.append(data['param_values']['weight_basket'])
|
|
124
156
|
|
|
125
157
|
plt.figure(figsize=(10, 6))
|
|
126
|
-
|
|
127
|
-
|
|
158
|
+
cmap = plt.get_cmap('viridis')
|
|
159
|
+
log_param_values = np.log10(param_values)
|
|
160
|
+
norm = plt.Normalize(log_param_values.min(), log_param_values.max())
|
|
161
|
+
|
|
162
|
+
for waveform, log_param in zip(dpl_waveforms, log_param_values):
|
|
163
|
+
color = cmap(norm(log_param))
|
|
164
|
+
plt.plot(waveform, color=color, alpha=0.7, linewidth=2)
|
|
128
165
|
plt.title('Overlay of Dipole Waveforms')
|
|
129
166
|
plt.xlabel('Time (ms)')
|
|
130
167
|
plt.ylabel('Dipole Amplitude (nAm)')
|
|
@@ -36,7 +36,7 @@ net_erp = jones_2009_model(add_drives_from_params=True)
|
|
|
36
36
|
# :func:`~hnn_core.viz.plot_cell_connectivity`. We can search for specific
|
|
37
37
|
# connections using ``pick_connection`` which returns the indices
|
|
38
38
|
# of ``net.connectivity`` that match the provided parameters.
|
|
39
|
-
from hnn_core.viz import plot_connectivity_matrix, plot_cell_connectivity
|
|
39
|
+
from hnn_core.viz import plot_connectivity_matrix, plot_cell_connectivity, plot_drive_strength
|
|
40
40
|
from hnn_core.network import pick_connection
|
|
41
41
|
|
|
42
42
|
print(len(net_erp.connectivity))
|
|
@@ -129,6 +129,16 @@ plot_connectivity_matrix(net_sparse, conn_idx)
|
|
|
129
129
|
src_gid = net_sparse.connectivity[conn_idx]['src_gids'].copy().pop()
|
|
130
130
|
plot_cell_connectivity(net_sparse, conn_idx, src_gid=src_gid)
|
|
131
131
|
|
|
132
|
+
###############################################################################
|
|
133
|
+
# We can plot the strengths of each external drive across each cell types.
|
|
134
|
+
|
|
135
|
+
# This can be done in a relative way, enabling you to compare the proportion
|
|
136
|
+
# coming from each drive:
|
|
137
|
+
plot_drive_strength(net_erp)
|
|
138
|
+
|
|
139
|
+
# Alternatively, you can compare the total amount of each drive in conductance:
|
|
140
|
+
plot_drive_strength(net_erp, normalize=False)
|
|
141
|
+
|
|
132
142
|
###############################################################################
|
|
133
143
|
# In the sparse network, there still appears to be some rhythmicity
|
|
134
144
|
# where the cells are firing synchronously with a smaller period of 4-5 ms.
|
|
@@ -8,7 +8,7 @@ simulating dipoles using HNN-core.
|
|
|
8
8
|
|
|
9
9
|
The MPI backend allows running the simulation in parallel across neurons in the
|
|
10
10
|
network even with a single trial. For this, you will
|
|
11
|
-
need the :ref:`MPI related software <
|
|
11
|
+
need the :ref:`MPI related software <install>` installed. Note that if you
|
|
12
12
|
want to simulate in parallel across trials, the Joblib backend allows this
|
|
13
13
|
without the need to install and configure MPI.
|
|
14
14
|
"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Tutorials
|
|
2
|
+
---------
|
|
3
|
+
|
|
4
|
+
The following tutorials contain the workflow and code to simulate and visualize commonly
|
|
5
|
+
studied M/EEG signals including event related potentials and low frequency rhythms in
|
|
6
|
+
the alpha, beta and gamma bands. These tutorial workflows are analogous to those on the
|
|
7
|
+
`textbook website <https://jonescompneurolab.github.io/textbook/content/preface.html>`_.
|
|
8
|
+
|
|
9
|
+
We strongly recommend that you first go through the background information provided on
|
|
10
|
+
the `HNN textbook website
|
|
11
|
+
<https://jonescompneurolab.github.io/textbook/content/preface.html>`_ and each of the
|
|
12
|
+
HNN GUI tutorials, after which the code and instructions in these HNN-core tutorials
|
|
13
|
+
will be clearer. All tutorials build from our prior publications investigating the
|
|
14
|
+
origin of ERPs and brain rhythms in the somatosensory system, and parameter and data
|
|
15
|
+
sets are provided to help users get started.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
from .dipole import
|
|
1
|
+
from .dipole import (
|
|
2
|
+
simulate_dipole,
|
|
3
|
+
read_dipole,
|
|
4
|
+
average_dipoles,
|
|
5
|
+
Dipole,
|
|
6
|
+
_read_dipole_txt,
|
|
7
|
+
)
|
|
2
8
|
from .params import Params, read_params, convert_to_json
|
|
3
9
|
from .network import Network, pick_connection
|
|
4
10
|
from .network_models import jones_2009_model, law_2021_model, calcium_model
|
|
@@ -7,4 +13,4 @@ from .cell_response import CellResponse, read_spikes
|
|
|
7
13
|
from .cells_default import pyramidal, basket
|
|
8
14
|
from .parallel_backends import MPIBackend, JoblibBackend
|
|
9
15
|
|
|
10
|
-
__version__ =
|
|
16
|
+
__version__ = "0.4.2.dev1"
|