Commit 8057e11e authored by Valentin Valls's avatar Valentin Valls
Browse files

Added "empty" fill type

parent 28da994a
......@@ -63,7 +63,7 @@ The class :cpp:class:`FrameBuilder` can be parametrized with:
- :cpp:func:`setFrameDim()`: set a new frame dimension (max. is 1024x1024)
- :cpp:func:`setPeaks()`: set a list of GaussPeak positions (GaussPeak struct -> x, y, fwhm, max)
- :cpp:func:`setPeakAngles()`: set a list of GaussPeak angles
- :cpp:func:`setFillType()`: set the image fill type Gauss or Diffraction (default is Gauss)
- :cpp:func:`setFillType()`: set the image fill type Gauss or Diffraction or Empty (default is Gauss)
- :cpp:func:`setRotationAxis()`: set the rotation axis policy Static, RotationX or RotationY (default is RotationY)
- :cpp:func:`setRotationAngle()`: set a peak rotation angle in deg (default is 0)
- :cpp:func:`setRotationSpeed()`: set a peak rotation speed ixin deg/frame (default is 0)
......
......@@ -59,6 +59,7 @@ public:
enum FillType {
Gauss,
Diffraction,
Empty,
};
enum RotationAxis {
Static,
......
......@@ -125,7 +125,7 @@ class FrameBuilder
public:
enum FillType {
Gauss, Diffraction,
Gauss, Diffraction, Empty,
};
enum RotationAxis {
RotationX, RotationY,
......
......@@ -641,6 +641,10 @@ void FrameBuilder::fillData(unsigned long frame_nr, unsigned char *ptr) const
*******************************************************************/
bool FrameBuilder::getFrame(unsigned long frame_nr, unsigned char *ptr)
{
if (m_fill_type == Empty) {
return true;
}
switch (m_frame_dim.getDepth()) {
case 1:
fillData<unsigned char>(frame_nr, ptr);
......
......@@ -63,6 +63,7 @@ class Simulator(PyTango.Device_4Impl):
_FillType = {
'GAUSS': SimuMod.FrameBuilder.Gauss,
'DIFFRACTION': SimuMod.FrameBuilder.Diffraction,
'EMPTY': SimuMod.FrameBuilder.Empty,
}
Core.DEB_CLASS(Core.DebModApplication, 'LimaSimulator')
......
......@@ -232,3 +232,72 @@ def test_custom_frame():
assert False, "Simulator is still running"
assert process_count == 1
def test_gauss_fill():
"""
Test that the gauss fill increase frame after frame
"""
processed_frames = []
class MyCamera(Simulator.Camera):
def fillData(self, data):
nonlocal processed_frames
s = numpy.sum(data.buffer)
processed_frames.append(s)
cam = MyCamera()
hw = Simulator.Interface(cam)
ct = Core.CtControl(hw)
acq = ct.acquisition()
acq.setTriggerMode(Core.IntTrig)
acq.setAcqNbFrames(3)
acq.setAcqExpoTime(0.01)
ct.prepareAcq()
ct.startAcq()
for _ in range(30):
if ct.getStatus().AcquisitionStatus != Core.AcqRunning:
break
time.sleep(0.1)
else:
assert False, "Simulator is still running"
assert processed_frames == [1096524, 2225892, 3356544]
def test_empty_fill():
"""
Test that the empty fill provides empty frames
"""
processed_frames = []
class MyCamera(Simulator.Camera):
def fillData(self, data):
nonlocal processed_frames
s = numpy.sum(data.buffer)
processed_frames.append(s)
cam = MyCamera()
cam.getFrameGetter().setFillType(Simulator.FrameBuilder.Empty)
hw = Simulator.Interface(cam)
ct = Core.CtControl(hw)
acq = ct.acquisition()
acq.setTriggerMode(Core.IntTrig)
acq.setAcqNbFrames(3)
acq.setAcqExpoTime(0.01)
ct.prepareAcq()
ct.startAcq()
for _ in range(30):
if ct.getStatus().AcquisitionStatus != Core.AcqRunning:
break
time.sleep(0.1)
else:
assert False, "Simulator is still running"
assert processed_frames == [0, 0, 0]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment