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.
Files changed (135) hide show
  1. pynibs-0.2026.1/PKG-INFO +105 -0
  2. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/README.md +8 -4
  3. pynibs-0.2026.1/pyNIBS.egg-info/PKG-INFO +105 -0
  4. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/SOURCES.txt +15 -40
  5. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/requires.txt +6 -4
  6. pynibs-0.2026.1/pynibs/__init__.py +46 -0
  7. pynibs-0.2026.1/pynibs/coil/__init__.py +6 -0
  8. {pyNIBS-0.2024.8/pynibs → pynibs-0.2026.1/pynibs/coil}/coil.py +213 -543
  9. pynibs-0.2026.1/pynibs/coil/export.py +508 -0
  10. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/__init__.py +4 -1
  11. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/congruence.py +37 -45
  12. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/ext_metrics.py +40 -11
  13. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/congruence/stimulation_threshold.py +1 -2
  14. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/Mep.py +120 -370
  15. pynibs-0.2026.1/pynibs/expio/__init__.py +18 -0
  16. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/brainsight.py +34 -37
  17. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/cobot.py +25 -25
  18. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/exp.py +10 -7
  19. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/fit_funs.py +3 -0
  20. pynibs-0.2026.1/pynibs/expio/invesalius.py +70 -0
  21. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/localite.py +190 -91
  22. pynibs-0.2026.1/pynibs/expio/neurone.py +139 -0
  23. pynibs-0.2026.1/pynibs/expio/signal_ced.py +394 -0
  24. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/visor.py +16 -15
  25. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/freesurfer.py +34 -33
  26. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/__init__.py +0 -0
  27. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/hdf5_io.py +149 -132
  28. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/hdf5_io/xdmf.py +35 -31
  29. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/__init__.py +1 -1
  30. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/mesh_struct.py +77 -92
  31. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/transformations.py +121 -21
  32. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/mesh/utils.py +191 -99
  33. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/models/_TMS.py +2 -1
  34. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/muap.py +1 -2
  35. pynibs-0.2026.1/pynibs/neuron/__init__.py +12 -0
  36. pynibs-0.2026.1/pynibs/neuron/models/mep.py +566 -0
  37. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/neuron/neuron_regression.py +98 -8
  38. pynibs-0.2026.1/pynibs/optimization/__init__.py +15 -0
  39. pyNIBS-0.2024.8/pynibs/optimization/optimization.py → pynibs-0.2026.1/pynibs/optimization/coil_opt.py +157 -133
  40. pynibs-0.2026.1/pynibs/optimization/multichannel.py +1428 -0
  41. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/optimization/opt_mep.py +0 -0
  42. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/optimization/workhorses.py +7 -8
  43. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/__init__.py +4 -2
  44. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/dual_node_detection.py +229 -219
  45. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/regression/regression.py +92 -61
  46. pynibs-0.2026.1/pynibs/roi/__init__.py +5 -0
  47. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/roi/roi_structs.py +19 -21
  48. pyNIBS-0.2024.8/pynibs/roi/roi.py → pynibs-0.2026.1/pynibs/roi/roi_utils.py +56 -33
  49. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/subject.py +24 -14
  50. pynibs-0.2026.1/pynibs/util/__init__.py +20 -0
  51. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/dosing.py +4 -5
  52. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/quality_measures.py +39 -38
  53. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/util/rotations.py +116 -9
  54. pyNIBS-0.2024.8/pynibs/util/simnibs.py → pynibs-0.2026.1/pynibs/util/simnibs_io.py +29 -19
  55. pyNIBS-0.2024.8/pynibs/util/util.py → pynibs-0.2026.1/pynibs/util/utils.py +20 -22
  56. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/para.py +4 -4
  57. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/render_3D.py +4 -4
  58. pynibs-0.2026.1/pyproject.toml +76 -0
  59. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/requirements.txt +7 -4
  60. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_coil.py +41 -36
  61. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_elements2nodes.py +7 -7
  62. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_mesh_transformations.py +4 -4
  63. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_mesh_utils.py +45 -45
  64. pynibs-0.2026.1/tests/test_nnav_imports.py +100 -0
  65. pynibs-0.2026.1/tests/test_opt_coil.py +230 -0
  66. pynibs-0.2026.1/tests/test_opt_mtms.py +423 -0
  67. pynibs-0.2026.1/tests/test_optimization_multichannel.py +86 -0
  68. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_quality_measures.py +6 -6
  69. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_regressdata.py +59 -60
  70. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_rotations.py +16 -15
  71. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_util.py +1 -1
  72. pyNIBS-0.2024.8/PKG-INFO +0 -698
  73. pyNIBS-0.2024.8/data/configuration_exp0.yaml +0 -59
  74. pyNIBS-0.2024.8/data/configuration_linear_MEP.yaml +0 -61
  75. pyNIBS-0.2024.8/data/configuration_linear_RT.yaml +0 -61
  76. pyNIBS-0.2024.8/data/configuration_sigmoid4.yaml +0 -68
  77. pyNIBS-0.2024.8/data/network mapping configuration/configuration guide.md +0 -238
  78. pyNIBS-0.2024.8/data/network mapping configuration/configuration_TEMPLATE.yaml +0 -42
  79. pyNIBS-0.2024.8/data/network mapping configuration/configuration_for_testing.yaml +0 -43
  80. pyNIBS-0.2024.8/data/network mapping configuration/configuration_modelTMS.yaml +0 -43
  81. pyNIBS-0.2024.8/data/network mapping configuration/configuration_reg_isi_05.yaml +0 -43
  82. pyNIBS-0.2024.8/data/network mapping configuration/output_documentation.md +0 -185
  83. pyNIBS-0.2024.8/data/network mapping configuration/recommendations_for_accuracy_threshold.md +0 -77
  84. pyNIBS-0.2024.8/data/neuron/models/L23_PC_cADpyr_biphasic_v1.csv +0 -1281
  85. pyNIBS-0.2024.8/data/neuron/models/L23_PC_cADpyr_monophasic_v1.csv +0 -1281
  86. pyNIBS-0.2024.8/data/neuron/models/L4_LBC_biphasic_v1.csv +0 -1281
  87. pyNIBS-0.2024.8/data/neuron/models/L4_LBC_monophasic_v1.csv +0 -1281
  88. pyNIBS-0.2024.8/data/neuron/models/L4_NBC_biphasic_v1.csv +0 -1281
  89. pyNIBS-0.2024.8/data/neuron/models/L4_NBC_monophasic_v1.csv +0 -1281
  90. pyNIBS-0.2024.8/data/neuron/models/L4_SBC_biphasic_v1.csv +0 -1281
  91. pyNIBS-0.2024.8/data/neuron/models/L4_SBC_monophasic_v1.csv +0 -1281
  92. pyNIBS-0.2024.8/data/neuron/models/L5_TTPC2_cADpyr_biphasic_v1.csv +0 -1281
  93. pyNIBS-0.2024.8/data/neuron/models/L5_TTPC2_cADpyr_monophasic_v1.csv +0 -1281
  94. pyNIBS-0.2024.8/pyNIBS.egg-info/PKG-INFO +0 -698
  95. pyNIBS-0.2024.8/pynibs/__init__.py +0 -34
  96. pyNIBS-0.2024.8/pynibs/expio/__init__.py +0 -8
  97. pyNIBS-0.2024.8/pynibs/expio/signal_ced.py +0 -51
  98. pyNIBS-0.2024.8/pynibs/neuron/__init__.py +0 -2
  99. pyNIBS-0.2024.8/pynibs/optimization/__init__.py +0 -5
  100. pyNIBS-0.2024.8/pynibs/optimization/multichannel.py +0 -278
  101. pyNIBS-0.2024.8/pynibs/roi/__init__.py +0 -2
  102. pyNIBS-0.2024.8/pynibs/util/__init__.py +0 -4
  103. pyNIBS-0.2024.8/pyproject.toml +0 -29
  104. pyNIBS-0.2024.8/setup.py +0 -123
  105. pyNIBS-0.2024.8/tests/data/InstrumentMarker20200225163611937.xml +0 -19
  106. pyNIBS-0.2024.8/tests/data/TriggerMarkers_Coil0_20200225163443682.xml +0 -14
  107. pyNIBS-0.2024.8/tests/data/TriggerMarkers_Coil1_20200225170337572.xml +0 -6373
  108. pyNIBS-0.2024.8/tests/data/Xdmf.dtd +0 -89
  109. pyNIBS-0.2024.8/tests/data/brainsight_niiImage_nifticoord.txt +0 -145
  110. pyNIBS-0.2024.8/tests/data/brainsight_niiImage_nifticoord_largefile.txt +0 -1434
  111. pyNIBS-0.2024.8/tests/data/brainsight_niiImage_niifticoord_mixedtargets.txt +0 -47
  112. pyNIBS-0.2024.8/tests/data/create_subject_testsub.py +0 -332
  113. pyNIBS-0.2024.8/tests/data/data.hdf5 +0 -0
  114. pyNIBS-0.2024.8/tests/data/geo.hdf5 +0 -0
  115. pyNIBS-0.2024.8/tests/test_hdf5_io/test_xdmf.py +0 -61
  116. pyNIBS-0.2024.8/tests/test_nnav_imports.py +0 -101
  117. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/LICENSE +0 -0
  118. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/dependency_links.txt +0 -0
  119. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/not-zip-safe +0 -0
  120. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pyNIBS.egg-info/top_level.txt +0 -0
  121. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/expio/brainvis.py +0 -0
  122. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/models/__init__.py +0 -0
  123. /pyNIBS-0.2024.8/pynibs/pckg/__init__.py → /pynibs-0.2026.1/pynibs/neuron/models/m1_montbrio.py +0 -0
  124. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/neuron/util.py +0 -0
  125. {pyNIBS-0.2024.8/pynibs/pckg/libeep → pynibs-0.2026.1/pynibs/pckg}/__init__.py +0 -0
  126. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/pckg/biosig/biosig4c++-1.9.5.src_fixed.tar.gz +0 -0
  127. /pyNIBS-0.2024.8/pynibs/regression/score_types.py → /pynibs-0.2026.1/pynibs/pckg/libeep/__init__.py +0 -0
  128. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/pckg/libeep/pyeep.so +0 -0
  129. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/tensor_scaling.py +0 -0
  130. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/tms_pulse.py +0 -0
  131. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/__init__.py +0 -0
  132. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/pynibs/visualization/plot_2D.py +0 -0
  133. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/setup.cfg +0 -0
  134. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_roi.py +0 -0
  135. {pyNIBS-0.2024.8 → pynibs-0.2026.1}/tests/test_subject.py +0 -0
