Skip to content

Commit

Permalink
enh: add relative startup and refined config
Browse files Browse the repository at this point in the history
  • Loading branch information
maffettone committed Apr 12, 2024
1 parent d9c5c4d commit cdcd023
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 9 additions & 4 deletions bmm_agents/startup_scripts/mmm5-tax-day/Pt_KmeansMonarch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
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=[[186.307, 89.276], [186.384, 89.305]],
element_det_positions=[185, 160],
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",
Expand All @@ -37,7 +40,7 @@
subject_endstation_key="pdf",
pdf_origin=(17.574, 4.075),
# Active Kmeans Args
bounds=np.array([(-32, 32), (-32, 32)]),
bounds=np.array([(-31, 31), (-31, 31)]),
# BS Adaptive Args
ask_on_tell=False,
report_on_tell=True,
Expand All @@ -51,13 +54,15 @@
@startup_decorator
def startup():
agent.start()
path = "/nsls2/data/bmm/shared/config/source/bmm-agents/bmm_agents/startup_scripts/historical_Pt_uids.txt"
path = "/nsls2/data/bmm/shared/config/source/bmm-agents/bmm_agents/startup_scripts/historical_mmm4_uids.txt"
with open(path, "r") as f:
uids = []
for line in f:
uids.append(line.strip().strip(",").strip("'"))

agent.element_origins = old_mmm4_origin
agent.tell_agent_by_uid(uids)
agent.element_origins = new_mmm5_origin


@shutdown_decorator
Expand Down
14 changes: 10 additions & 4 deletions bmm_agents/startup_scripts/mmm5-tax-day/Pt_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@
beamline_objects = MultiElementActiveKmeansAgent.get_beamline_objects()
beamline_objects["qserver"].set_authorization_key(api_key=os.getenv("HTTPSERVER_API_KEY", "zzzzz"))


old_mmm4_origin = [[186.307, 89.276], [186.384, 89.305]]
new_mmm5_origin = [[174.550, 103.806], [175.127, 103.484]]

agent = MultiElementActiveKmeansAgent(
filename="PtNi-Multimodal-PtDrivenKmeans",
exp_mode="fluorescence",
read_mode="transmission",
exp_data_type="mu",
elements=["Pt", "Ni"],
edges=["L3", "K"],
element_origins=[[186.307, 89.276], [186.384, 89.305]],
element_det_positions=[185, 160],
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.5 0.05k",
exp_times="1 1 1 1",
bounds=np.array([(-32, 32), (-32, 32)]),
bounds=np.array([(-31, 31), (-31, 31)]),
ask_on_tell=False,
report_on_tell=True,
k_clusters=6,
Expand All @@ -35,13 +39,15 @@
@startup_decorator
def startup():
agent.start()
path = "/nsls2/data/bmm/shared/config/source/bmm-agents/bmm_agents/startup_scripts/historical_Pt_uids.txt"
path = "/nsls2/data/bmm/shared/config/source/bmm-agents/bmm_agents/startup_scripts/historical_mmm4_uids.txt"
with open(path, "r") as f:
uids = []
for line in f:
uids.append(line.strip().strip(",").strip("'"))

agent.element_origins = old_mmm4_origin
agent.tell_agent_by_uid(uids)
agent.element_origins = new_mmm5_origin


@shutdown_decorator
Expand Down

0 comments on commit cdcd023

Please sign in to comment.