-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XPD Operator
committed
Aug 1, 2024
1 parent
48b0e3a
commit cbe1912
Showing
6 changed files
with
308 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "266706b2", | ||
"metadata": {}, | ||
"source": [ | ||
"## Bluesky Publisher\n", | ||
"### used in bsui environment" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "64cd5061-4ffa-4a78-b9bf-f7bc33b7afd9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from bluesky_kafka import Publisher" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5ce7cc25", | ||
"metadata": {}, | ||
"source": [ | ||
"### res is defined in 00-startup.py" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "19cff38b-5f91-444b-a97a-4c06556167f5", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"p = Publisher(topic=res[1].beamline_topic, bootstrap_servers=res[1].bootstrap_servers, \n", | ||
" key =\"test\", producer_config=res[1].producer_config)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d071468d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"uids = ['699593ad-c210-4c53-8df5-9b08ccb8e025',\n", | ||
" '74288b93-4e5c-40bb-a8cd-a9b25f68efbf',\n", | ||
" '38729429-64b4-4f61-a07d-bcd7a70aa845',\n", | ||
" 'f9258402-470a-42d8-8493-a357f96a0885']\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "4b2a9dce", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from databroker import Broker\n", | ||
"db = Broker.named('xpd-ldrd20-31')\n", | ||
"for uid in uids:\n", | ||
" hdr = db[uid]\n", | ||
" for name, doc in hdr.documents():\n", | ||
" p(name, doc)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "12daf875", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import databroker\n", | ||
"catalog = databroker.catalog['xpd-ldrd20-31']\n", | ||
"for uid in uids:\n", | ||
" run = catalog[uid]\n", | ||
" for name, doc in run.documents():\n", | ||
" p(name, doc)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5599fbc9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from confluent_kafka import Producer, KafkaException\n", | ||
"for name, doc in run.documents():\n", | ||
" try:\n", | ||
" p(name, doc)\n", | ||
" except KafkaException:\n", | ||
" pass" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "470f165f", | ||
"metadata": {}, | ||
"source": [ | ||
"## Notes for databroker and tiled" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fb2fda28", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"uid_sandbox = '122fe6ee-0851-4526-8c20-6c0f654d74d2'\n", | ||
"sandbox_tiled_client = from_uri(\"https://tiled.nsls2.bnl.gov/api/v1/metadata/xpd/sandbox\")\n", | ||
"sandbox_tiled_client[uid_sandbox]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a2c7ca85", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"uid_analysis = '7dd39c4f-2c8d-4523-96e7-3f693595f776'\n", | ||
"sandbox_tiled_client = from_uri(\"https://tiled.nsls2.bnl.gov/api/v1/metadata/xpd/sandbox\")\n", | ||
"sandbox_tiled_client[uid_analysis]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c7279043", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"# uid_xpd = '590b010d-bd83-493b-90dd-bdb42a71fc61'\n", | ||
"uid_xpd = '1ae37977-436c-42c0-a105-8a39c5aa8bfd'\n", | ||
"xpd_tiled_client = from_uri(\"https://tiled.nsls2.bnl.gov/api/v1/metadata/xpd/raw\")\n", | ||
"xpd_tiled_client[uid_xpd]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b54224a2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"'take_a_uvvis'\n", | ||
"uid = 'b17bad22-290e-429d-96ed-0226a45a48ce'\n", | ||
"\n", | ||
"'xray_uvvis_plan'\n", | ||
"uid = '53542574-6fee-4023-bef0-ad353accd01c'\n" | ||
] | ||
} | ||
], | ||
"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.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.