Skip to content

Commit

Permalink
enh: name and exposed attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
maffettone committed Apr 12, 2024
1 parent f8e5aa7 commit 513d15e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pdf_agents/gsas.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,26 @@ def inst_param_path(self, inst_param_path):
self._inst_param_path = inst_param_path
self.close_and_restart()

@property
def recent_uid(self):
return self._recent_uid

@property
def recent_x(self):
return self._recent_x

@property
def name(self):
return "GSAS-Refinement-Agent"

def server_registrations(self) -> None:
super().server_registrations()
self._register_property("CIF paths", self.cif_paths)
self._register_property("refinement_params", self.refinement_params)
self._register_property("Instrument Parameter Path", self.inst_param_path)
self._register_property("Recent UID", self.recent_uid)
self._register_property("Recent X", self.recent_x)

def unpack_run(self, run):
self._recent_uid = run.metadata["start"]["uid"]
return super().unpack_run(run)
Expand Down
19 changes: 19 additions & 0 deletions pdf_agents/peakfit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from http import server
from typing import Dict, List

import numpy as np
Expand Down Expand Up @@ -101,9 +102,27 @@ def maxcycles(self, maxcycles):
self._maxcycles = maxcycles
self.close_and_restart()

@property
def recent_uid(self):
return self._recent_uid

@property
def recent_x(self):
return self._recent_x

@property
def name(self):
return "Peak-Fit-Agent"

def server_registrations(self) -> None:
super().server_registrations()
self._register_property("Peak Fit ROIs", self, "xrois")
self._register_property("Fit Function", self, "fit_func")
self._register_property("Position Percent Limit", self, "pos_percent_lim")
self._register_property("Max Cycles", self, "maxcycles")
self._register_property("Recent UID", self.recent_uid)
self._register_property("Recent X", self.recent_x)

def unpack_run(self, run):
self._recent_uid = run.metadata["start"]["uid"]
return super().unpack_run(run)
Expand Down

0 comments on commit 513d15e

Please sign in to comment.