@@ -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
+ [![Latest Release](https://gitlab.gwdg.de/tms-localization/pynibs/-/badges/release.svg)](https://gitlab.gwdg.de/tms-localization/pynibs)
55
+ [![Documentation](https://readthedocs.org/projects/pynibs/badge/)](https://pynibs.readthedocs.io/)
56
+ [![pipeline status](https://gitlab.gwdg.de/tms-localization/pynibs/badges/master/pipeline.svg)](https://gitlab.gwdg.de/tms-localization/pynibs/commits/master)
57
+ [![coverage report](https://gitlab.gwdg.de/tms-localization/pynibs/badges/master/coverage.svg)](https://tms-localization.pages.gwdg.de/pynibs)
58
+
59
+ ![](https://gitlab.gwdg.de/uploads/-/system/project/avatar/9753/Fig_4.png?width=128)
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
  ![](https://gitlab.gwdg.de/uploads/-/system/project/avatar/9753/Fig_4.png?width=128)
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 3.2.6](https://github.com/simnibs/simnibs/releases/tag/v3.2.6) and [SimNIBS >=4.0](https://github.com/simnibs/simnibs/releases/latest) are supported.
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, 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)
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
+ [![Latest Release](https://gitlab.gwdg.de/tms-localization/pynibs/-/badges/release.svg)](https://gitlab.gwdg.de/tms-localization/pynibs)
55
+ [![Documentation](https://readthedocs.org/projects/pynibs/badge/)](https://pynibs.readthedocs.io/)
56
+ [![pipeline status](https://gitlab.gwdg.de/tms-localization/pynibs/badges/master/pipeline.svg)](https://gitlab.gwdg.de/tms-localization/pynibs/commits/master)
57
+ [![coverage report](https://gitlab.gwdg.de/tms-localization/pynibs/badges/master/coverage.svg)](https://tms-localization.pages.gwdg.de/pynibs)
58
+
59
+ ![](https://gitlab.gwdg.de/uploads/-/system/project/avatar/9753/Fig_4.png?width=128)
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/simnibs.py
88
- pynibs/util/util.py
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<=2.0.0
9
- ortools<=9.1.9490
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
- tvb_gdist
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
- fmm3dpy
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}")
@@ -0,0 +1,6 @@
1
+ """
2
+ All functions to operate on TMS coils go here, for example to create ``.xdmf`` files to visualize coil positions.
3
+ """
4
+
5
+ from .coil import *
6
+ from .export import *