How to emit data of iregular shape in a block ?
I tried to emit data of irregular shape in a block (data shape of samples channel of sampling counter in SAMPLES mode). If I see it correctly this sort of emission is not possible today. Here is the example that I tried to make working
regular data shape (working)
from bliss.scanning.channel import AcquisitionChannel
from bliss.scanning.scan import Scan
from bliss.scanning.chain import AcquisitionDevice,AcquisitionChain
from bliss.scanning.acquisition.timer import SoftwareTimerMaster
import numpy
class BlocEmissionAcqDev(AcquisitionDevice):
def __init__(self):
class dev:
def __init__(self):
self.name = "test_dev"
super().__init__(dev(), npoints=5)
self.channels.append(AcquisitionChannel("test_dev:test", numpy.float64, (1,)))
self.channels.append(AcquisitionChannel("test_dev:test", numpy.float64, (3,)))
def prepare(self):
pass
def start(self):
dat = [[numpy.array(17),numpy.array(18)],[numpy.array([3,5,7]),numpy.array([4,6,8])]]
self.channels.update_from_iterable(dat)
def stop(sef):
pass
def trigger(self):
pass
chain = AcquisitionChain()
master = SoftwareTimerMaster(0.1, npoints=5, name="timer1")
md = BlocEmissionAcqDev()
chain.add(master, md)
s = Scan(chain, name="toto")
s.run()
irregular data shape (not working)
class BlockEmissionAcqDev(AcquisitionDevice):
def __init__(self):
class dev:
def __init__(self):
self.name = "test_dev"
super().__init__(dev(), npoints=5)
self.channels.append(AcquisitionChannel("test_dev:test", numpy.float64, (1,)))
self.channels.append(AcquisitionChannel("test_dev:test", numpy.float64, (4,)))
def prepare(self):
pass
def start(self):
dat = [[numpy.array(17),numpy.array(18)],[numpy.array([3,5,7,9]),numpy.array([4,6,8])]]
self.channels.update_from_iterable(dat)
def stop(sef):
pass
def trigger(self):
pass
chain = AcquisitionChain()
master = SoftwareTimerMaster(0.1, npoints=5, name="timer1")
md = BlockEmissionAcqDev()
chain.add(master, md)
s = Scan(chain, name="toto")
s.run()