-
Notifications
You must be signed in to change notification settings - Fork 3
Using calin with Docker
If you haven't already done so, install Docker on your machine and then install calin from DockerHub.
- Install Docker on your system, assuming you have the rights to do this.
- Get the calin image for Docker by running :
docker pull llrcta/calin
I have tested this on MacOS 10.11.6 with Docker 1.12.0-a, and under Ubuntu. In principle it should work under Windows also but I haven't been able to connect to the notebook (any help would be appreciated!).
-
Docker containers are basically light-weight virtual machines. To share data between the Docker container and your host system you need to share a directory with the container. If you wish to store the images produced by the simulation you should make a directory on your host system to store them, e.g.:
mkdir ~/CTA
-
Run the Jupyter (Python) notebook server in a Docker container:
docker run --pid=host -t -i -p 127.0.0.1:8800:8888 -v ~/CTA:/CTA llrcta/calin:latest jupyter-notebook
- The option
-p 127.0.0.1:8800:8888
propagates connections to the TCP port 8800 on the host to the port 8888 within the container, thereby allowing access to the Jupyter notebook server running on the container. - The option
-v ~/CTA:/CTA
below shares the host directory~/CTA
with Docker, making it available as/CTA
within the container. This can be omitted if not wanted. - the option
--pid=host
seems to be necessary to overcome a bug in the Jupyter notebook kernel.
- The option
-
Connect to the container from a browser on the host system. The notebook for the event simulator is in the directory `/usr/share/calin/examples' within the container file system. Open this in the Notebook by connecting to the URL :
http://localhost:8800/tree/usr/share/calin/examples/simulation
-
Click on
toy event simulation for mst nectarcam.ipynb
to open the simulation notebook and (automatically) start a Python kernel to run the code. -
Run the notebook code by clicking on the
Cells -> Run All
menu option, as illustrated below. -
Use the simple interface at the bottom of the notebook to generate events by specifying the desired parameters of:
- Particle type (gamma ray, proton, electron or muon)
- Energy, specified as log10 of energy in GeV between 10GeV (=1) and 100TeV (=5) with resolution of 16 steps/decade
- Impact point with respect to telescope : distance and polar angle
- Direction of propagation of primary : off-axis angle and polar angle
- NSB rate in mean PE per channel per event
- Photon poisson and PMT amplifier noise enable/disable
- Ad hoc clipping at 4000PE enable/disable
-
Press "Run Simulation" to generate an event. This can be quite slow at high energies. The image will be written to
/CTA/event.pdf
if the directory/CTA
was mounted in step 2, and will also be visible on the host filesystem in~/CTA
.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.