Closes #2732 (closed)
Closes #2693 (closed)
Closes #2683 (closed)
This PR allow to display 1D data from specific devices into a specific Flint plot.
Few metadata are provided per controllers/acqobj to plot channels with a dedicated xaxis data.
Changelog
- Added dedicated widget for acqobj exposing 1D data
- Only 1D data from this acqobj is displayed
- Supports metadata from controllers or acqobj to custom the X-axis
-
xaxis_channel
,xaxis_array
-
- Added data display as index for curve plots and onedim plots
- Group MCA channels per detectors in the property tree
Example
import numpy
from bliss.controllers import simulation_counter
from bliss.controllers.counter import SoftCounterController
from bliss.scanning.acquisition.counter import SamplingCounterAcquisitionSlave
from bliss.common import protocols
def create_1d_controller(device_name, fixed_xarray=False, fixed_xchannel=False):
class OneDimAcquisitionSlave(SamplingCounterAcquisitionSlave):
def fill_meta_at_scan_start(self, scan_meta):
def get_channel_by_counter_name(name):
for counter, channels in self._counters.items():
if counter.name == name:
return channels[0]
return None
if fixed_xarray:
meta = {
"xaxis_array": numpy.arange(32) * 10,
"xaxis_array_unit": "eV",
"xaxis_array_label": "energy",
}
elif fixed_xchannel:
xaxis_channel = get_channel_by_counter_name("d2")
meta = {"xaxis_channel": xaxis_channel.fullname}
else:
meta = None
return meta
class OneDimController(simulation_counter.OneDimSimulationController):
def __init__(self):
simulation_counter.OneDimSimulationController.__init__(self, name=device_name)
simulation_counter.OneDimSimulationCounter(
name="d1", controller=self, signal="gaussian", coef=100, poissonian=True
)
simulation_counter.OneDimSimulationCounter(
name="d2", controller=self, signal="linear_up", coef=100
)
def get_acquisition_object(self, acq_params, ctrl_params, parent_acq_params):
return OneDimAcquisitionSlave(self, ctrl_params=ctrl_params, **acq_params)
return OneDimController()
flex = create_1d_controller("flex", fixed_xchannel=True)
spectro = create_1d_controller("spectro", fixed_xarray=True)
onedim = create_1d_controller("onedim")
s = ct(flex, spectro, onedim)
print(s.acq_chain.tree)