Skip to content

Commit a47399b

Browse files
authored
Merge pull request #278 from openworm/development
Merge for 0.8
2 parents ea2a628 + eaa93a9 commit a47399b

File tree

8 files changed

+117
-41
lines changed

8 files changed

+117
-41
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
output/C2*
3+

Dockerfile

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ WORKDIR $HOME
7777

7878
RUN mkdir neuron && \
7979
cd neuron && \
80-
git clone https://github.com/lungd/iv.git && \
81-
git clone https://github.com/lungd/nrn.git && \
80+
git clone https://github.com/nrnhines/iv.git && \
81+
git clone https://github.com/nrnhines/nrn.git && \
8282
cd iv && \
83-
git checkout ow-0.1 && \
83+
git checkout 76c123b && \
8484
./build.sh && \
8585
./configure --prefix=`pwd` && \
8686
make && \
8787
sudo make install && \
8888
cd ../nrn && \
89-
git checkout ow-0.1 && \
89+
git checkout e0950a1 && \
9090
./build.sh && \
9191
./configure --prefix=`pwd` --with-iv=$HOME/neuron/iv --with-nrnpython=/usr/bin/python --with-paranrn && \
9292
make && \
@@ -114,29 +114,28 @@ RUN wget http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/11705/in
114114
cd $HOME && \
115115
rm intel_sdk_for_opencl_$INTEL_SDK_VERSION.tgz && \
116116
sudo rm /tmp/silent-intel-sdk.cfg
117-
118-
RUN git clone https://github.com/lungd/jNeuroML.git && \
119-
cd jNeuroML && \
120-
git checkout ow-0.1 && \
121-
python getNeuroML.py ow-0.1
122117

123-
RUN git clone https://github.com/lungd/pyNeuroML.git && \
118+
RUN git clone https://github.com/NeuroML/pyNeuroML.git && \
124119
cd pyNeuroML && \
125-
git checkout ow-0.1 && \
120+
git checkout ow-0.8a && \
126121
sudo python setup.py install
127122

128-
RUN git clone https://github.com/lungd/PyOpenWorm.git && \
123+
RUN git clone https://github.com/openworm/PyOpenWorm.git && \
129124
cd PyOpenWorm && \
130-
git checkout ow-0.1 && \
125+
git checkout 7ff1266 && \
131126
sudo python setup.py install
132127

133-
RUN git clone https://github.com/lungd/CElegansNeuroML.git && \
128+
RUN git clone https://github.com/openworm/CElegansNeuroML.git && \
134129
cd CElegansNeuroML && \
135-
git checkout ow-0.1
130+
# Pointing this at a recent commit that adds python 3 support!
131+
# https://github.com/openworm/CElegansNeuroML/commit/c8b13642d79335bb8157431b83624e33d50a166e
132+
git checkout c8b1364
136133

137-
RUN git clone https://github.com/lungd/sibernetic.git && \
134+
RUN git clone https://github.com/openworm/sibernetic.git && \
138135
cd sibernetic && \
139-
git checkout ow-0.1 && \
136+
# fixed to a specific commit in development branch:
137+
# https://github.com/openworm/sibernetic/commit/3eb9914db040fff852cba76ef8f4f39d0bed3294
138+
git checkout 3eb9914 && \
140139
make clean && make all
141140

142141
ENV JNML_HOME=$HOME/jNeuroML

README.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We are using a bottom-up approach, aimed at observing the worm behaviour emerge
1111

