diff --git a/pyproject.toml b/pyproject.toml index 0857c82de..173bc63a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] description = "Bluesky tools for MX Beamlines" -dependencies = ["bluesky", "ophyd", "pyepics"] +dependencies = ["bluesky", "ophyd", "pyepics", "jupyterlab", "matplotlib"] dynamic = ["version"] license.file = "LICENSE" readme = "README.rst" diff --git a/src/mx_bluesky/jupyter_example.ipynb b/src/mx_bluesky/jupyter_example.ipynb new file mode 100644 index 000000000..cfa9681ae --- /dev/null +++ b/src/mx_bluesky/jupyter_example.ipynb @@ -0,0 +1,73 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b712b364-878d-49c2-96d7-9269c0cb4317", + "metadata": {}, + "source": [ + "Setup for bluesky (see https://nsls-ii.github.io/bluesky/tutorial.html)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8bb8afd0-a6cb-40fd-8a88-fe99a5eba55c", + "metadata": {}, + "outputs": [], + "source": [ + "from bluesky import RunEngine\n", + "from bluesky.callbacks.best_effort import BestEffortCallback\n", + "\n", + "RE = RunEngine({})\n", + "\n", + "bec = BestEffortCallback()\n", + "\n", + "# Send all metadata/data captured to the BestEffortCallback.\n", + "RE.subscribe(bec)" + ] + }, + { + "cell_type": "markdown", + "id": "16ff289d-3ae5-4834-8d3c-a3be871473b0", + "metadata": {}, + "source": [ + "Run a scan against a sim detector" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4b56ec8e-9bc2-4b6e-8652-4f49cd8c5d93", + "metadata": {}, + "outputs": [], + "source": [ + "from ophyd.sim import det, motor\n", + "from bluesky.plans import scan\n", + "dets = [det] # just one in this case, but it could be more than one\n", + "\n", + "RE(scan(dets, motor, -1, 1, 10))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/start_jupyter.sh b/start_jupyter.sh new file mode 100755 index 000000000..e9037bbef --- /dev/null +++ b/start_jupyter.sh @@ -0,0 +1,2 @@ +source .venv/bin/activate +jupyter-lab --matplotlib=qt5 \ No newline at end of file