Skip to content

Commit

Permalink
Creation and setup of example Jupyter notebook ulrikpedersen#12
Browse files Browse the repository at this point in the history
  • Loading branch information
8ryn committed Aug 17, 2023
1 parent f1fb6cf commit 5593877
Show file tree
Hide file tree
Showing 6 changed files with 393 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ services:
- --pv-prefix
- "EPAC-DEV:PULSE:"
- --period
- "5"
- "2"
- --epics-time-offset
- "-0.05"
- --enable-gate
Expand Down
19 changes: 19 additions & 0 deletions docs/user/how-to/run-scan.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Running a scan
==================
Scans can either be run within an IPython terminal or a Jupyter notebook.

IPython terminal
----------------

* Start the interactive bluesky environment. It is important to mount the output directory and run the container within the same network as the docker-compose environment. This can be achieved by running:

Expand All @@ -11,6 +15,21 @@ Running a scan

There are two scan modes which are explained below. Outputs from the scan are saved to the data directory.

Jupyter notebook
-----------------

* Start the Jupyter notebook container, mounting the output directory and the directory containing the example Jupyter notebook. The container must also be run within the same network as the docker-compose environment. Do this by running:

.. code-block:: bash
docker run -p 8888:8888 -v `pwd`/src/tomoscan:/home/jovyan/work -v `pwd`/data:/home/jovyan/data --net tomoscan_default tomoscan_jupyter
* Copy and paste the URL starting :code:`http://127.0.0.1:8888` that appears in the terminal into a browser to launch the Jupyter server
* Launch the setup notebook which is found in the work folder
* Start the phoebus screen to monitor the scan's progress. Navigate to the display folder and run :code:`./startOverview.sh`
* Follow the steps in the Jupyter notebook


Synced scan
-------------
In the default setup the pulse generator triggers the laser IOC and then when running the synced scan the motor moves to its next position, waits for the laser PV to
Expand Down
2 changes: 1 addition & 1 deletion sim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

BUILD_DIRECTORIES="areaDetectorDock motorDock pmac pulsedLaser"
BUILD_DIRECTORIES="areaDetectorDock motorDock pmac pulsedLaser jupyter"

for DIR in $BUILD_DIRECTORIES; do
echo "+--------------------------"
Expand Down
7 changes: 7 additions & 0 deletions sim/jupyter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Due to copying a top level file this must be run from the top level directory
FROM jupyter/base-notebook

#Long term this list should somehow be synced with the bluesky pip install list
RUN set -ex && pip install h5py bluesky ophyd ipython matplotlib databroker pyepics area-detector-handlers
RUN mkdir -p ~/.config/databroker
COPY ./mongo.yml /home/jovyan/.config/databroker/mongo.yml
5 changes: 5 additions & 0 deletions sim/jupyter/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
DIR=$(pwd)
cd ../..
docker build -t tomoscan_jupyter -f sim/jupyter/Dockerfile .
cd $DIR
Loading

0 comments on commit 5593877

Please sign in to comment.