1212
Quickstart
1313
----------
14-
We have put together a [docker container](http://docker.com) that pulls together the major components of our simulation and runs it on your machine. When you get it all running it do the following:
14+
We have put together a [docker container](http://docker.com) that pulls together the major components of our simulation and runs it on your machine. When you get it all running it does the following:
1515

1616
1. Run our nervous system model, known as [c302](https://github.com/openworm/CElegansNeuroML/tree/master/CElegans/pythonScripts/c302), on your computer.
1717
2. Run our body model, known as [Sibernetic](https://github.com/openworm/sibernetic), on your computer, using the output of the nervous system model.
@@ -24,13 +24,13 @@ We have put together a [docker container](http://docker.com) that pulls together
2424

2525
<img src="img/muscle-activity.png" width="250"><img src="img/neuron-activity.png" width="350">
2626

27-
**NOTE**: Running the simulation for the full amount of time would produce content like the above. However, in order to run in a reasonable amount of time, the default run time for the simulation is limited. As such, you will see only a partial output, equivalent to about 5% of run time, compared to the examples above.
27+
**NOTE**: Running the simulation for the full amount of time would produce content like the above. However, in order to run in a reasonable amount of time, the default run time for the simulation is limited. As such, you will see only a partial output, equivalent to about 5% of run time, compared to the examples above. To extend the run time, use the `-d` argument as described below.
2828

2929
**Installation**
3030

3131
Pre-requisites:
3232

33-
1. Currently Windows is not supported; you will need Mac OS or Linux (or a virtual environment on Windows that runs either of those).
33+
1. Currently Windows is not supported (see https://github.com/openworm/OpenWorm/issues/263); you will need Mac OS or Linux (or a virtual environment on Windows that runs either of those).
3434
2. You should have at least 60 GB of free space on your machine and at least 2GB of RAM
3535

3636
To Install:
@@ -39,23 +39,63 @@ To Install:
3939

4040
**Running**
4141

42-
1. Open a terminal and run `run-shell-only.sh`.
43-
2. Run `DISPLAY=:44 python master_openworm.py`.
44-
3. About 5-10 minutes of output will display on the screen as the steps run.
45-
4. The simulation will end. Exit the container with `exit` and run `stop.sh` on your system to clean up the running container.
46-
5. Inspect the output in the `output` directory.
42+
1. Open a terminal and run: `git clone http://github.com/openworm/openworm`; `cd openworm`
43+
1. Run `./run.sh`.
44+
2. About 5-10 minutes of output will display on the screen as the steps run.
45+
3. The simulation will end. Exit the container with `exit` and run `stop.sh` on your system to clean up the running container.
46+
4. Inspect the output in the `output` directory.
4747

4848
**Advanced**
4949

50-
Try the following to play around with the system:
50+
***Arguments***
51+
52+
* -d [num] : Use to modify the duration of the simulation in milliseconds. Default is 15. Use 5000 to run for time to make the full movie above.
53+
54+
***Other things to try***
5155

5256
* Open a terminal and run `run-shell-only.sh`. This will let you log into the system before it has run `master_openworm.py`. From here you can inspect the internals of the various checked out code bases and installed systems and modify things. Afterwards you'll still need to run `stop.sh` to clean up.
5357
* If you modify what gets installed, you should modify Dockerfile. If you modify what runs, you should modify `master_openworm.py`. Either way you will need to run `build.py` in order to rebuild the image locally. Afterwards you can run normally.
5458

59+
### FAQ
60+
61+
#### **What is the docker container?**
62+
63+
The docker container is a self-contained environment in which you can run openworm simulations. It's fully setup to get you started by following the steps above. At the moment, it runs simulations and produces visualizations for you, but these visualizations must be viewed outside of the docker container.
64+
65+
#### **Is it possible to modify the simulation without having to run `build.py`?**
66+
67+
Yes, but it is marginally more complex. The easiest way is to modify anything in the docker container once you are inside of it - it will work just like a bash shell. If you want to modify any code in the container, you'll need to use an editor that runs in the terminal, like nano. Once you've modified something in the container, you don't need to re-build. However, if you run `stop.sh` once you exit, those changes will be gone.
68+
69+
#### **How do I access more data than what is already output?**
70+
71+
The simulation by default outputs only a few figures and movies to your home system (that is, outside of the docker container). If you want to access the entire output of the simulation, you will need to copy it from the docker container.
72+
73+
For example, say you want to extract the worm motion data. This is contained in the file `worm_motion_log.txt`, which is found in the `/home/ow/sibernetic/simulations/[SPECIFIC_TIMESTAMPED_DIRECTORY]/worm_motion_log.txt`. The directory `[SPECIFIC_TIMESTAMPED_DIRECTORY]` will have a name like `C2_FW_2018_02-12_18-36-32`, and its name can be found by checking the `output` directory. This is actually the main output directory for the simulation, and contains all output, including cell modelling and worm movement.
74+
75+
Once the simulation ends and you exit the container with `exit`, but before you run `stop.sh`, run the following command from the openworm-docker-master folder:
76+
77+
`docker cp openworm:/home/ow/sibernetic/simulations/[SPECIFIC_TIMESTAMPED_DIRECTORY]/worm_motion_log.txt ./worm_motion_log.txt`
78+
79+
This will copy the file from the docker container, whose default name is `openworm`. **It is crucial that you do not run `stop.sh` before trying to get your data out (see below)**
80+
81+
#### **What is the difference between `exit` and `stop.sh`?**
82+
83+
When you are in the Docker Container `openworm`, and are done interacting with it, you type `exit` to return to your system's shell. This stops execution of anything in the container, and that container's status is now `Exited`. If you try to re-start the process using `run-shell-only.sh`, you will get an error saying that the container already exists. You can choose, at this point, to run `stop.sh`. Doing so will remove the container and any files associated with it, allowing you to run a new simulation. However, if you don't want to remove that container, you will instead want to re-enter it.
84+
85+
#### **How do I enter a container I just exited?**
86+
87+
If you run `stop.sh` you'll delete your data and reset the container for a new run. If, however, you don't want to do that, you can re-enter the docker container like this:
88+
89+
sudo docker exec -it openworm bash
90+
91+
You'll need to enter your su password. This tells docker to all you to *execute* commands (`exec`) with an *interactive, tty* (`-it`) bash (`bash`) shell in the container `openworm`.
92+
93+
You'll be able to interact with the container as before.
94+
5595
Documentation
5696
-------------
5797
Find out more about OpenWorm. Documentation is available at [http://docs.openworm.org](http://docs.openworm.org). [Join us on Slack](http://bit.ly/OpenWormVolunteer).
5898

5999
This repository references:
60100
* A project-wide [Kanban board of all issues](https://waffle.io/openworm/openworm)
61-
* Project-wide tracking via high-level [issues](https://github.com/openworm/OpenWorm/issues?labels=&milestone=&page=1&state=open) and [milestones](https://github.com/openworm/OpenWorm/milestones)
101+
* Project-wide tracking via high-level [issues](https://github.com/openworm/OpenWorm/issues?labels=&milestone=&page=1&state=open) and [milestones](https://github.com/openworm/OpenWorm/milestones)

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
docker build -t "openworm/openworm:0.7" .
3+
docker build -t "openworm/openworm:0.8" .

master_openworm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import math
1414

1515
print("****************************")
16-
print("OpenWorm Master Script v.0.7")
16+
print("OpenWorm Master Script v.0.8")
1717
print("****************************")
1818
print("")
1919
print("This script attempts to run a full pass through the OpenWorm scientific libraries.")
@@ -106,8 +106,12 @@ def execute_with_realtime_output(command, directory, env=None):
106106
print("Unexpected error: %s" % sys.exc_info()[0])
107107
raise
108108

109+
#Default is 15 ms of simulation time.
110+
sim_duration = 15.0
111+
if 'DURATION' in os.environ:
112+
sim_duration = float(os.environ['DURATION'])
109113

110-
DEFAULTS = {'duration': 15.0, # 50 ms
114+
DEFAULTS = {'duration': sim_duration,
111115
'dt': 0.005,
112116
'dtNrn': 0.05,
113117
'logstep': 100,

output/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The output produced after running simulations in the Docker container will be saved here (in your native filesystem).

run-shell-only.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ docker run -ti \
1313
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
1414
--privileged \
1515
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
16-
openworm/openworm:0.7 \
16+
openworm/openworm:0.8 \
1717
bash
1818

run.sh

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,46 @@
11
#!/bin/bash
22

3+
#from: https://unix.stackexchange.com/a/129401
4+
while getopts ":d:p:" opt; do
5+
case $opt in
6+
d) duration="$OPTARG"
7+
;;
8+
p) p_out="$OPTARG"
9+
;;
10+
\?) echo "Invalid option -$OPTARG" >&2
11+
;;
12+
esac
13+
done
14+
315
OW_OUT_DIR=/home/ow/shared
416
HOST_OUT_DIR=$PWD
517

618
xhost +
719

8-
docker run -d \
9-
--name openworm \
10-
--device=/dev/dri:/dev/dri \
11-
-e DISPLAY=$DISPLAY \
12-
-e OW_OUT_DIR=$OW_OUT_DIR \
13-
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
14-
--privileged \
15-
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
16-
openworm/openworm:0.7 \
17-
python master_openworm.py
20+
if [ -z "$duration" ]
21+
then #duration is not set, don't use it
22+
docker run -d \
23+
--name openworm \
24+
--device=/dev/dri:/dev/dri \
25+
-e DISPLAY=$DISPLAY \
26+
-e OW_OUT_DIR=$OW_OUT_DIR \
27+
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
28+
--privileged \
29+
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
30+
openworm/openworm:0.8 \
31+
bash -c "DISPLAY=:44 python master_openworm.py"
32+
else #Duration is set, use it.
33+
docker run -d \
34+
--name openworm \
35+
--device=/dev/dri:/dev/dri \
36+
-e DISPLAY=$DISPLAY \
37+
-e DURATION=$duration \
38+
-e OW_OUT_DIR=$OW_OUT_DIR \
39+
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
40+
--privileged \
41+
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
42+
openworm/openworm:0.8 \
43+
bash -c "DISPLAY=:44 python master_openworm.py"
44+
fi
45+
46+
docker logs -f openworm

0 commit comments

Comments
 (0)