-
Clone this repository:
git clone https://github.com/robolamp/3_body_problem_bot.git
-
Enter the directry with cloned repo:
cd 3_body_problem_bot
-
Edit
Dockerflie
: replace[TOKEN]
and[BOT_NAME]
with your bot token and your channel nameRUN (crontab -l ; echo "0 */12 * * * python3 /home/3_body_problem_bot/generate_3_body_simulation.py -V -T [TOKEN] -N [BOT_NAME] --fps 15 --min-score 24 --duration 150 >> /var/log/cron.log") | crontab
-
Build docker image using command:
docker build -t [your image name] -f ./Dockerfile .
-
Using built image, run the container in background:
docker run -d [your image name]:latest
-
Check that the container is running and find id of your container:
docker container ls
-
Check that crontable into the container is set up as you expected:
docker exec -ti [your container id] bash -c "cat /var/log/cron.log"
-
Check log when it'll be time to tun the script
docker exec -ti [your container id] bash -c "crontab -l"
-
Install/check general requirements:
ffmpeg python3
-
Install/check python3 requirements with
pip3
:pip3 install numpy scipy matplotlib python-telegram-bot
-
Now you can run this script!
With the following command you can run the simulation with default params:
./generate_3_body_simulation.py
Without providing arguments
-T
and-N
it will run without Telegram bot functionality.To modify the simulation, you can use the following arguments:
--dt DT
for simulation step;--fps FPS
for frames per second in the video;--n-bodies N_BODIES
number of bodies (tested with up to 60);--duration DURATION
simulation duration;--video-duration
video duration (if simulation duration is bigger, the visualization will be accelerated);--min-score MIN_SCORE
Minimal "interest-ness" score;--max-score MAX_SCORE
Maximal "interest" score;With bigger difference between
MIN_SCORE
andMAX_SCORE
, the script will run fewer simulations before achieving appropriate one.Simulations with high "interest-ness" score are looking too chaotic, and simulations with "interest-ness" score are boring (almost nothing happens).
--max-field-size MAX_FIELD_SIZE
Maximal field size.