pyNIBS 0.2024.8__tar.gz → 0.2026.1__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.
- pynibs-0.2026.1/PKG-INFO +105 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/README.md +8 -4
- pynibs-0.2026.1/pyNIBS.egg-info/PKG-INFO +105 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/SOURCES.txt +15 -40
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/requires.txt +6 -4
- pynibs-0.2026.1/pynibs/__init__.py +46 -0
- pynibs-0.2026.1/pynibs/coil/__init__.py +6 -0
- {pyNIBS-0.2024.8/pynibs → pynibs-0.2026.1/pynibs/coil}/coil.py +213 -543
- pynibs-0.2026.1/pynibs/coil/export.py +508 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/__init__.py +4 -1
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/congruence.py +37 -45
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/ext_metrics.py +40 -11
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/stimulation_threshold.py +1 -2
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/Mep.py +120 -370
- pynibs-0.2026.1/pynibs/expio/__init__.py +18 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/brainsight.py +34 -37
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/cobot.py +25 -25
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/exp.py +10 -7
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/fit_funs.py +3 -0
- pynibs-0.2026.1/pynibs/expio/invesalius.py +70 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/localite.py +190 -91
- pynibs-0.2026.1/pynibs/expio/neurone.py +139 -0
- pynibs-0.2026.1/pynibs/expio/signal_ced.py +394 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/visor.py +16 -15
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/freesurfer.py +34 -33
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/__init__.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/hdf5_io.py +149 -132
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/xdmf.py +35 -31
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/__init__.py +1 -1
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/mesh_struct.py +77 -92
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/transformations.py +121 -21
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/utils.py +191 -99
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/models/_TMS.py +2 -1
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/muap.py +1 -2
- pynibs-0.2026.1/pynibs/neuron/__init__.py +12 -0
- pynibs-0.2026.1/pynibs/neuron/models/mep.py +566 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/neuron/neuron_regression.py +98 -8
- pynibs-0.2026.1/pynibs/optimization/__init__.py +15 -0
- pyNIBS-0.2024.8/pynibs/optimization/optimization.py → pynibs-0.2026.1/pynibs/optimization/coil_opt.py +157 -133
- pynibs-0.2026.1/pynibs/optimization/multichannel.py +1428 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/optimization/opt_mep.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/optimization/workhorses.py +7 -8
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/__init__.py +4 -2
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/dual_node_detection.py +229 -219
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/regression.py +92 -61
- pynibs-0.2026.1/pynibs/roi/__init__.py +5 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/roi/roi_structs.py +19 -21
- pyNIBS-0.2024.8/pynibs/roi/roi.py → pynibs-0.2026.1/pynibs/roi/roi_utils.py +56 -33
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/subject.py +24 -14
- pynibs-0.2026.1/pynibs/util/__init__.py +20 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/dosing.py +4 -5
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/quality_measures.py +39 -38
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/rotations.py +116 -9
- pyNIBS-0.2024.8/pynibs/util/simnibs.py → pynibs-0.2026.1/pynibs/util/simnibs_io.py +29 -19
- pyNIBS-0.2024.8/pynibs/util/util.py → pynibs-0.2026.1/pynibs/util/utils.py +20 -22
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/para.py +4 -4
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/render_3D.py +4 -4
- pynibs-0.2026.1/pyproject.toml +76 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/requirements.txt +7 -4
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_coil.py +41 -36
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_elements2nodes.py +7 -7
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_mesh_transformations.py +4 -4
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_mesh_utils.py +45 -45
- pynibs-0.2026.1/tests/test_nnav_imports.py +100 -0
- pynibs-0.2026.1/tests/test_opt_coil.py +230 -0
- pynibs-0.2026.1/tests/test_opt_mtms.py +423 -0
- pynibs-0.2026.1/tests/test_optimization_multichannel.py +86 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_quality_measures.py +6 -6
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_regressdata.py +59 -60
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_rotations.py +16 -15
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_util.py +1 -1
- pyNIBS-0.2024.8/PKG-INFO +0 -698
- pyNIBS-0.2024.8/data/configuration_exp0.yaml +0 -59
- pyNIBS-0.2024.8/data/configuration_linear_MEP.yaml +0 -61
- pyNIBS-0.2024.8/data/configuration_linear_RT.yaml +0 -61
- pyNIBS-0.2024.8/data/configuration_sigmoid4.yaml +0 -68
- pyNIBS-0.2024.8/data/network mapping configuration/configuration guide.md +0 -238
- pyNIBS-0.2024.8/data/network mapping configuration/configuration_TEMPLATE.yaml +0 -42
- pyNIBS-0.2024.8/data/network mapping configuration/configuration_for_testing.yaml +0 -43
- pyNIBS-0.2024.8/data/network mapping configuration/configuration_modelTMS.yaml +0 -43
- pyNIBS-0.2024.8/data/network mapping configuration/configuration_reg_isi_05.yaml +0 -43
- pyNIBS-0.2024.8/data/network mapping configuration/output_documentation.md +0 -185
- pyNIBS-0.2024.8/data/network mapping configuration/recommendations_for_accuracy_threshold.md +0 -77
- pyNIBS-0.2024.8/data/neuron/models/L23_PC_cADpyr_biphasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L23_PC_cADpyr_monophasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_LBC_biphasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_LBC_monophasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_NBC_biphasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_NBC_monophasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_SBC_biphasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L4_SBC_monophasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L5_TTPC2_cADpyr_biphasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/data/neuron/models/L5_TTPC2_cADpyr_monophasic_v1.csv +0 -1281
- pyNIBS-0.2024.8/pyNIBS.egg-info/PKG-INFO +0 -698
- pyNIBS-0.2024.8/pynibs/__init__.py +0 -34
- pyNIBS-0.2024.8/pynibs/expio/__init__.py +0 -8
- pyNIBS-0.2024.8/pynibs/expio/signal_ced.py +0 -51
- pyNIBS-0.2024.8/pynibs/neuron/__init__.py +0 -2
- pyNIBS-0.2024.8/pynibs/optimization/__init__.py +0 -5
- pyNIBS-0.2024.8/pynibs/optimization/multichannel.py +0 -278
- pyNIBS-0.2024.8/pynibs/roi/__init__.py +0 -2
- pyNIBS-0.2024.8/pynibs/util/__init__.py +0 -4
- pyNIBS-0.2024.8/pyproject.toml +0 -29
- pyNIBS-0.2024.8/setup.py +0 -123
- pyNIBS-0.2024.8/tests/data/InstrumentMarker20200225163611937.xml +0 -19
- pyNIBS-0.2024.8/tests/data/TriggerMarkers_Coil0_20200225163443682.xml +0 -14
- pyNIBS-0.2024.8/tests/data/TriggerMarkers_Coil1_20200225170337572.xml +0 -6373
- pyNIBS-0.2024.8/tests/data/Xdmf.dtd +0 -89
- pyNIBS-0.2024.8/tests/data/brainsight_niiImage_nifticoord.txt +0 -145
- pyNIBS-0.2024.8/tests/data/brainsight_niiImage_nifticoord_largefile.txt +0 -1434
- pyNIBS-0.2024.8/tests/data/brainsight_niiImage_niifticoord_mixedtargets.txt +0 -47
- pyNIBS-0.2024.8/tests/data/create_subject_testsub.py +0 -332
- pyNIBS-0.2024.8/tests/data/data.hdf5 +0 -0
- pyNIBS-0.2024.8/tests/data/geo.hdf5 +0 -0
- pyNIBS-0.2024.8/tests/test_hdf5_io/test_xdmf.py +0 -61
- pyNIBS-0.2024.8/tests/test_nnav_imports.py +0 -101
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/LICENSE +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/dependency_links.txt +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/not-zip-safe +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/top_level.txt +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/brainvis.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/models/__init__.py +0 -0
- /pyNIBS-0.2024.8/pynibs/pckg/__init__.py → /pynibs-0.2026.1/pynibs/neuron/models/m1_montbrio.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/neuron/util.py +0 -0
- {pyNIBS-0.2024.8/pynibs/pckg/libeep → pynibs-0.2026.1/pynibs/pckg}/__init__.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/pckg/biosig/biosig4c++-1.9.5.src_fixed.tar.gz +0 -0
- /pyNIBS-0.2024.8/pynibs/regression/score_types.py → /pynibs-0.2026.1/pynibs/pckg/libeep/__init__.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/pckg/libeep/pyeep.so +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/tensor_scaling.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/tms_pulse.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/__init__.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/plot_2D.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/setup.cfg +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_roi.py +0 -0
- {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_subject.py +0 -0
pynibs-0.2026.1/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyNIBS
|
|
3
|
+
Version: 0.2026.1
|
|
4
|
+
Summary: A python toolbox to conduct non-invasive brain stimulation (NIBS) experiments.
|
|
5
|
+
Author: Konstantin Weise, Ole Numssen, Benjamin Kalloch
|
|
6
|
+
Maintainer-email: Konstantin Weise <weise@cbs.mpg.de>, Ole Numssen <numssen@cbs.mpg.de>
|
|
7
|
+
License: GPL3
|
|
8
|
+
Project-URL: Home, https://gitlab.gwdg.de/tms-localization/pynibs
|
|
9
|
+
Project-URL: Docs, https://pynibs.readthedocs.io/
|
|
10
|
+
Project-URL: Twitter, https://www.twitter.com/num_ole
|
|
11
|
+
Project-URL: Bluesky, https://bsky.app/profile/numole.bsky.social
|
|
12
|
+
Project-URL: Download, https://pypi.org/project/pynibs/
|
|
13
|
+
Keywords: NIBS,non-invasive brain stimulation,TMS,FEM
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: cython>=0.29.20
|
|
23
|
+
Requires-Dist: h5py>=2.10.0
|
|
24
|
+
Requires-Dist: lmfit
|
|
25
|
+
Requires-Dist: matplotlib>=3.2.1
|
|
26
|
+
Requires-Dist: meshio
|
|
27
|
+
Requires-Dist: nibabel>=3.0.2
|
|
28
|
+
Requires-Dist: nilearn>=0.6.2
|
|
29
|
+
Requires-Dist: numpy<2
|
|
30
|
+
Requires-Dist: ortools
|
|
31
|
+
Requires-Dist: pandas>=1.0.3
|
|
32
|
+
Requires-Dist: pyyaml>=5.3.1
|
|
33
|
+
Requires-Dist: scikit-learn>=0.22.1
|
|
34
|
+
Requires-Dist: scipy>=1.4.1
|
|
35
|
+
Requires-Dist: scikit-image
|
|
36
|
+
Requires-Dist: setuptools>=49.1.0
|
|
37
|
+
Requires-Dist: tqdm>=4.45.0
|
|
38
|
+
Requires-Dist: trimesh>=3.8.11
|
|
39
|
+
Requires-Dist: transformations
|
|
40
|
+
Requires-Dist: fslpy
|
|
41
|
+
Requires-Dist: pygpc>=0.4.1
|
|
42
|
+
Requires-Dist: uncertainties
|
|
43
|
+
Requires-Dist: asteval
|
|
44
|
+
Requires-Dist: jsonschema
|
|
45
|
+
Requires-Dist: tables
|
|
46
|
+
Requires-Dist: vtk
|
|
47
|
+
Requires-Dist: rtree
|
|
48
|
+
Requires-Dist: tvb-gdist
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# pyNIBS
|
|
52
|
+
Preprocessing, postprocessing, and analyses routines for non-invasive brain stimulation experiments.
|
|
53
|
+
|
|
54
|
+
[](https://gitlab.gwdg.de/tms-localization/pynibs)
|
|
55
|
+
[](https://pynibs.readthedocs.io/)
|
|
56
|
+
[](https://gitlab.gwdg.de/tms-localization/pynibs/commits/master)
|
|
57
|
+
[](https://tms-localization.pages.gwdg.de/pynibs)
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
`pyNIBS` provides the functions to allow **cortical mappings** with transcranial magnetic stimulation (TMS) via **functional analysis**. `pyNIBS` is developed to work with [SimNIBS](http://www.simnibs.org), i.e. SimNIBS' meshes and FEM results can directly be used.
|
|
62
|
+
Currently, [SimNIBS >=4.0](https://github.com/simnibs/simnibs/releases/latest) is supported.
|
|
63
|
+
|
|
64
|
+
See the [documentation](https://pynibs.readthedocs.io/) for package details and our [protocol](https://doi.org/10.1038/s41596-022-00776-6) publication for a extensive usage examples. Free view only version of the paper: https://t.co/uv7CmVw6tp.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
Via PiP:
|
|
68
|
+
|
|
69
|
+
``` bash
|
|
70
|
+
pip install pynibs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or clone the source repository and install the development branch for the most recent version:
|
|
74
|
+
|
|
75
|
+
``` bash
|
|
76
|
+
git clone https://gitlab.gwdg.de/tms-localization/pynibs
|
|
77
|
+
cd pynibs
|
|
78
|
+
git checkout dev
|
|
79
|
+
pip install -e .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
See [here](https://gitlab.gwdg.de/tms-localization/papers/tmsloc_proto/-/blob/2aec4763edf17e7a2ac604403287bc7fb10285ff/README.md) for more detailed installation instructions.
|
|
83
|
+
|
|
84
|
+
To import CED Signal EMG data use the `export to .mat` feature of Signal.
|
|
85
|
+
To read `.cfs` files exported with CED Signal you might need to [manually](HOW_TO_INSTALL_BIOSIG.txt) compile the libbiosig package.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## Bugs
|
|
89
|
+
For sure. Please open an [issue](https://gitlab.gwdg.de/tms-localization/pynibs/-/issues) or feel free to file a PR.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Citation
|
|
93
|
+
Please cite _Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. NeuroImage, 245, 118654. doi:[10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)_ when using this toolbox in your research.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## References
|
|
97
|
+
- Weise*, K., Numssen*, O., Thielscher, A., Hartwigsen, G., & Knösche, T. R. (2020). A novel approach to localize cortical TMS effects. *NeuroImage*, 209, 116486. doi: [10.1016/j.neuroimage.2019.116486](https://doi.org/10.1016/j.neuroimage.2019.116486)
|
|
98
|
+
- Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. *NeuroImage*, 245, 118654. doi: [10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)
|
|
99
|
+
- Weise*, K., Numssen*, O., Kalloch, B., Zier, A. L., Thielscher, A., Hartwigsen°, G., Knösche°, T. R. (2023). Precise transcranial magnetic stimulation motor-mapping. *Nature Protocols*. doi: [10.1038/s41596-022-00776-6](https://doi.org/10.1038/s41596-022-00776-6)
|
|
100
|
+
- Jing, Y., Numssen, O., Weise, K., Kalloch, B., Buchberger, L., Haueisen, J., Hartwigsen, G., Knösche, T. (2023). Modeling the Effects of Transcranial Magnetic Stimulation on Spatial Attention. *Physics in Medicine & Biology*. doi: [10.1088/1361-6560/acff34](https://doi.org/10.1088/1361-6560/acff34)
|
|
101
|
+
- Numssen*, O., Kuhnke*, P., Weise, K., & Hartwigsen, G. (2024). Electric field based dosing for TMS. *Imaging Neuroscience*. doi: [10.1162/imag_a_00106](https://doi.org/10.1162/imag_a_00106)
|
|
102
|
+
- Numssen, O., Martin, S., Williams, K., Knösche, T. R., & Hartwigsen, G. (2024). Quantification of subject motion during TMS via pulsewise coil displacement. *Brain Stimulation, 17*(5), 1045–1047. doi: [10.1016/j.brs.2024.08.009](https://doi.org/10.1016/j.brs.2024.08.009)
|
|
103
|
+
- Weise, K., Makaroff, S. N., Numssen, O., Bikson, M., & Knösche, T. R. (2025). Statistical method accounts for microscopic electric field distortions around neurons when simulating activation thresholds. *Brain Stimulation, 18*(2), 280–286. doi: [10.1016/j.brs.2025.02.007](https://doi.org/10.1016/j.brs.2025.02.007)
|
|
104
|
+
- Jing, Y., Numssen, O., Hartwigsen, G., Knösche, T. R., & Weise, K. (2024). Effects of Electric Field Direction on TMS-based Motor Cortex Mapping. *bioRxiv*. doi: [10.1101/2024.12.10.627753](https://doi.org/10.1101/2024.12.10.627753)
|
|
105
|
+
- Numssen*, O., Martin*, C. W., Worbs, T., Thielscher, A., Weise, K., & Knösche, T. R. (2025). Optimizing and assessing multichannel TMS focality. *bioRxiv*. doi: [10.1101/2025.09.19.677136](https://doi.org/10.1101/2025.09.19.677136)
|
|
@@ -9,7 +9,7 @@ Preprocessing, postprocessing, and analyses routines for non-invasive brain stim
|
|
|
9
9
|

|
|
10
10
|
|
|
11
11
|
`pyNIBS` provides the functions to allow **cortical mappings** with transcranial magnetic stimulation (TMS) via **functional analysis**. `pyNIBS` is developed to work with [SimNIBS](http://www.simnibs.org), i.e. SimNIBS' meshes and FEM results can directly be used.
|
|
12
|
-
Currently, [SimNIBS
|
|
12
|
+
Currently, [SimNIBS >=4.0](https://github.com/simnibs/simnibs/releases/latest) is supported.
|
|
13
13
|
|
|
14
14
|
See the [documentation](https://pynibs.readthedocs.io/) for package details and our [protocol](https://doi.org/10.1038/s41596-022-00776-6) publication for a extensive usage examples. Free view only version of the paper: https://t.co/uv7CmVw6tp.
|
|
15
15
|
|
|
@@ -45,7 +45,11 @@ Please cite _Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche,
|
|
|
45
45
|
|
|
46
46
|
## References
|
|
47
47
|
- Weise*, K., Numssen*, O., Thielscher, A., Hartwigsen, G., & Knösche, T. R. (2020). A novel approach to localize cortical TMS effects. *NeuroImage*, 209, 116486. doi: [10.1016/j.neuroimage.2019.116486](https://doi.org/10.1016/j.neuroimage.2019.116486)
|
|
48
|
-
- Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. *NeuroImage*, 245, 118654. doi:[10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)
|
|
49
|
-
- Weise*, K., Numssen*, O., Kalloch, B., Zier, A. L., Thielscher, A., Hartwigsen°, G., Knösche°, T. R. (2023). Precise transcranial magnetic stimulation motor-mapping. *Nature Protocols*. doi:[10.1038/s41596-022-00776-6](https://doi.org/10.1038/s41596-022-00776-6)
|
|
48
|
+
- Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. *NeuroImage*, 245, 118654. doi: [10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)
|
|
49
|
+
- Weise*, K., Numssen*, O., Kalloch, B., Zier, A. L., Thielscher, A., Hartwigsen°, G., Knösche°, T. R. (2023). Precise transcranial magnetic stimulation motor-mapping. *Nature Protocols*. doi: [10.1038/s41596-022-00776-6](https://doi.org/10.1038/s41596-022-00776-6)
|
|
50
50
|
- Jing, Y., Numssen, O., Weise, K., Kalloch, B., Buchberger, L., Haueisen, J., Hartwigsen, G., Knösche, T. (2023). Modeling the Effects of Transcranial Magnetic Stimulation on Spatial Attention. *Physics in Medicine & Biology*. doi: [10.1088/1361-6560/acff34](https://doi.org/10.1088/1361-6560/acff34)
|
|
51
|
-
- Numssen
|
|
51
|
+
- Numssen*, O., Kuhnke*, P., Weise, K., & Hartwigsen, G. (2024). Electric field based dosing for TMS. *Imaging Neuroscience*. doi: [10.1162/imag_a_00106](https://doi.org/10.1162/imag_a_00106)
|
|
52
|
+
- Numssen, O., Martin, S., Williams, K., Knösche, T. R., & Hartwigsen, G. (2024). Quantification of subject motion during TMS via pulsewise coil displacement. *Brain Stimulation, 17*(5), 1045–1047. doi: [10.1016/j.brs.2024.08.009](https://doi.org/10.1016/j.brs.2024.08.009)
|
|
53
|
+
- Weise, K., Makaroff, S. N., Numssen, O., Bikson, M., & Knösche, T. R. (2025). Statistical method accounts for microscopic electric field distortions around neurons when simulating activation thresholds. *Brain Stimulation, 18*(2), 280–286. doi: [10.1016/j.brs.2025.02.007](https://doi.org/10.1016/j.brs.2025.02.007)
|
|
54
|
+
- Jing, Y., Numssen, O., Hartwigsen, G., Knösche, T. R., & Weise, K. (2024). Effects of Electric Field Direction on TMS-based Motor Cortex Mapping. *bioRxiv*. doi: [10.1101/2024.12.10.627753](https://doi.org/10.1101/2024.12.10.627753)
|
|
55
|
+
- Numssen*, O., Martin*, C. W., Worbs, T., Thielscher, A., Weise, K., & Knösche, T. R. (2025). Optimizing and assessing multichannel TMS focality. *bioRxiv*. doi: [10.1101/2025.09.19.677136](https://doi.org/10.1101/2025.09.19.677136)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyNIBS
|
|
3
|
+
Version: 0.2026.1
|
|
4
|
+
Summary: A python toolbox to conduct non-invasive brain stimulation (NIBS) experiments.
|
|
5
|
+
Author: Konstantin Weise, Ole Numssen, Benjamin Kalloch
|
|
6
|
+
Maintainer-email: Konstantin Weise <weise@cbs.mpg.de>, Ole Numssen <numssen@cbs.mpg.de>
|
|
7
|
+
License: GPL3
|
|
8
|
+
Project-URL: Home, https://gitlab.gwdg.de/tms-localization/pynibs
|
|
9
|
+
Project-URL: Docs, https://pynibs.readthedocs.io/
|
|
10
|
+
Project-URL: Twitter, https://www.twitter.com/num_ole
|
|
11
|
+
Project-URL: Bluesky, https://bsky.app/profile/numole.bsky.social
|
|
12
|
+
Project-URL: Download, https://pypi.org/project/pynibs/
|
|
13
|
+
Keywords: NIBS,non-invasive brain stimulation,TMS,FEM
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: cython>=0.29.20
|
|
23
|
+
Requires-Dist: h5py>=2.10.0
|
|
24
|
+
Requires-Dist: lmfit
|
|
25
|
+
Requires-Dist: matplotlib>=3.2.1
|
|
26
|
+
Requires-Dist: meshio
|
|
27
|
+
Requires-Dist: nibabel>=3.0.2
|
|
28
|
+
Requires-Dist: nilearn>=0.6.2
|
|
29
|
+
Requires-Dist: numpy<2
|
|
30
|
+
Requires-Dist: ortools
|
|
31
|
+
Requires-Dist: pandas>=1.0.3
|
|
32
|
+
Requires-Dist: pyyaml>=5.3.1
|
|
33
|
+
Requires-Dist: scikit-learn>=0.22.1
|
|
34
|
+
Requires-Dist: scipy>=1.4.1
|
|
35
|
+
Requires-Dist: scikit-image
|
|
36
|
+
Requires-Dist: setuptools>=49.1.0
|
|
37
|
+
Requires-Dist: tqdm>=4.45.0
|
|
38
|
+
Requires-Dist: trimesh>=3.8.11
|
|
39
|
+
Requires-Dist: transformations
|
|
40
|
+
Requires-Dist: fslpy
|
|
41
|
+
Requires-Dist: pygpc>=0.4.1
|
|
42
|
+
Requires-Dist: uncertainties
|
|
43
|
+
Requires-Dist: asteval
|
|
44
|
+
Requires-Dist: jsonschema
|
|
45
|
+
Requires-Dist: tables
|
|
46
|
+
Requires-Dist: vtk
|
|
47
|
+
Requires-Dist: rtree
|
|
48
|
+
Requires-Dist: tvb-gdist
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# pyNIBS
|
|
52
|
+
Preprocessing, postprocessing, and analyses routines for non-invasive brain stimulation experiments.
|
|
53
|
+
|
|
54
|
+
[](https://gitlab.gwdg.de/tms-localization/pynibs)
|
|
55
|
+
[](https://pynibs.readthedocs.io/)
|
|
56
|
+
[](https://gitlab.gwdg.de/tms-localization/pynibs/commits/master)
|
|
57
|
+
[](https://tms-localization.pages.gwdg.de/pynibs)
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
`pyNIBS` provides the functions to allow **cortical mappings** with transcranial magnetic stimulation (TMS) via **functional analysis**. `pyNIBS` is developed to work with [SimNIBS](http://www.simnibs.org), i.e. SimNIBS' meshes and FEM results can directly be used.
|
|
62
|
+
Currently, [SimNIBS >=4.0](https://github.com/simnibs/simnibs/releases/latest) is supported.
|
|
63
|
+
|
|
64
|
+
See the [documentation](https://pynibs.readthedocs.io/) for package details and our [protocol](https://doi.org/10.1038/s41596-022-00776-6) publication for a extensive usage examples. Free view only version of the paper: https://t.co/uv7CmVw6tp.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
Via PiP:
|
|
68
|
+
|
|
69
|
+
``` bash
|
|
70
|
+
pip install pynibs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or clone the source repository and install the development branch for the most recent version:
|
|
74
|
+
|
|
75
|
+
``` bash
|
|
76
|
+
git clone https://gitlab.gwdg.de/tms-localization/pynibs
|
|
77
|
+
cd pynibs
|
|
78
|
+
git checkout dev
|
|
79
|
+
pip install -e .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
See [here](https://gitlab.gwdg.de/tms-localization/papers/tmsloc_proto/-/blob/2aec4763edf17e7a2ac604403287bc7fb10285ff/README.md) for more detailed installation instructions.
|
|
83
|
+
|
|
84
|
+
To import CED Signal EMG data use the `export to .mat` feature of Signal.
|
|
85
|
+
To read `.cfs` files exported with CED Signal you might need to [manually](HOW_TO_INSTALL_BIOSIG.txt) compile the libbiosig package.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## Bugs
|
|
89
|
+
For sure. Please open an [issue](https://gitlab.gwdg.de/tms-localization/pynibs/-/issues) or feel free to file a PR.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Citation
|
|
93
|
+
Please cite _Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. NeuroImage, 245, 118654. doi:[10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)_ when using this toolbox in your research.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## References
|
|
97
|
+
- Weise*, K., Numssen*, O., Thielscher, A., Hartwigsen, G., & Knösche, T. R. (2020). A novel approach to localize cortical TMS effects. *NeuroImage*, 209, 116486. doi: [10.1016/j.neuroimage.2019.116486](https://doi.org/10.1016/j.neuroimage.2019.116486)
|
|
98
|
+
- Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. *NeuroImage*, 245, 118654. doi: [10.1016/j.neuroimage.2021.118654](https://doi.org/10.1016/j.neuroimage.2021.118654)
|
|
99
|
+
- Weise*, K., Numssen*, O., Kalloch, B., Zier, A. L., Thielscher, A., Hartwigsen°, G., Knösche°, T. R. (2023). Precise transcranial magnetic stimulation motor-mapping. *Nature Protocols*. doi: [10.1038/s41596-022-00776-6](https://doi.org/10.1038/s41596-022-00776-6)
|
|
100
|
+
- Jing, Y., Numssen, O., Weise, K., Kalloch, B., Buchberger, L., Haueisen, J., Hartwigsen, G., Knösche, T. (2023). Modeling the Effects of Transcranial Magnetic Stimulation on Spatial Attention. *Physics in Medicine & Biology*. doi: [10.1088/1361-6560/acff34](https://doi.org/10.1088/1361-6560/acff34)
|
|
101
|
+
- Numssen*, O., Kuhnke*, P., Weise, K., & Hartwigsen, G. (2024). Electric field based dosing for TMS. *Imaging Neuroscience*. doi: [10.1162/imag_a_00106](https://doi.org/10.1162/imag_a_00106)
|
|
102
|
+
- Numssen, O., Martin, S., Williams, K., Knösche, T. R., & Hartwigsen, G. (2024). Quantification of subject motion during TMS via pulsewise coil displacement. *Brain Stimulation, 17*(5), 1045–1047. doi: [10.1016/j.brs.2024.08.009](https://doi.org/10.1016/j.brs.2024.08.009)
|
|
103
|
+
- Weise, K., Makaroff, S. N., Numssen, O., Bikson, M., & Knösche, T. R. (2025). Statistical method accounts for microscopic electric field distortions around neurons when simulating activation thresholds. *Brain Stimulation, 18*(2), 280–286. doi: [10.1016/j.brs.2025.02.007](https://doi.org/10.1016/j.brs.2025.02.007)
|
|
104
|
+
- Jing, Y., Numssen, O., Hartwigsen, G., Knösche, T. R., & Weise, K. (2024). Effects of Electric Field Direction on TMS-based Motor Cortex Mapping. *bioRxiv*. doi: [10.1101/2024.12.10.627753](https://doi.org/10.1101/2024.12.10.627753)
|
|
105
|
+
- Numssen*, O., Martin*, C. W., Worbs, T., Thielscher, A., Weise, K., & Knösche, T. R. (2025). Optimizing and assessing multichannel TMS focality. *bioRxiv*. doi: [10.1101/2025.09.19.677136](https://doi.org/10.1101/2025.09.19.677136)
|
|
@@ -3,28 +3,6 @@ README.md
|
|
|
3
3
|
pyproject.toml
|
|
4
4
|
requirements.txt
|
|
5
5
|
setup.cfg
|
|
6
|
-
setup.py
|
|
7
|
-
data/configuration_exp0.yaml
|
|
8
|
-
data/configuration_linear_MEP.yaml
|
|
9
|
-
data/configuration_linear_RT.yaml
|
|
10
|
-
data/configuration_sigmoid4.yaml
|
|
11
|
-
data/network mapping configuration/configuration guide.md
|
|
12
|
-
data/network mapping configuration/configuration_TEMPLATE.yaml
|
|
13
|
-
data/network mapping configuration/configuration_for_testing.yaml
|
|
14
|
-
data/network mapping configuration/configuration_modelTMS.yaml
|
|
15
|
-
data/network mapping configuration/configuration_reg_isi_05.yaml
|
|
16
|
-
data/network mapping configuration/output_documentation.md
|
|
17
|
-
data/network mapping configuration/recommendations_for_accuracy_threshold.md
|
|
18
|
-
data/neuron/models/L23_PC_cADpyr_biphasic_v1.csv
|
|
19
|
-
data/neuron/models/L23_PC_cADpyr_monophasic_v1.csv
|
|
20
|
-
data/neuron/models/L4_LBC_biphasic_v1.csv
|
|
21
|
-
data/neuron/models/L4_LBC_monophasic_v1.csv
|
|
22
|
-
data/neuron/models/L4_NBC_biphasic_v1.csv
|
|
23
|
-
data/neuron/models/L4_NBC_monophasic_v1.csv
|
|
24
|
-
data/neuron/models/L4_SBC_biphasic_v1.csv
|
|
25
|
-
data/neuron/models/L4_SBC_monophasic_v1.csv
|
|
26
|
-
data/neuron/models/L5_TTPC2_cADpyr_biphasic_v1.csv
|
|
27
|
-
data/neuron/models/L5_TTPC2_cADpyr_monophasic_v1.csv
|
|
28
6
|
pyNIBS.egg-info/PKG-INFO
|
|
29
7
|
pyNIBS.egg-info/SOURCES.txt
|
|
30
8
|
pyNIBS.egg-info/dependency_links.txt
|
|
@@ -32,12 +10,14 @@ pyNIBS.egg-info/not-zip-safe
|
|
|
32
10
|
pyNIBS.egg-info/requires.txt
|
|
33
11
|
pyNIBS.egg-info/top_level.txt
|
|
34
12
|
pynibs/__init__.py
|
|
35
|
-
pynibs/coil.py
|
|
36
13
|
pynibs/freesurfer.py
|
|
37
14
|
pynibs/muap.py
|
|
38
15
|
pynibs/subject.py
|
|
39
16
|
pynibs/tensor_scaling.py
|
|
40
17
|
pynibs/tms_pulse.py
|
|
18
|
+
pynibs/coil/__init__.py
|
|
19
|
+
pynibs/coil/coil.py
|
|
20
|
+
pynibs/coil/export.py
|
|
41
21
|
pynibs/congruence/__init__.py
|
|
42
22
|
pynibs/congruence/congruence.py
|
|
43
23
|
pynibs/congruence/ext_metrics.py
|
|
@@ -49,7 +29,9 @@ pynibs/expio/brainvis.py
|
|
|
49
29
|
pynibs/expio/cobot.py
|
|
50
30
|
pynibs/expio/exp.py
|
|
51
31
|
pynibs/expio/fit_funs.py
|
|
32
|
+
pynibs/expio/invesalius.py
|
|
52
33
|
pynibs/expio/localite.py
|
|
34
|
+
pynibs/expio/neurone.py
|
|
53
35
|
pynibs/expio/signal_ced.py
|
|
54
36
|
pynibs/expio/visor.py
|
|
55
37
|
pynibs/hdf5_io/__init__.py
|
|
@@ -64,10 +46,12 @@ pynibs/models/__init__.py
|
|
|
64
46
|
pynibs/neuron/__init__.py
|
|
65
47
|
pynibs/neuron/neuron_regression.py
|
|
66
48
|
pynibs/neuron/util.py
|
|
49
|
+
pynibs/neuron/models/m1_montbrio.py
|
|
50
|
+
pynibs/neuron/models/mep.py
|
|
67
51
|
pynibs/optimization/__init__.py
|
|
52
|
+
pynibs/optimization/coil_opt.py
|
|
68
53
|
pynibs/optimization/multichannel.py
|
|
69
54
|
pynibs/optimization/opt_mep.py
|
|
70
|
-
pynibs/optimization/optimization.py
|
|
71
55
|
pynibs/optimization/workhorses.py
|
|
72
56
|
pynibs/pckg/__init__.py
|
|
73
57
|
pynibs/pckg/biosig/biosig4c++-1.9.5.src_fixed.tar.gz
|
|
@@ -76,16 +60,15 @@ pynibs/pckg/libeep/pyeep.so
|
|
|
76
60
|
pynibs/regression/__init__.py
|
|
77
61
|
pynibs/regression/dual_node_detection.py
|
|
78
62
|
pynibs/regression/regression.py
|
|
79
|
-
pynibs/regression/score_types.py
|
|
80
63
|
pynibs/roi/__init__.py
|
|
81
|
-
pynibs/roi/roi.py
|
|
82
64
|
pynibs/roi/roi_structs.py
|
|
65
|
+
pynibs/roi/roi_utils.py
|
|
83
66
|
pynibs/util/__init__.py
|
|
84
67
|
pynibs/util/dosing.py
|
|
85
68
|
pynibs/util/quality_measures.py
|
|
86
69
|
pynibs/util/rotations.py
|
|
87
|
-
pynibs/util/
|
|
88
|
-
pynibs/util/
|
|
70
|
+
pynibs/util/simnibs_io.py
|
|
71
|
+
pynibs/util/utils.py
|
|
89
72
|
pynibs/visualization/__init__.py
|
|
90
73
|
pynibs/visualization/para.py
|
|
91
74
|
pynibs/visualization/plot_2D.py
|
|
@@ -95,20 +78,12 @@ tests/test_elements2nodes.py
|
|
|
95
78
|
tests/test_mesh_transformations.py
|
|
96
79
|
tests/test_mesh_utils.py
|
|
97
80
|
tests/test_nnav_imports.py
|
|
81
|
+
tests/test_opt_coil.py
|
|
82
|
+
tests/test_opt_mtms.py
|
|
83
|
+
tests/test_optimization_multichannel.py
|
|
98
84
|
tests/test_quality_measures.py
|
|
99
85
|
tests/test_regressdata.py
|
|
100
86
|
tests/test_roi.py
|
|
101
87
|
tests/test_rotations.py
|
|
102
88
|
tests/test_subject.py
|
|
103
|
-
tests/test_util.py
|
|
104
|
-
tests/data/InstrumentMarker20200225163611937.xml
|
|
105
|
-
tests/data/TriggerMarkers_Coil0_20200225163443682.xml
|
|
106
|
-
tests/data/TriggerMarkers_Coil1_20200225170337572.xml
|
|
107
|
-
tests/data/Xdmf.dtd
|
|
108
|
-
tests/data/brainsight_niiImage_nifticoord.txt
|
|
109
|
-
tests/data/brainsight_niiImage_nifticoord_largefile.txt
|
|
110
|
-
tests/data/brainsight_niiImage_niifticoord_mixedtargets.txt
|
|
111
|
-
tests/data/create_subject_testsub.py
|
|
112
|
-
tests/data/data.hdf5
|
|
113
|
-
tests/data/geo.hdf5
|
|
114
|
-
tests/test_hdf5_io/test_xdmf.py
|
|
89
|
+
tests/test_util.py
|
|
@@ -5,8 +5,8 @@ matplotlib>=3.2.1
|
|
|
5
5
|
meshio
|
|
6
6
|
nibabel>=3.0.2
|
|
7
7
|
nilearn>=0.6.2
|
|
8
|
-
numpy
|
|
9
|
-
ortools
|
|
8
|
+
numpy<2
|
|
9
|
+
ortools
|
|
10
10
|
pandas>=1.0.3
|
|
11
11
|
pyyaml>=5.3.1
|
|
12
12
|
scikit-learn>=0.22.1
|
|
@@ -15,11 +15,13 @@ scikit-image
|
|
|
15
15
|
setuptools>=49.1.0
|
|
16
16
|
tqdm>=4.45.0
|
|
17
17
|
trimesh>=3.8.11
|
|
18
|
-
|
|
18
|
+
transformations
|
|
19
19
|
fslpy
|
|
20
|
+
pygpc>=0.4.1
|
|
20
21
|
uncertainties
|
|
21
22
|
asteval
|
|
22
23
|
jsonschema
|
|
23
24
|
tables
|
|
24
25
|
vtk
|
|
25
|
-
|
|
26
|
+
rtree
|
|
27
|
+
tvb-gdist
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
__all__ = ["coil", "expio", "freesurfer", "hdf5_io", "mesh", "models", "neuron", "optimization", "regression", "roi",
|
|
2
|
+
"subject", "tensor_scaling", "tensor_scaling", "tms_pulse", "util", "visualization"]
|
|
3
|
+
|
|
4
|
+
from .hdf5_io import *
|
|
5
|
+
from .subject import *
|
|
6
|
+
from .visualization import *
|
|
7
|
+
from .freesurfer import *
|
|
8
|
+
from .hdf5_io import *
|
|
9
|
+
from .optimization import *
|
|
10
|
+
from .roi import *
|
|
11
|
+
from .subject import *
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from .pckg import libeep
|
|
15
|
+
except (ImportError, SyntaxError):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
_lazy_modules = {
|
|
19
|
+
"coil": "pynibs.coil",
|
|
20
|
+
"expio": "pynibs.expio",
|
|
21
|
+
"mesh": "pynibs.mesh",
|
|
22
|
+
"models": "pynibs.models",
|
|
23
|
+
"neuron": "pynibs.neuron",
|
|
24
|
+
"regression": "pynibs.regression",
|
|
25
|
+
'visualization': "pynibs.visualization",
|
|
26
|
+
"util":"pynibs.util"
|
|
27
|
+
}
|
|
28
|
+
__version__ = "0.2026.1"
|
|
29
|
+
|
|
30
|
+
# when pipped, datadir is under pynibs
|
|
31
|
+
__testdatadir__ = os.path.join(os.path.dirname(__file__), '..', 'tests', 'data')
|
|
32
|
+
__datadir__ = os.path.join(os.path.dirname(__file__), '..', 'data')
|
|
33
|
+
if not os.path.exists(__testdatadir__):
|
|
34
|
+
__testdatadir__ = os.path.join(os.path.dirname(__file__), 'tests', 'data')
|
|
35
|
+
__datadir__ = os.path.join(os.path.dirname(__file__), 'data')
|
|
36
|
+
if not os.path.exists(__testdatadir__):
|
|
37
|
+
warnings.warn(f"Cannot find pynibs.__testdatadir__='{__testdatadir__}'")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __getattr__(name):
|
|
41
|
+
if name in _lazy_modules:
|
|
42
|
+
import importlib
|
|
43
|
+
mod = importlib.import_module(_lazy_modules[name])
|
|
44
|
+
globals()[name] = mod # cache so future accesses skip __getattr__
|
|
45
|
+
return mod
|
|
46
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name}")
|