APS-4ID-POLAR / ipython-polar

4-ID-Polar ipython configuration for bluesky (and other)
1 stars 3 forks source link

Using LiveDispatcher to plot dichro #155

Closed gfabbris closed 1 year ago

gfabbris commented 1 year ago

The stuff in the livedispatcher branch is working right now. Two remaining items:

gfabbris commented 1 year ago

Something like this: dichro_stream.subscribe(cat.v1.insert) surprisingly (to me!) sort of works to save the data. The problem is that the data is saved to the primary stream of a new run that has the same scan_id, instead of a new stream of the same run.

gfabbris commented 1 year ago

Also it sort of worked to create a Signal that gets the processed data, and have it in sd.monitors. The problem is that we need to save three signals, and they go to its own stream.

gfabbris commented 1 year ago

Something like this might work:

In [49]: class DichroDevice(Device):
    ...:     positioner = Component(Signal, value=0)
    ...:     xas = Component(Signal, value=0)
    ...:     xmcd = Component(Signal, value=0)
    ...:     def subscribe(self, callback, event_type=None, run=True):
    ...:         super().subscribe(callback, event_type="acq_done", run=run)
    ...:     def put(self, dev_t, **kwargs):
    ...:         super().put(dev_t, **kwargs)
    ...:         self._run_subs(sub_type=self.SUB_ACQ_DONE, success=True)