-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
144447b
commit ffb5b30
Showing
7 changed files
with
239 additions
and
17 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
90 changes: 90 additions & 0 deletions
90
bmm_agents/startup_scripts/mmm5-tax-day/Ni_KmeansMonarch.py
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,90 @@ | ||
import logging | ||
import os | ||
|
||
import numpy as np | ||
import tiled.client.node # noqa: F401 | ||
from bluesky_adaptive.server import register_variable, shutdown_decorator, startup_decorator | ||
from pdf_agents.agents import PDFBaseAgent | ||
|
||
from bmm_agents.monarch_pdf_subject import KMeansMonarchSubject | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
beamline_objects = KMeansMonarchSubject.get_beamline_objects() | ||
beamline_objects["qserver"].set_authorization_key(api_key=os.getenv("HTTPSERVER_API_KEY", "zzzzz")) | ||
|
||
pdf_objects = PDFBaseAgent.get_beamline_objects() | ||
pdf_objects["qserver"].set_authorization_key(api_key=os.getenv("HTTPSERVER_API_KEY", "yyyyy")) | ||
|
||
old_mmm4_origin = [[186.307, 89.276], [186.384, 89.305]] | ||
new_mmm5_origin = [[174.550, 103.806], [175.127, 103.484]] | ||
|
||
agent = KMeansMonarchSubject( | ||
filename="PtNi-Multimodal-PtDrivenKmeans", | ||
exp_mode="fluorescence", | ||
read_mode="transmission", | ||
exp_data_type="mu", | ||
elements=["Pt", "Ni"], | ||
edges=["L3", "K"], | ||
element_origins=new_mmm5_origin, | ||
element_det_positions=[180, 110], | ||
sample="AlPtNi wafer pretend-binary PtNi", | ||
preparation="AlPtNi codeposited on a silica wafer", | ||
exp_bounds="-200 -30 -10 25 13k", | ||
exp_steps="10 2 0.3 0.05k", | ||
exp_times="1 1 1 1", | ||
# PDF Args | ||
subject_qserver=pdf_objects["qserver"], | ||
subject_kafka_producer=pdf_objects["kafka_producer"], | ||
subject_endstation_key="pdf", | ||
pdf_origin=(-128.85, 49.91), | ||
# Active Kmeans Args | ||
bounds=np.array([(-30, 30), (-30, 30)]), | ||
# BS Adaptive Args | ||
ask_on_tell=False, | ||
report_on_tell=True, | ||
k_clusters=4, | ||
analyzed_element="Ni", | ||
queue_add_position="back", | ||
**beamline_objects | ||
) | ||
|
||
|
||
def load_uids(path): | ||
with open(path, "r") as f: | ||
uids = [] | ||
for line in f: | ||
uid = line.strip().strip(",").strip("'") | ||
if agent.trigger_condition(uid): | ||
uids.append(uid) | ||
return uids | ||
|
||
|
||
@startup_decorator | ||
def startup(): | ||
agent.start() | ||
path = ( | ||
"/nsls2/data/bmm/shared/config/source/bmm-agents/" | ||
"bmm_agents/startup_scripts/mmm5-tax-day/historical_mmm4_uids.txt" | ||
) | ||
uids = load_uids(path) | ||
|
||
agent.element_origins = old_mmm4_origin | ||
agent.tell_agent_by_uid(uids) | ||
agent.element_origins = new_mmm5_origin | ||
|
||
path = ( | ||
"/nsls2/data/bmm/shared/config/source/bmm-agents/" "bmm_agents/startup_scripts/mmm5-tax-day/fri-uids.txt" | ||
) | ||
uids = load_uids(path) | ||
agent.tell_agent_by_uid(uids) | ||
|
||
|
||
@shutdown_decorator | ||
def shutdown_agent(): | ||
return agent.stop() | ||
|
||
|
||
register_variable("Told UIDs", agent, "tell_cache") | ||
register_variable("Agent Name", agent, "instance_name") |
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,60 @@ | ||
0a7ec91b-2b46-4d78-b311-7463df8ca82c | ||
c6f00c6d-361c-43d6-8711-2b2dec616a6c | ||
23e7d55d-f8a1-4114-bbe9-64d5c372606e | ||
624c8915-8b9e-4cd1-984b-0e782285a919 | ||
31970310-3951-40dd-9634-c041766d73ef | ||
c11f42c4-e363-4b01-bfda-3c9978165be2 | ||
ae977e29-035e-409b-8dff-57302090d3e7 | ||
92139ad5-b0d0-43dc-b9ad-64a50b85f41d | ||
e60dd5bd-f687-4028-b8dd-b61de4401bdc | ||
3fd04309-c438-4861-b185-4a11714e514a | ||
43e485d7-f075-4867-9f3b-8328b59d3e36 | ||
969c2797-a03c-4028-9eb4-7f59d4604b21 | ||
2d2613de-19de-4e59-9af5-c697cf047207 | ||
0681e1d3-f0a3-4251-bfdc-68dc92047fde | ||
cc0f82d4-74ee-42c7-bc4e-c9578da527d6 | ||
f440b281-4b6f-4aa5-b8b0-bc0e6302a141 | ||
95637840-22a3-4271-82ca-d9a6e6dd9c8e | ||
6a46ef15-a0e0-410b-8b60-9da119171b56 | ||
dfcc9ce6-69e1-4f25-a22a-1cb1a1bbcdbf | ||
acda27dd-9323-4d20-a4a6-0c0c07cc6fd8 | ||
b7c197dc-6220-405b-89c7-b6ec5608e3d4 | ||
7aac773d-93ef-4020-a631-3e05480c4f84 | ||
b2db0a58-3418-4d1e-b051-2e9cac777583 | ||
b9637006-93a9-41f5-adf5-de1dd611002d | ||
560be639-8c02-4cc6-87a4-586524bf098c | ||
e9ba18d4-0658-4ade-93ae-9a7e2b1dfb74 | ||
ae1cb4e3-b25f-41dd-8f2b-3de2beac294f | ||
e00bc0aa-4c10-4686-aba3-ce5fe6ca3eea | ||
1aaefae3-81fa-4f59-a1ae-21e6e1f492ad | ||
184bb6b9-d85c-4c3d-88e2-0bdce03e460e | ||
a545b048-69f6-4cd4-9a57-7e24f0c3fe1e | ||
1b83782c-b13d-43be-8104-c14e8037077f | ||
410283c7-bb09-432d-87b1-8c1224c69d77 | ||
024e9583-15a2-46d1-bbb7-6ceb7abe2c37 | ||
40314a2b-b733-4044-a020-862916df5a2a | ||
4dc222c7-9426-4849-b96c-3fc2563f61df | ||
ec8031e2-0d53-45e0-b7a5-35c27aae53e2 | ||
148ea72c-c23a-44f0-97fd-a165551d39b4 | ||
79e5656b-4add-4893-96af-aad33b488d98 | ||
13509494-ed6c-43aa-a8c4-7e53ff0888ba | ||
22ad0ed9-c18b-4279-9f68-c3d1fd35a308 | ||
00adf3b6-daf5-4aa8-ab51-9fee0b42de78 | ||
3ae445ec-8329-4979-90a8-7aaae9157267 | ||
d883121f-b4e6-407d-b860-43a1c5470faa | ||
874515b6-0370-4d46-baee-6a775004a2d7 | ||
891d969a-0d82-4a42-821b-1944461f2502 | ||
a285a2b9-cd1d-4480-ab97-1152c74d3dad | ||
fe82cf59-4262-489b-8f85-22d9e2726273 | ||
773d885f-f254-4529-b03b-0a01d5af490b | ||
8359a7e4-4cec-4f8f-95b0-b675fa2951cf | ||
797a2e5f-f572-44b6-ad60-e26057eaf5f9 | ||
54dece1f-b0c6-47a3-a638-9b2e79de63f9 | ||
9699fc8e-8cd5-47b4-8966-375ff52118b6 | ||
ba6ae1c2-a8cf-4ef5-883e-90aa00cf5459 | ||
91b349b3-ff09-4d84-9511-fa290a6e9cd8 | ||
709533df-d7ea-4105-8fc8-8e600746dac6 | ||
74e109cf-10d5-4274-9c0a-4a15c1762a8b | ||
f0c4f4f7-4fdf-434e-8276-31e4c94a9524 | ||
886fc2c4-ea99-4ddf-b9ee-9921fbbc0b91 | ||
ab06b9f5-a085-4af2-b6eb-e120bc094c85 |
35 changes: 35 additions & 0 deletions
35
bmm_agents/startup_scripts/mmm5-tax-day/historical_mmm4_uids.txt
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,35 @@ | ||
9c1f9ce6-6c35-42c9-ae0b-40620336596c | ||
b02b4bfc-ef9f-4a8d-bfcd-852923061371 | ||
df21d22a-dc85-4566-932f-d66b20f714bd | ||
7a5257a9-c5f6-4dab-908e-82ec74308817 | ||
818400f0-b9a7-489d-ba3b-9839d8e35700 | ||
3c8a6931-b465-46e2-860a-bca6a203ac04 | ||
4bbd010d-5310-4fad-ad4e-956517c04aff | ||
7d7e5497-9fb4-4829-b526-425d42974012 | ||
8e4e5b73-2fad-41ca-b3ca-e1c1d6183052 | ||
797a514b-f673-4131-a236-f5250331f3dd | ||
434b6f94-37ae-41d3-8d3e-8b4ab18d9711 | ||
ea441617-9794-46f0-8e6e-f704ebba8163 | ||
e8374ec8-2a80-48c4-a77f-bd3271677590 | ||
4a992e79-3f45-4c1c-8a99-a47f7b8d8af5 | ||
cb0629dc-a6ea-4581-abbc-bbde76aecb10 | ||
7fd0e59f-9b06-48f1-a17d-a9053032fe34 | ||
ef501a87-5e09-41aa-a72b-20004e00d510 | ||
dafdf68f-a064-4dd3-acf0-dd6506c0aca7 | ||
1ba7768a-bddb-48ac-9148-1162659c38d0 | ||
60d42219-ab88-4865-ae44-6684e538c322 | ||
6d1be8c4-2534-4e8b-a12e-82875eae3996 | ||
adb51916-d093-44d0-b86c-6397901d4eec | ||
340e4116-2a30-4a4c-a1a4-04ca7c7657e0 | ||
91ce30b3-03cf-4557-b7a5-c97293dce1be | ||
ec5023d6-a45d-4109-8d42-7cc0c74d72ed | ||
2bd7ca7f-4ac4-4ed8-8eac-a5e8aa0aea89 | ||
bd09a4ee-3e36-4f07-b1f8-e9baace2617a | ||
bd1a9f03-8117-4393-a49f-9ea2c28b53c1 | ||
95364f08-e085-41ad-9b23-6820a850c67f | ||
5c2d9d83-89e2-481e-818d-73864b792ed6 | ||
58b676df-1f08-4554-8736-ac6ef1fe0422 | ||
0288139d-b373-4525-ad51-f919b4eb5d1a | ||
adb8d6a8-6b7d-4d38-8c74-26fdc3268519 | ||
803bc7ef-60ba-4c43-962c-6db72b400f6d | ||
4a9fc081-fd94-45c8-a2e4-e7cfd615d155 |