[Mathematics 2023] A Connectome-Based Digital Twin Caenorhabditis elegans Capable of Intelligent Sensorimotor Behavior
https://doi.org/10.3390/math11112442
@article{chen2023connectome,
title={A Connectome-Based Digital Twin Caenorhabditis elegans Capable of Intelligent Sensorimotor Behavior},
author={Chen, Zhongyu and Yu, Yuguo and Xue, Xiangyang},
journal={Mathematics},
volume={11},
number={11},
pages={2442},
year={2023},
publisher={MDPI}
}
- python==3.8
- pytorch==1.8.0
- tensorboard
- install
gym-worm
and its dependencies
- install the project in editable mode from local project path
pip install -e .
computational_model
: chemotaxis with behaviors including forward, pirouette, weathervane and random walkforward
: forward sinusoidal movementtap
: tap-withdrawal composing of forward, backward and stochastic turning behaviors
concat
: concatenate torch.utils.data.TensorDatasetsubset.RandomSubset
: sample a random subsetsubset.FilterSubset
: sample a subset with higher chemotaxis indexsplit
: split a time sequencechemotaxis
: create a dataset of chemotaxis locomotionsimulation.SimulationSample
: generate one simulation samplesimulation.SimulationDataset
: do parallel simulations by multiprocessing and collect the samples
- DataParallel tutorial: https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html
- All manually defined parameters need to be registered, so that they can be transferred along with the module to any devices.
- torch.nn.ParameterDict can register dict of parameters, but it doesn't support DataParallel.
- In torch.nn.Module, register parameters one by one with
self.register_parameter(name, param)
, and accessparam
directly withself.name
. - save DataParallel models by:
torch.save(model.module.state_dict(), PATH)
- run simulation:
python sim.py
- generate simulation data:
python data.py
- preprocess data:
python ncp_data.py
- train and test network:
python ncp.py
- online test the trained network:
python ncp_online.py
- check TensorBoard log:
tensorboard --logdir=runs --host=10.176.50.34 --port=6006
- local:
tensorboard --logdir=runs
- shut down after
python train.py; shutdown
- shut down if the result is successful
python train.py && shutdown
- count files:
ls -l | grep "^-" | wc -l