livn 1.0.0__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 (315) hide show
  1. livn-1.0.0/.githooks/pre-commit +5 -0
  2. livn-1.0.0/.github/actions/install-neuron/action.yml +56 -0
  3. livn-1.0.0/.github/workflows/ci.yml +185 -0
  4. livn-1.0.0/.github/workflows/deploy-docs.yml +51 -0
  5. livn-1.0.0/.github/workflows/publish.yml +28 -0
  6. livn-1.0.0/.gitignore +147 -0
  7. livn-1.0.0/.python-version +1 -0
  8. livn-1.0.0/LICENSE.txt +9 -0
  9. livn-1.0.0/PKG-INFO +115 -0
  10. livn-1.0.0/README.md +101 -0
  11. livn-1.0.0/benchmarks/README.md +2 -0
  12. livn-1.0.0/benchmarks/interface/project.py +1 -0
  13. livn-1.0.0/benchmarks/pyproject.toml +17 -0
  14. livn-1.0.0/benchmarks/scaling.py +116 -0
  15. livn-1.0.0/conftest.py +274 -0
  16. livn-1.0.0/docs/.gitignore +3 -0
  17. livn-1.0.0/docs/.vitepress/config.mts +125 -0
  18. livn-1.0.0/docs/bun.lock +365 -0
  19. livn-1.0.0/docs/examples/dataset.md +3 -0
  20. livn-1.0.0/docs/examples/differentiable.md +3 -0
  21. livn-1.0.0/docs/examples/index.md +5 -0
  22. livn-1.0.0/docs/examples/simulation.md +3 -0
  23. livn-1.0.0/docs/examples/stdp-training.md +7 -0
  24. livn-1.0.0/docs/guide/advanced/cleo.md +100 -0
  25. livn-1.0.0/docs/guide/advanced/custom-backends.md +57 -0
  26. livn-1.0.0/docs/guide/advanced/decoding-pipelines.md +222 -0
  27. livn-1.0.0/docs/guide/advanced/distributed.md +96 -0
  28. livn-1.0.0/docs/guide/advanced/gymnasium.md +242 -0
  29. livn-1.0.0/docs/guide/advanced/plasticity.md +229 -0
  30. livn-1.0.0/docs/guide/backends.md +115 -0
  31. livn-1.0.0/docs/guide/concepts/decoding.md +184 -0
  32. livn-1.0.0/docs/guide/concepts/encoding.md +129 -0
  33. livn-1.0.0/docs/guide/concepts/env.md +171 -0
  34. livn-1.0.0/docs/guide/concepts/io.md +161 -0
  35. livn-1.0.0/docs/guide/concepts/model.md +150 -0
  36. livn-1.0.0/docs/guide/concepts/stimulus.md +146 -0
  37. livn-1.0.0/docs/guide/concepts/system.md +120 -0
  38. livn-1.0.0/docs/guide/getting-started.md +60 -0
  39. livn-1.0.0/docs/index.md +29 -0
  40. livn-1.0.0/docs/installation/index.md +94 -0
  41. livn-1.0.0/docs/installation/ncsa-deltaai.md +19 -0
  42. livn-1.0.0/docs/installation/phdf5.md +43 -0
  43. livn-1.0.0/docs/installation/tacc/index.md +60 -0
  44. livn-1.0.0/docs/installation/tacc/sync_venv.sh +136 -0
  45. livn-1.0.0/docs/installation/uiuc-cc.md +8 -0
  46. livn-1.0.0/docs/package.json +13 -0
  47. livn-1.0.0/docs/systems/datasets.md +49 -0
  48. livn-1.0.0/docs/systems/generate.md +252 -0
  49. livn-1.0.0/docs/systems/index.md +111 -0
  50. livn-1.0.0/docs/systems/sampling.md +188 -0
  51. livn-1.0.0/docs/systems/tuning.md +463 -0
  52. livn-1.0.0/examples/differentiable_simulation.py +89 -0
  53. livn-1.0.0/examples/distributed_workers.py +56 -0
  54. livn-1.0.0/examples/parallel_simulation.py +101 -0
  55. livn-1.0.0/examples/run_a_simulation.py +18 -0
  56. livn-1.0.0/examples/stdp_training.py +166 -0
  57. livn-1.0.0/examples/using_the_dataset.py +39 -0
  58. livn-1.0.0/pyproject.toml +80 -0
  59. livn-1.0.0/src/livn/__init__.py +30 -0
  60. livn-1.0.0/src/livn/backend/__init__.py +21 -0
  61. livn-1.0.0/src/livn/backend/brian2/__init__.py +709 -0
  62. livn-1.0.0/src/livn/backend/common.py +0 -0
  63. livn-1.0.0/src/livn/backend/config.py +13 -0
  64. livn-1.0.0/src/livn/backend/default.py +63 -0
  65. livn-1.0.0/src/livn/backend/diffrax/__init__.py +239 -0
  66. livn-1.0.0/src/livn/backend/neuron/__init__.py +1758 -0
  67. livn-1.0.0/src/livn/cli.py +84 -0
  68. livn-1.0.0/src/livn/decoding.py +668 -0
  69. livn-1.0.0/src/livn/encoding.py +27 -0
  70. livn-1.0.0/src/livn/env/__init__.py +3 -0
  71. livn-1.0.0/src/livn/env/distributed.py +934 -0
  72. livn-1.0.0/src/livn/env/gymnasium.py +251 -0
  73. livn-1.0.0/src/livn/io.py +554 -0
  74. livn-1.0.0/src/livn/models/ca1/__init__.py +602 -0
  75. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/CaconcPR.mod +56 -0
  76. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/K_GK.mod +64 -0
  77. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/K_concPR.mod +52 -0
  78. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/Na_GK.mod +76 -0
  79. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/cadPR.mod +93 -0
  80. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/constant.mod +13 -0
  81. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/hcn.mod +115 -0
  82. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/ka.mod +68 -0
  83. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/kahpPR.mod +70 -0
  84. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/kcaPR.mod +74 -0
  85. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/kd.mod +95 -0
  86. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/ksPR.mod +75 -0
  87. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/nasPR.mod +91 -0
  88. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/PinskyRinzel/sAHP.mod +93 -0
  89. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/borgka.mod +91 -0
  90. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/K_conc.mod +52 -0
  91. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/Na_conc.mod +52 -0
  92. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/cad.mod +80 -0
  93. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/cal.mod +104 -0
  94. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/caldend.mod +64 -0
  95. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/car.mod +63 -0
  96. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/carsoma.mod +64 -0
  97. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/cat.mod +125 -0
  98. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/constant.mod +27 -0
  99. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/h_mech.mod +60 -0
  100. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/hha2.mod +124 -0
  101. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/hhadend.mod +115 -0
  102. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/kad.mod +98 -0
  103. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/kca.mod +95 -0
  104. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/km.mod +87 -0
  105. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Bilash/mAHP.mod +81 -0
  106. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_CavL.mod +130 -0
  107. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_CavN.mod +139 -0
  108. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_HCN.mod +111 -0
  109. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_HCNolm.mod +127 -0
  110. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_HCNp.mod +95 -0
  111. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KCaS.mod +95 -0
  112. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Kdrfast.mod +128 -0
  113. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Kdrfastngf.mod +135 -0
  114. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Kdrp.mod +91 -0
  115. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvA.mod +117 -0
  116. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvAdistp.mod +122 -0
  117. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvAngf.mod +118 -0
  118. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvAolm.mod +117 -0
  119. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvAproxp.mod +124 -0
  120. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvCaB.mod +113 -0
  121. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvGroup.mod +129 -0
  122. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_KvM.mod +84 -0
  123. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Nav.mod +148 -0
  124. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Navaxonp.mod +117 -0
  125. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Navbis.mod +148 -0
  126. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Navcck.mod +197 -0
  127. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Navngf.mod +150 -0
  128. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_Navp.mod +147 -0
  129. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Poolos/ch_leak.mod +56 -0
  130. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/NMDA_CA1_pyr_SC.mod +111 -0
  131. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/cagk.mod +87 -0
  132. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/can2.mod +137 -0
  133. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/cat.mod +128 -0
  134. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/h.mod +78 -0
  135. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/kad.mod +106 -0
  136. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/kaprox.mod +107 -0
  137. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/kca.mod +94 -0
  138. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/kdrca1.mod +77 -0
  139. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/kmb.mod +78 -0
  140. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ca1_Tomko/naxn.mod +118 -0
  141. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/cacumm.mod +57 -0
  142. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/cagk.mod +87 -0
  143. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/can2.mod +136 -0
  144. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/cat.mod +128 -0
  145. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ccanl.mod +82 -0
  146. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/gskch.mod +78 -0
  147. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/hyperde3.mod +143 -0
  148. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/ichan2.mod +159 -0
  149. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/iconc_Ca.mod +87 -0
  150. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/kaprox.mod +121 -0
  151. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/kd.mod +89 -0
  152. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/kd_inc_tau.mod +89 -0
  153. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/kdrca1.mod +91 -0
  154. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/km.mod +91 -0
  155. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/lca.mod +107 -0
  156. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/lin_exp2syn.mod +79 -0
  157. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/lin_exp2synNMDA.mod +102 -0
  158. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/na3n.mod +131 -0
  159. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/nca.mod +116 -0
  160. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/sat_exp2syn.mod +112 -0
  161. livn-1.0.0/src/livn/models/ca1/neuron/mechanisms/vecevent.mod +187 -0
  162. livn-1.0.0/src/livn/models/ca1/neuron/templates/AxoAxonicCell.hoc +355 -0
  163. livn-1.0.0/src/livn/models/ca1/neuron/templates/BistratifiedCell.hoc +362 -0
  164. livn-1.0.0/src/livn/models/ca1/neuron/templates/CCKBasketCell.hoc +407 -0
  165. livn-1.0.0/src/livn/models/ca1/neuron/templates/ISCell.hoc +344 -0
  166. livn-1.0.0/src/livn/models/ca1/neuron/templates/IvyCell.hoc +427 -0
  167. livn-1.0.0/src/livn/models/ca1/neuron/templates/NGFCell.hoc +424 -0
  168. livn-1.0.0/src/livn/models/ca1/neuron/templates/OLMCell.hoc +347 -0
  169. livn-1.0.0/src/livn/models/ca1/neuron/templates/PRN_neuron.py +179 -0
  170. livn-1.0.0/src/livn/models/ca1/neuron/templates/PR_neuron.py +191 -0
  171. livn-1.0.0/src/livn/models/ca1/neuron/templates/PVBasketCell.hoc +375 -0
  172. livn-1.0.0/src/livn/models/ca1/neuron/templates/PoolosPyramidalCell.hoc +403 -0
  173. livn-1.0.0/src/livn/models/ca1/neuron/templates/PyramidalCellBilash.py +1164 -0
  174. livn-1.0.0/src/livn/models/ca1/neuron/templates/SCACell.hoc +400 -0
  175. livn-1.0.0/src/livn/models/izhikevich.py +73 -0
  176. livn-1.0.0/src/livn/models/lif.py +53 -0
  177. livn-1.0.0/src/livn/models/rcsd/__init__.py +1351 -0
  178. livn-1.0.0/src/livn/models/rcsd/diffrax/culture.py +96 -0
  179. livn-1.0.0/src/livn/models/rcsd/diffrax/motoneuron.py +663 -0
  180. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/CaL.mod +78 -0
  181. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/CaN.mod +86 -0
  182. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/Ca_conc.mod +53 -0
  183. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/KCa.mod +42 -0
  184. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/K_conc.mod +52 -0
  185. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/Kdr.mod +54 -0
  186. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/Na_conc.mod +52 -0
  187. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/Nap.mod +54 -0
  188. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/Nas.mod +52 -0
  189. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/BR/constant.mod +13 -0
  190. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/Gfluct2.mod +182 -0
  191. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/Gfluct3.mod +383 -0
  192. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/Ca_PR.mod +93 -0
  193. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/Ca_conc_PR.mod +56 -0
  194. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/KCa_PR.mod +74 -0
  195. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/K_PR.mod +75 -0
  196. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/K_conc_PR.mod +52 -0
  197. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/Na_PR.mod +91 -0
  198. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/Na_conc_PR.mod +52 -0
  199. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/PR/constant.mod +13 -0
  200. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/cacumm.mod +57 -0
  201. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/cagk.mod +87 -0
  202. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/cal2.mod +117 -0
  203. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/can2.mod +136 -0
  204. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/cat.mod +128 -0
  205. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/kaprox.mod +121 -0
  206. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/kd.mod +89 -0
  207. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/kd_inc_tau.mod +89 -0
  208. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/kdrca1.mod +91 -0
  209. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/km.mod +91 -0
  210. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/lin_exp2syn.mod +79 -0
  211. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/lin_exp2synNMDA.mod +97 -0
  212. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/na3n.mod +131 -0
  213. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/stdp_lin_exp2syn.mod +175 -0
  214. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/stdp_lin_exp2synNMDA.mod +179 -0
  215. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/stdp_lin_exp2syn_inh.mod +171 -0
  216. livn-1.0.0/src/livn/models/rcsd/neuron/mechanisms/vecevent.mod +187 -0
  217. livn-1.0.0/src/livn/models/rcsd/neuron/templates/BRK.py +217 -0
  218. livn-1.0.0/src/livn/models/rcsd/neuron/templates/PRN.py +179 -0
  219. livn-1.0.0/src/livn/models/slif/__init__.py +50 -0
  220. livn-1.0.0/src/livn/models/slif/snn.py +943 -0
  221. livn-1.0.0/src/livn/stimulus.py +238 -0
  222. livn-1.0.0/src/livn/system.py +1169 -0
  223. livn-1.0.0/src/livn/types.py +450 -0
  224. livn-1.0.0/src/livn/utils.py +506 -0
  225. livn-1.0.0/systems/README.md +2 -0
  226. livn-1.0.0/systems/config/CA1.yml +218 -0
  227. livn-1.0.0/systems/config/S1.yml +31 -0
  228. livn-1.0.0/systems/config/S2.yml +31 -0
  229. livn-1.0.0/systems/config/S3.yml +31 -0
  230. livn-1.0.0/systems/config/S4.yml +31 -0
  231. livn-1.0.0/systems/config/_cell_types.yml +86 -0
  232. livn-1.0.0/systems/config/_cell_types_CA1/AAC_PR.yml +59 -0
  233. livn-1.0.0/systems/config/_cell_types_CA1/BS_PR.yml +65 -0
  234. livn-1.0.0/systems/config/_cell_types_CA1/CCKBC_PR.yml +60 -0
  235. livn-1.0.0/systems/config/_cell_types_CA1/IS1_PR.yml +70 -0
  236. livn-1.0.0/systems/config/_cell_types_CA1/IS2_PR.yml +70 -0
  237. livn-1.0.0/systems/config/_cell_types_CA1/IS3_PR.yml +63 -0
  238. livn-1.0.0/systems/config/_cell_types_CA1/IVY_PR.yml +66 -0
  239. livn-1.0.0/systems/config/_cell_types_CA1/NGFC_PR.yml +48 -0
  240. livn-1.0.0/systems/config/_cell_types_CA1/OLM_PR.yml +59 -0
  241. livn-1.0.0/systems/config/_cell_types_CA1/PVBC_PR.yml +59 -0
  242. livn-1.0.0/systems/config/_cell_types_CA1/PYR_PR.yml +44 -0
  243. livn-1.0.0/systems/config/_cell_types_CA1/SCA_PR.yml +69 -0
  244. livn-1.0.0/systems/config/_definitions.yml +19 -0
  245. livn-1.0.0/systems/config/_params.yml +47 -0
  246. livn-1.0.0/systems/config/_synapses.yml +53 -0
  247. livn-1.0.0/systems/config/_synapses_CA1.yml +1605 -0
  248. livn-1.0.0/systems/convert.py +60 -0
  249. livn-1.0.0/systems/generate.py +75 -0
  250. livn-1.0.0/systems/generate_2d.py +827 -0
  251. livn-1.0.0/systems/graphs/.gitignore +2 -0
  252. livn-1.0.0/systems/interface/project.py +20 -0
  253. livn-1.0.0/systems/interface/sopt.py +272 -0
  254. livn-1.0.0/systems/mechanisms/ch_CavL.mod +130 -0
  255. livn-1.0.0/systems/mechanisms/ch_CavN.mod +139 -0
  256. livn-1.0.0/systems/mechanisms/ch_HCNolm.mod +127 -0
  257. livn-1.0.0/systems/mechanisms/ch_HCNp.mod +95 -0
  258. livn-1.0.0/systems/mechanisms/ch_KCaS.mod +95 -0
  259. livn-1.0.0/systems/mechanisms/ch_Kdrfast.mod +128 -0
  260. livn-1.0.0/systems/mechanisms/ch_Kdrp.mod +91 -0
  261. livn-1.0.0/systems/mechanisms/ch_KvA.mod +117 -0
  262. livn-1.0.0/systems/mechanisms/ch_KvAdistp.mod +122 -0
  263. livn-1.0.0/systems/mechanisms/ch_KvAolm.mod +117 -0
  264. livn-1.0.0/systems/mechanisms/ch_KvAproxp.mod +124 -0
  265. livn-1.0.0/systems/mechanisms/ch_KvCaB.mod +113 -0
  266. livn-1.0.0/systems/mechanisms/ch_Nav.mod +148 -0
  267. livn-1.0.0/systems/mechanisms/ch_Navaxonp.mod +117 -0
  268. livn-1.0.0/systems/mechanisms/ch_Navp.mod +147 -0
  269. livn-1.0.0/systems/mechanisms/ch_leak.mod +56 -0
  270. livn-1.0.0/systems/morphology/AAC.swc +1820 -0
  271. livn-1.0.0/systems/morphology/BS.swc +1820 -0
  272. livn-1.0.0/systems/morphology/CCKBC.swc +1820 -0
  273. livn-1.0.0/systems/morphology/EXC.swc +10346 -0
  274. livn-1.0.0/systems/morphology/INH.swc +1820 -0
  275. livn-1.0.0/systems/morphology/IS1.swc +1811 -0
  276. livn-1.0.0/systems/morphology/IS2.swc +1810 -0
  277. livn-1.0.0/systems/morphology/IS3.swc +1811 -0
  278. livn-1.0.0/systems/morphology/IVY.swc +1820 -0
  279. livn-1.0.0/systems/morphology/NGFC.swc +1820 -0
  280. livn-1.0.0/systems/morphology/OLM.swc +954 -0
  281. livn-1.0.0/systems/morphology/PVBC.swc +1820 -0
  282. livn-1.0.0/systems/morphology/PYR.swc +10346 -0
  283. livn-1.0.0/systems/morphology/SCA.swc +1810 -0
  284. livn-1.0.0/systems/pyproject.toml +27 -0
  285. livn-1.0.0/systems/run.py +35 -0
  286. livn-1.0.0/systems/sample.py +247 -0
  287. livn-1.0.0/systems/tacc.py +546 -0
  288. livn-1.0.0/systems/targets/EI.py +790 -0
  289. livn-1.0.0/systems/targets/protocol.py +145 -0
  290. livn-1.0.0/systems/templates/AxoAxonicCell.hoc +355 -0
  291. livn-1.0.0/systems/templates/BistratifiedCell.hoc +362 -0
  292. livn-1.0.0/systems/templates/CCKBasketCell.hoc +407 -0
  293. livn-1.0.0/systems/templates/ISCell.hoc +344 -0
  294. livn-1.0.0/systems/templates/IvyCell.hoc +427 -0
  295. livn-1.0.0/systems/templates/NGFCell.hoc +424 -0
  296. livn-1.0.0/systems/templates/OLMCell.hoc +347 -0
  297. livn-1.0.0/systems/templates/PVBasketCell.hoc +375 -0
  298. livn-1.0.0/systems/templates/PoolosPyramidalCell.hoc +403 -0
  299. livn-1.0.0/systems/templates/SCACell.hoc +400 -0
  300. livn-1.0.0/systems/templates/gEXC.hoc +405 -0
  301. livn-1.0.0/systems/templates/gINH.hoc +376 -0
  302. livn-1.0.0/systems/tune.py +214 -0
  303. livn-1.0.0/tests/cli +133 -0
  304. livn-1.0.0/tests/test_decoding.py +901 -0
  305. livn-1.0.0/tests/test_env.py +537 -0
  306. livn-1.0.0/tests/test_env_distributed.py +460 -0
  307. livn-1.0.0/tests/test_examples.py +40 -0
  308. livn-1.0.0/tests/test_io.py +196 -0
  309. livn-1.0.0/tests/test_model.py +5 -0
  310. livn-1.0.0/tests/test_pipeline_cache.py +251 -0
  311. livn-1.0.0/tests/test_stdp.py +633 -0
  312. livn-1.0.0/tests/test_stimulus.py +344 -0
  313. livn-1.0.0/tests/test_system.py +486 -0
  314. livn-1.0.0/tests/test_utils.py +268 -0
  315. livn-1.0.0/uv.lock +4690 -0
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ echo "Running lint checks..."
5
+ exec tests/cli lint
@@ -0,0 +1,56 @@
1
+ name: Install neuron deps
2
+ description: Install Python dependencies for the NEURON backend (neuroh5 with no-build-isolation)
3
+
4
+ # neuroh5 is built with no-build-isolation (configured in pyproject.toml) because
5
+ # its build requires mpi4py, which must be compiled against the system MPI — a
6
+ # prebuilt wheel from an isolated build env would link against the wrong MPI.
7
+ #
8
+ # However, no-build-isolation means neuroh5's cmake build runs against the project
9
+ # venv, and uv does not guarantee that numpy/mpi4py are installed before neuroh5
10
+ # is built within a single `uv sync`.
11
+ #
12
+ # The workaround is a three-step install:
13
+ # 1. Sync everything except neuroh5 to create the venv
14
+ # 2. Explicitly install neuroh5's build deps (mpi4py from source, numpy) since
15
+ # --no-install-package neuroh5 may skip its transitive dependencies
16
+ # 3. Install neuroh5 via `uv pip install --no-build-isolation`
17
+ #
18
+ # The neuroh5 git URL is read from pyproject.toml's override-dependencies to avoid
19
+ # duplicating the pinned commit hash.
20
+ #
21
+ # The entire .venv is cached to avoid rebuilding mpi4py and neuroh5 from source
22
+ # on every run. The cache key includes the lockfile, pyproject.toml (for
23
+ # override-dependencies), and OS so it invalidates on any dependency change.
24
+
25
+ runs:
26
+ using: composite
27
+ steps:
28
+ - name: Cache neuron venv
29
+ id: cache-venv
30
+ uses: actions/cache@v5
31
+ with:
32
+ path: .venv
33
+ key: neuron-venv-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock', 'pyproject.toml') }}
34
+
35
+ - name: Install Python dependencies (without neuroh5)
36
+ if: steps.cache-venv.outputs.cache-hit != 'true'
37
+ shell: bash
38
+ run: |
39
+ uv sync --group dev --group neuron --no-install-package neuroh5
40
+ uv pip install --no-build-isolation mpi4py
41
+
42
+ - name: Install neuroh5 (no-build-isolation, needs venv on PATH for cmake)
43
+ if: steps.cache-venv.outputs.cache-hit != 'true'
44
+ shell: bash
45
+ env:
46
+ Python_ROOT_DIR: ${{ github.workspace }}/.venv
47
+ Python3_ROOT_DIR: ${{ github.workspace }}/.venv
48
+ run: |
49
+ source .venv/bin/activate
50
+ NEUROH5_DEP=$(python -c "import tomllib; print(next(d for d in tomllib.load(open('pyproject.toml','rb'))['tool']['uv']['override-dependencies'] if 'neuroh5' in d))")
51
+ uv pip install --no-build-isolation "$NEUROH5_DEP"
52
+
53
+ - name: Sync venv from cache (fast, no-build packages already present)
54
+ if: steps.cache-venv.outputs.cache-hit == 'true'
55
+ shell: bash
56
+ run: uv sync --group dev --group neuron --no-install-package neuroh5
@@ -0,0 +1,185 @@
1
+ name: CI
2
+
3
+ on:
4
+ workflow_dispatch: # manual
5
+ # push:
6
+ # branches: [main]
7
+ # pull_request:
8
+ # branches: [main]
9
+
10
+ env:
11
+ UV_CACHE_DIR: /tmp/.uv-cache
12
+ PYTHON_VERSION: "3.12"
13
+
14
+ jobs:
15
+ lint:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+ - uses: astral-sh/setup-uv@v7
20
+ - run: uvx ruff format --check
21
+ - run: uvx ruff check
22
+
23
+ download-ei1:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v6
27
+ - uses: astral-sh/setup-uv@v7
28
+ with:
29
+ enable-cache: true
30
+ - uses: actions/setup-python@v6
31
+ with:
32
+ python-version: ${{ env.PYTHON_VERSION }}
33
+
34
+ - name: Cache EI1 system
35
+ id: cache-ei1
36
+ uses: actions/cache@v5
37
+ with:
38
+ path: systems/graphs/EI1
39
+ key: ei1-system-v1
40
+
41
+ - name: Install minimal dependencies
42
+ if: steps.cache-ei1.outputs.cache-hit != 'true'
43
+ run: uv sync --group dev
44
+
45
+ - name: Download EI1 system
46
+ if: steps.cache-ei1.outputs.cache-hit != 'true'
47
+ run: uv run tests/cli download-ei1
48
+
49
+ test-default:
50
+ runs-on: ubuntu-latest
51
+ needs: [lint, download-ei1]
52
+ steps:
53
+ - uses: actions/checkout@v6
54
+ - uses: astral-sh/setup-uv@v7
55
+ with:
56
+ enable-cache: true
57
+ - uses: actions/setup-python@v6
58
+ with:
59
+ python-version: ${{ env.PYTHON_VERSION }}
60
+
61
+ - name: Restore EI1 system
62
+ uses: actions/cache/restore@v5
63
+ with:
64
+ path: systems/graphs/EI1
65
+ key: ei1-system-v1
66
+ fail-on-cache-miss: true
67
+
68
+ - name: Install dependencies
69
+ run: uv sync --group dev
70
+
71
+ - name: Run tests
72
+ run: uv run tests/cli test --backend none
73
+
74
+ test-diffrax:
75
+ runs-on: ubuntu-latest
76
+ needs: [lint, download-ei1]
77
+ steps:
78
+ - uses: actions/checkout@v6
79
+ - uses: astral-sh/setup-uv@v7
80
+ with:
81
+ enable-cache: true
82
+ - uses: actions/setup-python@v6
83
+ with:
84
+ python-version: ${{ env.PYTHON_VERSION }}
85
+
86
+ - name: Restore EI1 system
87
+ uses: actions/cache/restore@v5
88
+ with:
89
+ path: systems/graphs/EI1
90
+ key: ei1-system-v1
91
+ fail-on-cache-miss: true
92
+
93
+ - name: Install dependencies
94
+ run: uv sync --group dev --group diffrax
95
+
96
+ - name: Run tests
97
+ run: uv run tests/cli test --backend diffrax
98
+
99
+ test-neuron:
100
+ runs-on: ubuntu-latest
101
+ needs: [lint, download-ei1]
102
+ steps:
103
+ - uses: actions/checkout@v6
104
+ - uses: astral-sh/setup-uv@v7
105
+ with:
106
+ enable-cache: true
107
+ - uses: actions/setup-python@v6
108
+ with:
109
+ python-version: ${{ env.PYTHON_VERSION }}
110
+
111
+ - name: Restore EI1 system
112
+ uses: actions/cache/restore@v5
113
+ with:
114
+ path: systems/graphs/EI1
115
+ key: ei1-system-v1
116
+ fail-on-cache-miss: true
117
+
118
+ - name: Install system dependencies
119
+ run: |
120
+ sudo apt-get update
121
+ sudo apt-get install -y cmake openmpi-bin libopenmpi-dev libhdf5-openmpi-dev hdf5-tools
122
+
123
+ - name: Install Python dependencies
124
+ uses: ./.github/actions/install-neuron
125
+
126
+ - name: Run tests
127
+ run: uv run tests/cli test --backend neuron --oversubscribe
128
+
129
+ test-brian2:
130
+ runs-on: ubuntu-latest
131
+ needs: [lint, download-ei1]
132
+ steps:
133
+ - uses: actions/checkout@v6
134
+ - uses: astral-sh/setup-uv@v7
135
+ with:
136
+ enable-cache: true
137
+ - uses: actions/setup-python@v6
138
+ with:
139
+ python-version: ${{ env.PYTHON_VERSION }}
140
+
141
+ - name: Restore EI1 system
142
+ uses: actions/cache/restore@v5
143
+ with:
144
+ path: systems/graphs/EI1
145
+ key: ei1-system-v1
146
+ fail-on-cache-miss: true
147
+
148
+ - name: Install system dependencies
149
+ run: sudo apt-get update && sudo apt-get install -y libgsl-dev
150
+
151
+ - name: Install dependencies
152
+ run: uv sync --group dev --group brian2
153
+
154
+ - name: Run tests
155
+ run: uv run tests/cli test --backend brian2
156
+ env:
157
+ LIVN_USE_LIBGSL: "1"
158
+
159
+ test-neuron-macos:
160
+ runs-on: macos-latest
161
+ needs: [lint, download-ei1]
162
+ steps:
163
+ - uses: actions/checkout@v6
164
+ - uses: astral-sh/setup-uv@v7
165
+ with:
166
+ enable-cache: true
167
+ - uses: actions/setup-python@v6
168
+ with:
169
+ python-version: ${{ env.PYTHON_VERSION }}
170
+
171
+ - name: Restore EI1 system
172
+ uses: actions/cache/restore@v5
173
+ with:
174
+ path: systems/graphs/EI1
175
+ key: ei1-system-v1
176
+ fail-on-cache-miss: true
177
+
178
+ - name: Install system dependencies
179
+ run: brew install hdf5-mpi
180
+
181
+ - name: Install Python dependencies
182
+ uses: ./.github/actions/install-neuron
183
+
184
+ - name: Run tests
185
+ run: uv run tests/cli test --backend neuron --oversubscribe
@@ -0,0 +1,51 @@
1
+ name: Deploy Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: pages
15
+ cancel-in-progress: false
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Setup Bun
27
+ uses: oven-sh/setup-bun@v2
28
+
29
+ - name: Install dependencies
30
+ run: bun install
31
+ working-directory: docs
32
+
33
+ - name: Build with VitePress
34
+ run: bun run build
35
+ working-directory: docs
36
+
37
+ - name: Upload artifact
38
+ uses: actions/upload-pages-artifact@v3
39
+ with:
40
+ path: docs/.vitepress/dist
41
+
42
+ deploy:
43
+ environment:
44
+ name: github-pages
45
+ url: ${{ steps.deployment.outputs.page_url }}
46
+ needs: build
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ env:
8
+ UV_CACHE_DIR: /tmp/.uv-cache
9
+ PYTHON_VERSION: "3.12"
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ environment: pypi
15
+ permissions:
16
+ id-token: write
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: astral-sh/setup-uv@v6
20
+ with:
21
+ enable-cache: true
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ env.PYTHON_VERSION }}
25
+ - name: Build package
26
+ run: uv build
27
+ - name: Publish to PyPI
28
+ run: uv publish
livn-1.0.0/.gitignore ADDED
@@ -0,0 +1,147 @@
1
+ compiled/
2
+ storage/
3
+ raw.githubusercontent.com/
4
+ tests/tmp
5
+
6
+ *.png
7
+ *.h5
8
+ *.p
9
+ *.pkl
10
+
11
+ systems/datasets
12
+ systems/interface/remotes
13
+ benchmarks/interface/remotes
14
+
15
+ .ruff_cache
16
+
17
+ # Byte-compiled / optimized / DLL files
18
+ __pycache__/
19
+ *.py[cod]
20
+ *$py.class
21
+ .DS_Store
22
+
23
+ # C extensions
24
+ *.so
25
+
26
+ visualization/node_modules
27
+
28
+ # Distribution / packaging
29
+ .Python
30
+ build/
31
+ develop-eggs/
32
+ dist/
33
+ downloads/
34
+ eggs/
35
+ .eggs/
36
+ lib/
37
+ lib64/
38
+ parts/
39
+ sdist/
40
+ var/
41
+ wheels/
42
+ pip-wheel-metadata/
43
+ share/python-wheels/
44
+ *.egg-info/
45
+ .installed.cfg
46
+ *.egg
47
+ MANIFEST
48
+
49
+ # PyInstaller
50
+ # Usually these files are written by a python script from a template
51
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
52
+ *.manifest
53
+ *.spec
54
+
55
+ # Installer logs
56
+ pip-log.txt
57
+ pip-delete-this-directory.txt
58
+
59
+ # Unit test / coverage reports
60
+ htmlcov/
61
+ .tox/
62
+ .nox/
63
+ .coverage
64
+ .coverage.*
65
+ .cache
66
+ nosetests.xml
67
+ coverage.xml
68
+ *.cover
69
+ *.py,cover
70
+ .hypothesis/
71
+ .pytest_cache/
72
+
73
+ # Translations
74
+ *.mo
75
+ *.pot
76
+
77
+ # Django stuff:
78
+ *.log
79
+ local_settings.py
80
+ db.sqlite3
81
+ db.sqlite3-journal
82
+
83
+ # Flask stuff:
84
+ instance/
85
+ .webassets-cache
86
+
87
+ # Scrapy stuff:
88
+ .scrapy
89
+
90
+ # Sphinx documentation
91
+ docs/_build/
92
+
93
+ # PyBuilder
94
+ target/
95
+
96
+ # Jupyter Notebook
97
+ .ipynb_checkpoints
98
+
99
+ # IPython
100
+ profile_default/
101
+ ipython_config.py
102
+
103
+ # vim/linux
104
+ *.swp
105
+
106
+ # pipenv
107
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
108
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
109
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
110
+ # install all needed dependencies.
111
+ #Pipfile.lock
112
+
113
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
114
+ __pypackages__/
115
+
116
+ # Celery stuff
117
+ celerybeat-schedule
118
+ celerybeat.pid
119
+
120
+ # SageMath parsed files
121
+ *.sage.py
122
+
123
+ # Environments
124
+ .env
125
+ .venv
126
+ venv/
127
+ env.bak/
128
+ venv.bak/
129
+ *~
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
@@ -0,0 +1 @@
1
+ 3.12
livn-1.0.0/LICENSE.txt ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Frithjof Gressmann <fg14@illinois.edu>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
livn-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: livn
3
+ Version: 1.0.0
4
+ Summary: A testbed for learning to interact with in vitro neural networks
5
+ Author-email: Frithjof Gressmann <fg14@illinois.edu>, Ivan Raikov <ivan.g.raikov@gmail.com>
6
+ License-File: LICENSE.txt
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: gymnasium>=1.2.0
9
+ Requires-Dist: pandas>=2.3.1
10
+ Requires-Dist: pydantic>=2.11.3
11
+ Requires-Dist: pyfive>=1.1.1
12
+ Requires-Dist: scipy>=1.14.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ # livn
16
+
17
+ **A testbed for learning to interact with in vitro neural networks**
18
+
19
+ [![Documentation](https://img.shields.io/badge/docs-livn--org.github.io-blue)](https://livn-org.github.io/livn/)
20
+ [![Paper](https://img.shields.io/badge/paper-bioRxiv-green)](https://www.biorxiv.org/content/early/2025/12/19/2025.12.16.694706)
21
+
22
+ livn is an open-source interactive simulation environment for learning to control in vitro neural networks. It generates synthetic neural data with ground truth at scale, enabling the development and testing of ML models in interactive settings that mimic experimental platforms such as multi-electrode arrays. By providing an extensible platform for developing and benchmarking machine learning models, livn aims to accelerate progress in both ML-driven understanding and engineering of in vitro neural systems and fundamental understanding of computation in biological neural networks.
23
+
24
+ ```sh
25
+ pip install livn
26
+ ```
27
+
28
+ **[Read the full documentation →](https://livn-org.github.io/livn/)**
29
+
30
+ ## Features
31
+
32
+ - **Multiple backends** — Run simulations using Brian2, NEURON, or JAX (diffrax) depending on your needs
33
+ - **Multi-electrode arrays** — Observe neural activity through realistic MEA configurations with stimulation and recording
34
+ - **Differentiable** — Differentiate through the full simulation environment (including IO) when using the JAX backend
35
+ - **RL integration** — Standard [Gymnasium](https://gymnasium.farama.org/) interface for reinforcement learning experiments
36
+ - **Curated datasets** — Access pre-generated datasets on [Hugging Face](https://huggingface.co/datasets/livn-org) for training and evaluation
37
+ - **Parallel execution** — Scale up with MPI-based parallel simulations for large-scale experiments on CPU and GPU
38
+
39
+ ## Quickstart
40
+
41
+ ### Running a simulation
42
+
43
+ ```python
44
+ from livn import make
45
+
46
+ env = make("EI1")
47
+
48
+ env.apply_model_defaults()
49
+ env.record_spikes()
50
+ env.record_voltage()
51
+
52
+ it, t, iv, v, *_ = env.run(100)
53
+
54
+ print("Initial voltages: ", v[:, 0])
55
+ ```
56
+
57
+ ### Backends
58
+
59
+ livn supports three simulation backends:
60
+
61
+ ```sh
62
+ export LIVN_BACKEND=brian2 # default; point-neuron models
63
+ export LIVN_BACKEND=diffrax # JAX-based, differentiable
64
+ export LIVN_BACKEND=neuron # MPI-parallel, multi-compartment
65
+ ```
66
+
67
+ See the [documentation](https://livn-org.github.io/livn/guide/backends) for details.
68
+
69
+ ## Predefined systems
70
+
71
+ | System | Neurons | EXC | INH | MEA channels | Description |
72
+ |--------|---------|-----|-----|-------------|-------------|
73
+ | **EI1** | 10 | 8 | 2 | 1 | Quick prototyping, unit tests |
74
+ | **EI2** | 100 | 80 | 20 | 16 | Development, RL experiments |
75
+ | **EI3** | 1,000 | 800 | 200 | 64 | Medium-scale experiments |
76
+ | **EI4** | 10,000 | 8,000 | 2,000 | 1,024 | Large-scale experiments |
77
+
78
+ ## Documentation
79
+
80
+ Full documentation at **[livn-org.github.io/livn](https://livn-org.github.io/livn/)** covering:
81
+
82
+ - [Getting started](https://livn-org.github.io/livn/guide/getting-started) — installation, first simulation, using datasets
83
+ - [Concepts](https://livn-org.github.io/livn/guide/concepts/env) — environments, systems, models, IO, encoding, decoding, stimulus
84
+ - [Systems](https://livn-org.github.io/livn/guide/systems/) — generating, tuning, and sampling custom systems
85
+ - [Examples](https://livn-org.github.io/livn/examples/dataset) — dataset usage, differentiable simulation, reinforcement learning
86
+
87
+ ### Full installation
88
+
89
+ Clone this repo and install with [uv](https://docs.astral.sh/uv/):
90
+
91
+ ```sh
92
+ uv sync --all-packages --all-groups --all-extras
93
+ ```
94
+
95
+ ## Citation
96
+
97
+ If you use livn in your research, please cite:
98
+
99
+ ```bibtex
100
+ @article{GressmannLIVN2025,
101
+ author = {Gressmann, Frithjof and Raikov, Ivan Georgiev and Pham, Hau Ngoc and Coats, Evan and Soltesz, Ivan and Rauchwerger, Lawrence},
102
+ title = {livn: A testbed for learning to interact with in vitro neural networks},
103
+ elocation-id = {2025.12.16.694706},
104
+ year = {2025},
105
+ doi = {10.64898/2025.12.16.694706},
106
+ publisher = {Cold Spring Harbor Laboratory},
107
+ URL = {https://www.biorxiv.org/content/early/2025/12/19/2025.12.16.694706},
108
+ eprint = {https://www.biorxiv.org/content/early/2025/12/19/2025.12.16.694706.full.pdf},
109
+ journal = {bioRxiv}
110
+ }
111
+ ```
112
+
113
+ ## License
114
+
115
+ MIT, see [LICENSE.txt](LICENSE.txt).