Skip to content

Commit

Permalink
Added jupyter support
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicOram committed Dec 8, 2022
1 parent 193a3df commit 7b439aa
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
73 changes: 73 additions & 0 deletions src/mx_bluesky/jupyter_example.ipynb
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions start_jupyter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source .venv/bin/activate
jupyter-lab --matplotlib=qt5

0 comments on commit 7b439aa

Please sign in to comment.