diff --git a/.gitignore b/.gitignore index 54737b1..e447fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,6 @@ __pycache__ /src/worm2d/neuromlLocal/testc302SigSim/*.dat /src/worm2d/neuromlLocal/testc302SigSim/testc302NervousSystem /src/worm2d/neuromlLocal/testc302SigSim/report.txt +/synchere.sh +/wheelhouse +/tests/test_files/test_py_cpp diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..51fae3d --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,185 @@ +# Neuromechanical model of forward and backward locomotion in _C. elegans_ + +A listing of the various publications and code releases related to this model of C. elegans forward and backward locomotion by Dr. Eduardo J. Izquiredo, Dr. Erick Olivares and Prof. Randall Beer. + +## 2007 + +### An integrated neuro-mechanical model of C. elegans forward locomotion. + +**Boyle, J. H., Bryden, J., & Cohen, N.** + +Technical description of a neuro-mechanical model integrating known neural connectivity, muscle dynamics, and body mechanics to generate forward undulatory locomotion; groundwork for later expanded models of gait modulation. + +
Abstract +One of the most tractable organisms for the study of nervous systems is the nematode Caenorhabditis elegans, whose locomotion in particular has been the subject of a number of models. In this paper we present a first integrated neuro-mechanical model of forward locomotion. We find that a previous neural model is robust to the addition of a body with mechanical properties, and that the integrated model produces oscillations with a more realistic frequency and waveform than the neural model alone. We conclude that the body and environment are likely to be important components of the worm’s locomotion subsystem. +
+ +## 2008 + +### Systems-level circuit model of C. elegans undulatory locomotion.* + +**Karbowski, J., Schindelman, G., Cronin, C. J., Seah, A., & Sternberg, P. W.** + +Presents a systems-level circuit model combining neural dynamics, muscle physiology, and biomechanics; used to compare mutant locomotion data and explore how network properties influence forward/backward undulations and direction switching. + +
Abstract +To establish the relationship between locomotory behavior and dynamics of neural circuits in the nematode C. elegans we combined molecular and theoretical approaches. In particular, we quantitatively analyzed the motion of C. elegans with defective synaptic GABA and acetylcholine transmission, defective muscle calcium signaling, and defective muscles and cuticle structures, and compared the data with our systems level circuit model. The major experimental findings are: (1) anterior-to-posterior gradients of body bending flex for almost all strains both for forward and backward motion, and for neuronal mutants, also analogous weak gradients of undulatory frequency, (2) existence of some form of neuromuscular (stretch receptor) feedback, (3) invariance of neuromuscular wavelength, (4) biphasic dependence of frequency on synaptic signaling, and (5) decrease of frequency with increase of the muscle time constant. Based on (1) we hypothesize that the Central Pattern Generator (CPG) is located in the head both for forward and backward motion. Points (1) and (2) are the starting assumptions for our theoretical model, whose dynamical patterns are qualitatively insensitive to the details of the CPG design if stretch receptor feedback is sufficiently strong and slow. The model reveals that stretch receptor coupling in the body wall is critical for generation of the neuromuscular wave. Our model agrees with our behavioral data (3), (4), and (5), and with other pertinent published data, e.g., that frequency is an increasing function of muscle gap-junction coupling. +
+ + +## 2012 + +### Gait modulation in C. elegans: an integrated neuromechanical model + +**Boyle, J. H., Berri, S., & Cohen, N.** + +Presents an integrated neuromechanical model that couples a proprioceptive neuromuscular controller with a physical body–environment model. The model reproduces the swim–crawl transition and a continuum of intermediate gaits purely through interaction with the environment (no separate modulatory switch), and makes testable predictions about motor neuron roles and dorsal–ventral symmetry breaking. + +
Abstract +Equipped with its 302-cell nervous system, the nematode Caenorhabditis elegans adapts its locomotion in different environments, exhibiting so-called swimming in liquids and crawling on dense gels. Recent experiments have demonstrated that the worm displays the full range of intermediate behaviors when placed in intermediate environments. The continuous nature of this transition strongly suggests that these behaviors all stem from modulation of a single underlying mechanism. We present a model of C. elegans forward locomotion that includes a neuromuscular control system that relies on a sensory feedback mechanism to generate undulations and is integrated with a physical model of the body and environment. We find that the model reproduces the entire swim-crawl transition, as well as locomotion in complex and heterogeneous environments. This is achieved with no modulatory mechanism, except via the proprioceptive response to the physical environment. Manipulations of the model are used to dissect the proposed pattern generation mechanism and its modulation. The model suggests a possible role for GABAergic D-class neurons in forward locomotion and makes a number of experimental predictions, in particular with respect to non-linearities in the model and to symmetry breaking between the neuromuscular systems on the ventral and dorsal sides of the body. +
+ +## 2013 + +### Connecting a Connectome to Behavior: An Ensemble of Neuroanatomical Models of C. elegans Klinotaxis + +**Eduardo J. Izquierdo, Randall D. Beer** + +https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1002890 + +[SSID](https://www.semanticscholar.org/paper/Connecting-a-Connectome-to-Behavior%3A-An-Ensemble-of-Izquierdo-Beer/658a9534388597f425a898e29e31a11f0d315311) + +This paper develops a neuroanatomically-grounded model of salt klinotaxis, a form of chemotaxis in which changes in orientation are directed towards the source through gradual continual adjustments. + +
Abstract +Increased efforts in the assembly and analysis of connectome data are providing new insights into the principles underlying the connectivity of neural circuits. However, despite these considerable advances in connectomics, neuroanatomical data must be integrated with neurophysiological and behavioral data in order to obtain a complete picture of neural function. Due to its nearly complete wiring diagram and large behavioral repertoire, the nematode worm Caenorhaditis elegans is an ideal organism in which to explore in detail this link between neural connectivity and behavior. In this paper, we develop a neuroanatomically-grounded model of salt klinotaxis, a form of chemotaxis in which changes in orientation are directed towards the source through gradual continual adjustments. We identify a minimal klinotaxis circuit by systematically searching the C. elegans connectome for pathways linking chemosensory neurons to neck motor neurons, and prune the resulting network based on both experimental considerations and several simplifying assumptions. We then use an evolutionary algorithm to find possible values for the unknown electrophsyiological parameters in the network such that the behavioral performance of the entire model is optimized to match that of the animal. Multiple runs of the evolutionary algorithm produce an ensemble of such models. We analyze in some detail the mechanisms by which one of the best evolved circuits operates and characterize the similarities and differences between this mechanism and other solutions in the ensemble. Finally, we propose a series of experiments to determine which of these alternatives the worm may be using. +
+ +## 2014 + +### Neurobiology of Caenorhabditis elegans locomotion: where do we stand?. + +**Gjorgjieva, J., Biron, D., & Haspel, G.** + + +A systems-level review that summarizes modelling approaches (CPG vs proprioception, neuromechanics) and links experiments to theory — useful to situate modelling papers. + +
Abstract +Animals use a nervous system for locomotion in some stage of their life cycle. The nematode Caenorhabditis elegans, a major animal model for almost all fields of experimental biology, has long been used for detailed studies of genetic and physiological locomotion mechanisms. Of its 959 somatic cells, 302 are neurons that are identifiable by lineage, location, morphology, and neurochemistry in every adult hermaphrodite. Of those, 75 motoneurons innervate body wall muscles that provide the thrust during locomotion. In this Overview, we concentrate on the generation of either forward- or backward-directed motion during crawling and swimming. We describe locomotion behavior, the parts constituting the locomotion system, and the relevant neuronal connectivity. Because it is not yet fully understood how these components combine to generate locomotion, we discuss competing hypotheses and models. +
+ +## 2015 + +### Changes in postural syntax characterize sensory modulation and natural variation of C. elegans locomotion. + +**Schwarz, R. F., Branicky, R., Grundy, L. J., Schafer, W. R., & Brown, A. E.** + +Introduces a discrete posture-sequence representation and computational/statistical analyses to quantify how sensory input modulates transition probabilities between postures (including forward↔reverse transitions), offering a behavioral-level model useful for linking stimuli to reversal statistics. + +
Abstract +Locomotion is driven by shape changes coordinated by the nervous system through time; thus, enumerating an animal's complete repertoire of shape transitions would provide a basis for a comprehensive understanding of locomotor behaviour. Here we introduce a discrete representation of behaviour in the nematode C. elegans. At each point in time, the worm’s posture is approximated by its closest matching template from a set of 90 postures and locomotion is represented as sequences of postures. The frequency distribution of postural sequences is heavy-tailed with a core of frequent behaviours and a much larger set of rarely used behaviours. Responses to optogenetic and environmental stimuli can be quantified as changes in postural syntax: worms show different preferences for different sequences of postures drawn from the same set of templates. A discrete representation of behaviour will enable the use of methods developed for other kinds of discrete data in bioinformatics and language processing to be harnessed for the study of behaviour. +
+ + + + +## 2016 + +### Propagation of rhythmic dorsoventral wave in a neuromechanical model of locomotion in Caernohabditis elegans + +**Eduardo J. Izquierdo, Randall D. Beer** + + +https://direct.mit.edu/isal/proceedings/alif2016/28/544/99414 + +
Abstract +With 302 neurons and a fully reconstructed connectome, Caernohabditis elegans is an ideal candidate organism to study how behavior is grounded in the interaction between an organism's brain, its body, and its environment. Since nearly its entire behavioral repertoire is expressed through movement, understanding the neuromechanical basis of locomotion is especially critical as a foundation upon which analyses of all other behaviors must build. In this extended abstract, we report on the evolution and analysis of an integrated neuromechanical model of forward locomotion. +
+ + + + +## 2018 + +### From head to tail: a neuromechanical model of forward locomotion in Caenorhabditis elegans + +**Eduardo J. Izquierdo, Randall D. Beer** + +Describes a neuromechanical model that integrates ventral-cord neuroanatomy, neuron dynamics, and body mechanics to study how rhythmic bending is generated and propagated. The work analyzes whether proprioceptive coupling or central pattern generation better explain propagation, and explores mechanisms producing robust forward waves. + +https://royalsocietypublishing.org/doi/full/10.1098/rstb.2017.0374 + + +
Abstract +With 302 neurons and a near-complete reconstruction of the neural and muscle anatomy at the cellular level, Caenorhabditis elegans is an ideal candidate organism to study the neuromechanical basis of behaviour. Yet despite the breadth of knowledge about the neurobiology, anatomy and physics of C. elegans, there are still a number of unanswered questions about one of its most basic and fundamental behaviours: forward locomotion. How the rhythmic pattern is generated and propagated along the body is not yet well understood. We report on the development and analysis of a model of forward locomotion that integrates the neuroanatomy, neurophysiology and body mechanics of the worm. Our model is motivated by experimental analysis of the structure of the ventral cord circuitry and the effect of local body curvature on nearby motoneurons. We developed a neuroanatomically grounded model of the head motoneuron circuit and the ventral nerve cord circuit. We integrated the neural model with an existing biomechanical model of the worm's body, with updated musculature and stretch receptors. Unknown parameters were evolved using an evolutionary algorithm to match the speed of the worm on agar. We performed 100 evolutionary runs and consistently found electrophysiological configurations that reproduced realistic control of forward movement. The ensemble of successful solutions reproduced key experimental observations that they were not designed to fit, including the wavelength and frequency of the propagating wave. Analysis of the ensemble revealed that head motoneurons SMD and RMD are sufficient to drive dorsoventral undulations in the head and neck and that short-range posteriorly directed proprioceptive feedback is sufficient to propagate the wave along the rest of the body. +
+ +## 2018 + +### Potential role of a ventral nerve cord central pattern generator in forward and backward locomotion in Caenorhabditis elegans + +**Erick Olivares, Eduardo J. Izquierdo, Randall D. Beer** + +https://direct.mit.edu/netn/article/2/3/323/5431 + +A computational model grounded in the available neuroanatomy and neurophysiology to explore the space of possible configurations of the circuit that matched the neural traces observed during forward and backward locomotion in the worm. + + +
Abstract +C. elegans locomotes in an undulatory fashion, generating thrust by propagating dorsoventral bends along its body. Although central pattern generators (CPGs) are typically involved in animal locomotion, their presence in C. elegans has been questioned, mainly because there has been no evident circuit that supports intrinsic network oscillations. With a fully reconstructed connectome, the question of whether it is possible to have a CPG in the ventral nerve cord (VNC) of C. elegans can be answered through computational models. We modeled a repeating neural unit based on segmentation analysis of the connectome. We then used an evolutionary algorithm to determine the unknown physiological parameters of each neuron so as to match the features of the neural traces of the worm during forward and backward locomotion. We performed 1,000 evolutionary runs and consistently found configurations of the neural circuit that produced oscillations matching the main characteristic observed in experimental recordings. In addition to providing an existence proof for the possibility of a CPG in the VNC, we suggest a series of testable hypotheses about its operation. More generally, we show the feasibility and fruitfulness of a methodology to study behavior based on a connectome, in the absence of complete neurophysiological details. +
+ +## 2018 + +### Signatures of proprioceptive control in Caenorhabditis locomotion. + +**Denham, J. E., Ranner, T., & Cohen, N.** + + +Computational neuromechanics study highlighting how proprioceptive feedback shapes undulatory locomotion, suppresses neuromechanical phase lags, and affects gait properties; contrasts feed-forward CPG signatures with proprioceptive control predictions. + +
Abstract +Animal neuromechanics describes the coordinated self-propelled movement of a body, subject to the combined effects of internal neural control and mechanical forces. Here we use a computational model to identify effects of neural and mechanical modulation on undulatory forward locomotion of Caenorhabditis elegans, with a focus on proprioceptively driven neural control. We reveal a fundamental relationship between body elasticity and environmental drag in determining the dynamics of the body and demonstrate the manifestation of this relationship in the context of proprioceptively driven control. By considering characteristics unique to proprioceptive neurons, we predict the signatures of internal gait modulation that contrast with the known signatures of externally or biomechanically modulated gait. We further show that proprioceptive feedback can suppress neuromechanical phase lags during undulatory locomotion, contrasting with well studied advancing phase lags that have long been a signature of centrally generated, feed-forward control. +
+ +## 2018 + +### Excitatory motor neurons are local oscillators for backward locomotion. + +**Gao, S., Guan, S. A., Fouad, A. D., Meng, J., Kawano, T., Huang, Y. C., ... & Zhen, M.** + +Combined experiments and modeling show that A-class excitatory motor neurons possess intrinsic oscillatory properties sufficient to drive backward locomotion locally; premotor interneurons modulate this activity, suggesting distributed/local rhythm generation for reversals. + +
Abstract +Animal neuromechanics describes the coordin +Cell- or network-driven oscillators underlie motor rhythmicity. The identity of C. elegans oscillators remains unknown. Through cell ablation, electrophysiology, and calcium imaging, we show: (1) forward and backward locomotion is driven by different oscillators; (2) the cholinergic and excitatory A-class motor neurons exhibit intrinsic and oscillatory activity that is sufficient to drive backward locomotion in the absence of premotor interneurons; (3) the UNC-2 P/Q/N high-voltage-activated calcium current underlies A motor neuron’s oscillation; (4) descending premotor interneurons AVA, via an evolutionarily conserved, mixed gap junction and chemical synapse configuration, exert state-dependent inhibition and potentiation of A motor neuron’s intrinsic activity to regulate backward locomotion. Thus, motor neurons themselves derive rhythms, which are dually regulated by the descending interneurons to control the reversal motor state. These and previous findings exemplify compression: essential circuit properties are conserved but executed by fewer numbers and layers of neurons in a small locomotor network. +
+ + +## 2021 + +### A Neuromechanical Model of Multiple Network Rhythmic Pattern Generators for Forward Locomotion in C. elegans + +**Erick Olivares, Eduardo J. Izquierdo, Randall D. Beer** + +https://www.frontiersin.org/journals/computational-neuroscience/articles/10.3389/fncom.2021.572339/full + + +
Abstract +Multiple mechanisms contribute to the generation, propagation, and coordination of the rhythmic patterns necessary for locomotion in Caenorhabditis elegans. Current experiments have focused on two possibilities: pacemaker neurons and stretch-receptor feedback. Here, we focus on whether it is possible that a chain of multiple network rhythmic pattern generators in the ventral nerve cord also contribute to locomotion. We use a simulation model to search for parameters of the anatomically constrained ventral nerve cord circuit that, when embodied and situated, can drive forward locomotion on agar, in the absence of pacemaker neurons or stretch-receptor feedback. Systematic exploration of the space of possible solutions reveals that there are multiple configurations that result in locomotion that is consistent with certain aspects of the kinematics of worm locomotion on agar. Analysis of the best solutions reveals that gap junctions between different classes of motorneurons in the ventral nerve cord can play key roles in coordinating the multiple rhythmic pattern generators. +
+ +## 2025 + +### Optimization of connectome weights for a neural network model generating both forward and backward locomotion in C. elegans. + +**Chung, T., & Kim, S.** + +Recent work using connectome-based networks and optimization to find weights that produce both forward and backward gait patterns. + +
Abstract +Previous studies tracking the relationship between manipulations of C. elegans neurons and the resulting behavioral changes have called for the development of a connectome-constrained neural network model that describes the cascade from neurons to behavior. However, the model using anatomical connectome weights as they are did not achieve that. Here, we introduce a concept of learning the synaptic weights in our connectome-constrained neural network model based on the leaky-integrator equation while preserving the structural proportions of anatomical synapses. In this process, the weights of gap junctions and chemical synapses in C. elegans neurons are optimized. As a result, our neural network model generates plausible C. elegans behavior mediated by activity changes in forward and backward command neurons, even without the introduction of pacemaker neurons with intrinsic oscillatory activity. Additionally, we identified necessary or sufficient neurons for maintaining oscillatory patterns on muscular activity that could serve as clues for the central pattern generator in our neural network model. Finally, we provide 10 optimized synaptic weights sets of C. elegans that reproduce the results of manipulation experiments on the SMD neurons. This study will facilitate the future study for unraveling the multiscale relationship of “from synapse to behavior” in nervous system. +
+ + + diff --git a/README.md b/README.md index 4be9b5a..2362b7f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,54 @@ # Worm2D -Simulator of 2D worm body models -Work in progress. Latest verison of this code can be found here: https://github.com/openworm/CE_locomotion/tree/test_stable +Worm2D is a neuromechanical simulator of *C. elegans* locomotion. This is an initiative of the [OpenWorm project](https://www.openworm.org). It is based on earlier work on development of 2D worm neuromechanical models of Netta Cohen and team, as well as Dr. Eduardo J. Izquiredo, Dr. Erick Olivares and Prof. Randall Beer (See [HISTORY.md](HISTORY.md)). + +Worm2D is a hybrid C++/Python package: C++ binaries implement the physics, nervous system, and evolutionary search, while Python handles configuration, binary dispatch, and post-run analysis/plotting. + + +## Build & Install + +The package uses [scikit-build-core](https://scikit-build-core.readthedocs.io/) with CMake. nlohmann-json is bundled as a header at `src/cpp/nlohmann/json.hpp` — no system package needed. + +Install in editable mode (builds C++ and installs Python package): + +```bash +pip install -e .[all] +``` + +The `[all]` extra pulls in `[neuroml]` (pyNeuroML, NEURON<9.0) and `[dev]` (ruff, pytest, ipywidgets, OSBModelValidation, modelspec). + +## Running Tests + +Quick test (runs after `pip install -e .`): + +```bash +python tests/test.py # runs a single optimisation run & saves output to exampleRun folder, see below +``` + +![Example](exampleRun/ExampleActivity.png) + + +Full test suite (cleans prior run folders, then runs all model variants and OMV tests): + +```bash +./test_all.sh # full +./test_all.sh -q # quick (skips OMV and most model-specific tests) +``` + +Individual test scripts in `tests/` and `src/worm2d/` follow the naming pattern `test.py`. Run any directly: + +```bash +cd tests +python testW2DCE.py +``` + + +## CLI + +After install, the `worm2d` command is available: + +```bash +worm2d -f [-E] [-O ] [-T ] [...] +``` + +Key flags: `-E` / `--doEvol` runs the evolutionary search; `-f` specifies the output folder (required); `-O` sets the model name when using the `Worm2D` binary family. diff --git a/exampleRun/ExampleActivity.png b/exampleRun/ExampleActivity.png new file mode 100644 index 0000000..f286b49 Binary files /dev/null and b/exampleRun/ExampleActivity.png differ diff --git a/exampleRunW2DCE/ExampleActivity.png b/exampleRunW2DCE/ExampleActivity.png new file mode 100644 index 0000000..ccb0c5d Binary files /dev/null and b/exampleRunW2DCE/ExampleActivity.png differ diff --git a/test_all.sh b/test_all.sh index 6c3d400..a463a4b 100755 --- a/test_all.sh +++ b/test_all.sh @@ -72,5 +72,10 @@ if [ "$quick_test" == 0 ]; then omv test -V .test.example.omt #Izq original test.example.mep + omv test -V .test.W2DCEa.omt #main_osc.cpp test.example.mep + omv test -V .test.W2DCEanm.omt #main_osc.cpp test.W2DCEanm.mep, as W2DCEa but origMusc=False + omv test -V .test.W2DCEanm2.omt ${OMV_ARGS} + omv test -V .test.W2DCE.omt + omv test -V .test.W2DCEs.omt fi diff --git a/testruns/exW2DCEa/ExampleActivity.png b/testruns/exW2DCEa/ExampleActivity.png new file mode 100644 index 0000000..f9ca155 Binary files /dev/null and b/testruns/exW2DCEa/ExampleActivity.png differ diff --git a/testruns/exW2DCEanm/ExampleActivity.png b/testruns/exW2DCEanm/ExampleActivity.png new file mode 100644 index 0000000..5374d20 Binary files /dev/null and b/testruns/exW2DCEanm/ExampleActivity.png differ diff --git a/testruns/exW2DCEanm2/ExampleActivity.png b/testruns/exW2DCEanm2/ExampleActivity.png new file mode 100644 index 0000000..fb53254 Binary files /dev/null and b/testruns/exW2DCEanm2/ExampleActivity.png differ diff --git a/testruns/exW2DCEanm2_1/ExampleActivity.png b/testruns/exW2DCEanm2_1/ExampleActivity.png new file mode 100644 index 0000000..f639371 Binary files /dev/null and b/testruns/exW2DCEanm2_1/ExampleActivity.png differ diff --git a/testruns/exW2DCEs/ExampleActivity.png b/testruns/exW2DCEs/ExampleActivity.png new file mode 100644 index 0000000..1c62106 Binary files /dev/null and b/testruns/exW2DCEs/ExampleActivity.png differ diff --git a/tests/.test.W2DCE.mep b/tests/.test.W2DCE.mep new file mode 100644 index 0000000..7904dea --- /dev/null +++ b/tests/.test.W2DCE.mep @@ -0,0 +1,12 @@ +system: Testing activity of some neurons + +experiments: + Test: + expected: + spike times: [0.405, 8.555] + Test2: + expected: + spike times: [0.405, 8.655] + Test3: + expected: + spike times: [0.455, 8.655] \ No newline at end of file diff --git a/tests/.test.W2DCE.omt b/tests/.test.W2DCE.omt new file mode 100644 index 0000000..1434e10 --- /dev/null +++ b/tests/.test.W2DCE.omt @@ -0,0 +1,18 @@ +# Framework for running automated tests on Open Source Brain +# See https://github.com/OpenSourceBrain/osb-model-validation for more details + +target: testW2DCE.py +engine: Brian2 # This installs Brian2, but all we really need is a Python environment to run the script in +mep: .test.W2DCE.mep +experiments: + Test: + observables: + spike times: + file: + path: ../exampleRunW2DCE/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 diff --git a/tests/.test.W2DCEa.omt b/tests/.test.W2DCEa.omt new file mode 100644 index 0000000..ef63ccc --- /dev/null +++ b/tests/.test.W2DCEa.omt @@ -0,0 +1,18 @@ +# Framework for running automated tests on Open Source Brain +# See https://github.com/OpenSourceBrain/osb-model-validation for more details + +target: testW2DCEa.py +engine: Brian2 # This installs Brian2, but all we really need is a Python environment to run the script in +mep: .test.example.mep +experiments: + Test: + observables: + spike times: + file: + path: ../testruns/exW2DCEa/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 \ No newline at end of file diff --git a/tests/.test.W2DCEanm.mep b/tests/.test.W2DCEanm.mep new file mode 100644 index 0000000..ff3f9d2 --- /dev/null +++ b/tests/.test.W2DCEanm.mep @@ -0,0 +1,6 @@ +system: Testing activity of some neurons + +experiments: + Test: + expected: + spike times: [0.405, 5.955, 11.155, 16.155, 21.105, 26.105] \ No newline at end of file diff --git a/tests/.test.W2DCEanm.omt b/tests/.test.W2DCEanm.omt new file mode 100644 index 0000000..8d53e7f --- /dev/null +++ b/tests/.test.W2DCEanm.omt @@ -0,0 +1,18 @@ +# Framework for running automated tests on Open Source Brain +# See https://github.com/OpenSourceBrain/osb-model-validation for more details + +target: testW2DCEanm.py +engine: Brian2 # This installs Brian2, but all we really need is a Python environment to run the script in +mep: .test.W2DCEanm.mep +experiments: + Test: + observables: + spike times: + file: + path: ../testruns/exW2DCEanm/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 \ No newline at end of file diff --git a/tests/.test.W2DCEanm2.mep b/tests/.test.W2DCEanm2.mep new file mode 100644 index 0000000..8a46b5d --- /dev/null +++ b/tests/.test.W2DCEanm2.mep @@ -0,0 +1,9 @@ +system: Testing activity of some neurons + +experiments: + Test: + expected: + spike times: [8.21, 11.56, 14.96, 18.36, 21.76, 25.16, 28.61, 32.01] + Test2: + expected: + spike times: [9.06, 13.01, 16.96, 20.91, 24.86, 28.81] \ No newline at end of file diff --git a/tests/.test.W2DCEanm2.omt b/tests/.test.W2DCEanm2.omt new file mode 100644 index 0000000..2d669c2 --- /dev/null +++ b/tests/.test.W2DCEanm2.omt @@ -0,0 +1,29 @@ +# Framework for running automated tests on Open Source Brain +# See https://github.com/OpenSourceBrain/osb-model-validation for more details + +target: testW2DCEanm2.py +engine: Brian2 # This installs Brian2, but all we really need is a Python environment to run the script in +mep: .test.W2DCEanm2.mep +experiments: + Test: + observables: + spike times: + file: + path: ../testruns/exW2DCEanm2/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 + Test2: + observables: + spike times: + file: + path: ../testruns/exW2DCEanm2_1/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 \ No newline at end of file diff --git a/tests/.test.W2DCEs.mep b/tests/.test.W2DCEs.mep new file mode 100644 index 0000000..075e6cb --- /dev/null +++ b/tests/.test.W2DCEs.mep @@ -0,0 +1,6 @@ +system: Testing activity of some neurons + +experiments: + Test: + expected: + spike times: [0.555, 2.305] \ No newline at end of file diff --git a/tests/.test.W2DCEs.omt b/tests/.test.W2DCEs.omt new file mode 100644 index 0000000..c070876 --- /dev/null +++ b/tests/.test.W2DCEs.omt @@ -0,0 +1,18 @@ +# Framework for running automated tests on Open Source Brain +# See https://github.com/OpenSourceBrain/osb-model-validation for more details + +target: testW2DCEs.py +engine: Brian2 # This installs Brian2, but all we really need is a Python environment to run the script in +mep: .test.W2DCEs.mep +experiments: + Test: + observables: + spike times: + file: + path: ../testruns/exW2DCEs/act.dat + columns: [0,3] + scaling: [1, 1] + spike detection: + method: threshold + threshold: 2 + tolerance: 0 \ No newline at end of file diff --git a/tests/testW2DCE.py b/tests/testW2DCE.py new file mode 100644 index 0000000..0d349e7 --- /dev/null +++ b/tests/testW2DCE.py @@ -0,0 +1,27 @@ +from worm2d import run + +run( + simduration=20, + simtransient=0, + popSize=96, + RandSeed=1233, + maxGens=10, + modelName="W2DCE", + modelFolder="Worm2D", + # inputFolderName="exampleRunW2Dosc_t1", + outputFolderName="../exampleRunW2DCE", + # outputFolderName="exampleRunW2Dosc_t1_nml", + doEvol=True, + overwrite=True, + checkPointInterval=5, + reRand=True, + doPlotEvol=True, + doNML=False, + # doCPT=True, + evo_type="EvoCE", + AvgSpeed=0.0001, + # SRType = "SR_TRANS_STRETCH" + doTestRun=True, + doOrigMuscInput=True, + SRZeroGainsType=1, +) diff --git a/tests/testW2DCEa.py b/tests/testW2DCEa.py new file mode 100644 index 0000000..754d0b3 --- /dev/null +++ b/tests/testW2DCEa.py @@ -0,0 +1,23 @@ +from worm2d import run + +run( + simduration=30, + simtransient=0, + popSize=96, + RandSeed=1233, + modelName="W2DCE", + modelFolder="Worm2D", + outputFolderName="../testruns/exW2DCEa", + doEvol=True, + overwrite=True, + checkPointInterval=5, + doOrigMuscInput=True, + evo_type="EvoCE", + doTestRun=False, + SRZeroGainsType=1, + doReverse=0, + fitType=0, + AvgSpeed=0.0001, + inputInd=2, + debug=False, +) diff --git a/tests/testW2DCEanm.py b/tests/testW2DCEanm.py new file mode 100644 index 0000000..8a81dd0 --- /dev/null +++ b/tests/testW2DCEanm.py @@ -0,0 +1,23 @@ +from worm2d import run + +run( + simduration=30, + simtransient=0, + popSize=96, + RandSeed=1233, + modelName="W2DCE", + modelFolder="Worm2D", + outputFolderName="../testruns/exW2DCEanm", + doEvol=True, + overwrite=True, + checkPointInterval=5, + doOrigMuscInput=False, + evo_type="EvoCE", + doTestRun=False, + SRZeroGainsType=1, + doReverse=0, + fitType=0, + AvgSpeed=0.0001, + inputInd=2, + debug=False, +) diff --git a/tests/testW2DCEanm2.py b/tests/testW2DCEanm2.py new file mode 100644 index 0000000..2eba698 --- /dev/null +++ b/tests/testW2DCEanm2.py @@ -0,0 +1,48 @@ +from worm2d import run +from worm2d.helper_funcs import get_worm_json, write_worm_json, delete_directory + +outputFolderName = "../testruns/exW2DCEanm2" +outputFolderName_2 = "../testruns/exW2DCEanm2_1" +origFolderName = "../testruns/exW2DCEanm" + + +# x = 0.1 +delete_directory(outputFolderName_2) +delete_directory(outputFolderName) +json_data = get_worm_json(origFolderName) +# json_data['evolvable_ranges']['evotag_2']["active"] = False +write_worm_json(outputFolderName, json_data) + +args = dict( + modelFolder="Worm2D", # folder containing the compiled C++ binary code + modelName="W2DSR", # rerun using the generic json loaded model + maxGens=5, # number of generations to run + popSize=10, + doEvol=True, + # inputFolderName=origFolderName, # input folder + # outputFolderName=outputFolderName, # output folder + overwrite=True, # allow overwrite of output folder + # randInitState=True, #use fixed initial conditions from JSON file + # doTestRun=True, #run a single simple simulation + reRand=True, + RandSeed=900351, +) + +args["outputFolderName"] = outputFolderName +run(**args) + + +json_data = get_worm_json(origFolderName) +json_data["evolvable_ranges"]["ns_cells_bias_0"]["active"] = False +json_data["evolvable_ranges"]["ns_chemcons_1"]["active"] = False +json_data["evolvable_ranges"]["DA_0_1_tau"] = { + "active": True, + "lower_limit": 0.1, + "upper_limit": 2.5, + "name": "DA_tau", +} +json_data["nervous_system"]["cells"]["DA_0"]["tau"]["evotag"] = "DA_0_1_tau" +json_data["nervous_system"]["cells"]["DA_1"]["tau"]["evotag"] = "DA_0_1_tau" +write_worm_json(outputFolderName_2, json_data) +args["outputFolderName"] = outputFolderName_2 +run(**args) # diff --git a/tests/testW2DCEs.py b/tests/testW2DCEs.py new file mode 100644 index 0000000..62e801d --- /dev/null +++ b/tests/testW2DCEs.py @@ -0,0 +1,25 @@ +from worm2d import run + +run( + simduration=20, + simtransient=0, + popSize=96, + RandSeed=1233, + maxGens=5, + modelName="W2DCE", + modelFolder="Worm2D", + outputFolderName="../testruns/exW2DCEs", + doEvol=True, + overwrite=True, + checkPointInterval=5, + reRand=True, + doPlotEvol=True, + doNML=False, + # doCPT=True, + evo_type="EvoCE", + AvgSpeed=0.0001, + # SRType = "SR_TRANS_STRETCH" + doTestRun=True, + doOrigMuscInput=True, + SRZeroGainsType=1, +)