Skip to content

Commit f21f2e6

Browse files
committed
Add README
1 parent 788a35a commit f21f2e6

File tree

2 files changed

+98
-2
lines changed

2 files changed

+98
-2
lines changed

Aplysia Feeding Kinetic Model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,8 +2239,8 @@ void updateinputs (double time, double & freqI2, double & freqHinge, double & fr
22392239
behavior_list.push_back("IzhikevichRejectionB");
22402240
behavior_list.push_back("IzExampleSwallow");
22412241
behavior_list.push_back("IzSwallowBmoreaccurate");
2242-
behavior_list.push_back("NeuromechanicalInput");
22432242
behavior_list.push_back("Dynamic");
2243+
behavior_list.push_back("NeuromechanicalInput");
22442244
cerr << "Behavior Type Not Recognized. Provide one of the following as an argument:" << endl;
22452245
for (int i = 0; i < behavior_list.size(); i++) {
22462246
cerr << "\t" << behavior_list[i] << endl;

README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,97 @@
1-
# AplysiaFeedingKineticModel
1+
# *Aplysia* Feeding Kinetic Model
2+
3+
Code repository: https://github.com/CWRUChielLab/AplysiaFeedingKineticModel
4+
5+
This repository contains code for a detailed biomechanical model of the feeding
6+
apparatus of the sea slug *Aplysia californica*. See Snyder (2005) for a detailed
7+
"Guidebook to the Model" defining equations and parameters:
8+
9+
> Snyder, V. A. (2005). Analysis of the biomechanics and neural control of two kinetic models of the buccal mass of Aplysia [M.S. thesis, Case Western Reserve University]. http://search.proquest.com/docview/305390183/abstract/B303E6FBC4924763PQ/1
10+
11+
The model is instantiated in C++, and visualization scripts are written in
12+
Python.
13+
14+
## Usage
15+
16+
1. Navigate to the project directory:
17+
```
18+
cd AplysiaFeedingKineticModel
19+
```
20+
21+
2. The [`Makefile`](./Makefile) provides convenient recipes for compiling the
22+
code, batch-running the model, and validating results. To simply compile the
23+
source code, run the following:
24+
```
25+
make
26+
```
27+
Optionally, use `make debug` to compile the code with extra print commands for
28+
debugging. The `make clean` command can be used to clean up your working
29+
directory by removing compile artifacts and model outputs.
30+
31+
3. Run the model executable:
32+
```
33+
./model <behavior>
34+
```
35+
where `<behavior>` is one of several valid behavior types that can be
36+
simulated, such as `Bite`. For a full list of possible behavior types, run
37+
`./model` without arguments. Each type differs in the activation timing of
38+
muscles, resulting in different movements.
39+
40+
Available behavior types:
41+
* `Bite`: A bite behavior (failure to grasp food)
42+
* `SwallowA`: A type-A swallow (smaller amplitude)
43+
* `SwallowB`: A type-B swallow (larger amplitude with dorsal rotation of the held food)
44+
* `SwallowPerturbed`: A modified type-B swallow with a brief external force applied to the food
45+
* `RejectionA`: A type-A rejection (smaller amplitude)
46+
* `RejectionB`: A type-B rejection (larger amplitude with ventral rotation of the held object)
47+
* `IzhikevichBite`: Similar to `Bite`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
48+
* `IzhikevichSwallowA`: Similar to `SwallowA`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
49+
* `IzhikevichSwallowB`: Similar to `SwallowB`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
50+
* `IzhikevichSwallowPerturbed`: Similar to `SwallowPerturbed`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
51+
* `IzhikevichRejectionA`: Similar to `RejectionA`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
52+
* `IzhikevichRejectionB`: Similar to `RejectionB`, but with a layer of integrate-and-fire motor neurons driving the muscles at defined frequencies
53+
* `IzExampleSwallow`: A more advanced model of the neuronal inputs to the muscles, where many identified motor neurons are represented
54+
* `IzSwallowBmoreaccurate`: Similar to `IzExampleSwallow` (?)
55+
* `Dynamic`: A version that uses a user-customizable input file (CSV format) to specify the timing and magnitude of inputs to the muscles
56+
* `NeuromechanicalInput`: Similar to `Dynamic`, but expects a different set of inputs created by another model of the motor neurons with interneurons coordinating them (https://github.com/CWRUChielLab/AplysiaNet)
57+
58+
Integrate-and-fire neurons were implemented following Izhikevich (2003):
59+
60+
> Izhikevich, E. M. (2003). Simple model of spiking neurons. IEEE Transactions on Neural Networks, 14(6), 1569–1572. https://doi.org/10.1109/TNN.2003.820440
61+
62+
## Visualizing Results
63+
64+
When the model runs, it generates output files in CSV format containing
65+
periodic snapshots of the values of various quantities, including positions,
66+
angles, and levels of muscle activation. Python scripts can generate plots and
67+
animations from these output files:
68+
* `newanimation.py`: generates movies of the motions of the buccal mass, with time plots of the muscle inputs
69+
* `PlotVariablesSlugOutput.py`: generates time plots of the kinematic variables
70+
* `makerasterplot.py` and `PlotVariablesIzhikevich.py`: generate figures of the activity of the integrate-and-fire motor neurons, which are not included in all behavior types
71+
72+
The `make animations` and `make figures` commands can be used to batch-run the
73+
model on a subset of the behavior types, renaming and saving the resulting
74+
movies and figures to dedicated directories.
75+
76+
The Python scripts require a handful of packages that can be installed with
77+
`pip`:
78+
79+
pip install numpy pandas matplotlib tqdm
80+
81+
## Validation
82+
83+
The outputs of the model when run on a subset of the behavior types are saved
84+
in the [`Check`](./Check) directory. The `make check` command can be used to
85+
systematically compare your version's outputs to these "gold standards". This
86+
is useful for catching differences in implementation of libraries across
87+
platforms, or other discrepancies that might cause the model to run differently
88+
across systems. Deviations should be investigated as they may lead to bugs.
89+
90+
Of course, if the code is modified intentionally in such a way that the outputs
91+
change (e.g., a new column is added to the output files), the "gold standard"
92+
against which `make check` runs will need to be updated. The `make bless`
93+
command will systematically run the model on the subset of behavior types and
94+
copy the outputs to the [`Check`](./Check) directory. These changed outputs,
95+
once verified to be correct, should be committed to the repository so that
96+
results can be validated against them in the future (they will become the new
97+
"blessed" gold standard of what outputs the model _should_ produce).

0 commit comments

Comments
 (0)