Closed matthewcarbone closed 1 year ago
One note from our chat is to make sure that the SVA can take an arbitratry callable to compute distance between two spectra. This will allow us to on the fly implement new functions like [the spectral distance used here (https://pubs.rsc.org/en/content/articlehtml/2022/dd/d2dd00025c), or use a latent distance from a VAE.
Ok I will:
@maffettone updated!
This is looking sharp. My suggestion is instead of making the Agent a child class of agents.base.Agent, make it a mixin class. This way it can be mix and matched with beamline specific needs, and abused without rewriting things.
A simple example here is the SequentialAgentMixin, https://github.com/NSLS-II-PDF/mmm-experiments/blob/428814ae2efadfa8aa94d994b01660b0c93c470c/mmm_experiments/agents/base.py#L352-L376
and how that get's dropped into a PDF specific sequential agent in agents.pdf.SequentialAgent
https://github.com/NSLS-II-PDF/mmm-experiments/blob/428814ae2efadfa8aa94d994b01660b0c93c470c/mmm_experiments/agents/pdf.py#L98-L110
@maffettone ok so if I understand correctly you're saying basically don't inherit the Agent
class and instead write something like akin to SequentialAgentMixin
? That way we can just inherit the ValueAgentMixin
class and deploy the methods on various beamlines. Am I following?
Bingo! Sorry if I pointed you in the wrong direction at the start. But this will let us make a BMMValueAgent and PDFValueAgent in 2 lines each. And should leave room to get jazzy with the MonarchSubject stuff.
@maffettone I attempted to implement the changes as requested. I basically cleaned up the init and made use of the attributes that I'm assuming will be defined (see the doc string). Let me know what you think!
This is all looking great! I outlined a couple changes that will probably raise bugs. Without diving too deep into the rest, I think it's ready for a class in agents.pdf. Make sure to rebase off main first.
Will do!
Poke around and test with that for comfort. You'll probably immediately hit kafka errors, because the offline stuff isn't merged in. So when you're ready, I'm ready, and we can find some of the bugs on the day off.
Sure I can try. I haven't really attempted to do anything with this "online" so to speak. Do you have a good resource/tutorial where I can play around in a sandbox-like environment?
Unfortunately not. For the element of time, I'm going to start pushing on this and adding an offline mode asap.
@maffettone understood- next time. You're running on Thursday, right? I'm available all day over Teams/phone if you need anything on my end.
Kicking off tomorrow through Thursday
Ok got it. Well in any case I'm available should you need anything 👍
@maffettone this still needs some work but here's the first draft!
This agent tries to gain a dynamic understanding of now "new" some observations are relative to those previously observed, and can be used with e.g. Expected Improvement to sample regions where high changes in some observed quantity are observed.