Commit c0fbd343 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Jungfrau: add det_map with chip identification

parent 7695a1e7
......@@ -220,6 +220,8 @@ class Eiger : public Model
virtual void getFrameDim(FrameDim& frame_dim, bool raw = false);
virtual void getDetMap(Data& det_map);
virtual std::string getName();
virtual void getPixelSize(double& x_size, double& y_size);
......
......@@ -63,6 +63,8 @@ class Jungfrau : public Model
virtual void getFrameDim(FrameDim& frame_dim, bool raw = false);
virtual void getDetMap(Data& det_map);
virtual std::string getName();
virtual void getPixelSize(double& x_size, double& y_size);
......
......@@ -61,6 +61,8 @@ class Model
int getNbDetModules()
{ return m_nb_det_modules; }
virtual void getDetMap(Data& det_map) = 0;
virtual void setNbUDPInterfaces(int nb_udp_ifaces);
virtual void getNbUDPInterfaces(int& nb_udp_ifaces);
......
......@@ -51,6 +51,9 @@ class Eiger : public SlsDetector::Model
Eiger(SlsDetector::Camera *cam);
virtual void getFrameDim(FrameDim& frame_dim /Out/, bool raw = false);
virtual void getDetMap(Data& det_map /Out/);
SlsDetector::Eiger::Correction *createCorrectionTask() /Factory/;
virtual std::string getName();
......
......@@ -51,6 +51,8 @@ class Jungfrau : public SlsDetector::Model
virtual void getFrameDim(FrameDim& frame_dim /Out/, bool raw = false);
virtual void getDetMap(Data& det_map /Out/);
SlsDetector::Jungfrau::ImgProcTask *createImgProcTask() /Factory/;
virtual std::string getName();
......
......@@ -41,6 +41,8 @@ public:
virtual void getFrameDim(FrameDim& frame_dim /Out/,
bool raw = false) = 0;
virtual void getDetMap(Data& det_map /Out/) = 0;
SlsDetector::Camera *getCamera();
SlsDetector::Type getType();
......
Subproject commit 0604528d4ac4a99f8307c4c422d11c1b930957c0
Subproject commit 942f599edfda51283f162edd75808367a960056e
......@@ -765,6 +765,12 @@ void Eiger::getFrameDim(FrameDim& frame_dim, bool raw)
DEB_RETURN() << DEB_VAR1(frame_dim);
}
void Eiger::getDetMap(Data& /*det_map*/)
{
DEB_MEMBER_FUNCT();
THROW_HW_ERROR(NotSupported) << "DetMap not implemented yet";
}
string Eiger::getName()
{
DEB_MEMBER_FUNCT();
......
......@@ -411,6 +411,48 @@ int Jungfrau::getModuleDataOffset(int idx, bool raw)
return data_offset;
}
void Jungfrau::getDetMap(Data& det_map)
{
DEB_MEMBER_FUNCT();
bool raw;
getCamera()->getRawMode(raw);
FrameDim frame_dim;
getFrameDim(frame_dim, raw);
Buffer *b = new Buffer(frame_dim.getMemSize() * 2);
det_map.type = Data::UINT32;
Size size = frame_dim.getSize();
std::vector<int> dims = {size.getWidth(), size.getHeight()};
det_map.dimensions = dims;
det_map.setBuffer(b);
b->unref();
DEB_ALWAYS() << DEB_VAR1(det_map.size());
auto f = [&](auto det_geom) {
using namespace sls::Geom;
// gap pixels are set to -1
unsigned int *p = (unsigned int *) det_map.data();
memset(p, 0xff, det_map.size());
int chip_idx = 0;
det_for_each_mod(det_geom, mod, mod_geom,
mod_for_each_recv(mod_geom, recv, recv_geom,
recv_for_each_iface(recv_geom, iface, iface_geom,
iface_for_each_chip(iface_geom, chip, chip_view,
view_for_each_pixel(chip_view, pixel,
int i = chip_view.calcMapPixelIndex(pixel);
p[i] = chip_idx;
);
++chip_idx;
);
);
);
);
};
applyDetGeom(this, f, raw);
DEB_ALWAYS() << DEB_VAR1(det_map);
}
string Jungfrau::getName()
{
DEB_MEMBER_FUNCT();
......
......@@ -509,6 +509,11 @@ class SlsDetector(PyTango.Device_4Impl):
self.printPixelDepthCPUAffinityMap(aff_map)
self.cam.setPixelDepthCPUAffinityMap(aff_map)
@Core.DEB_MEMBER_FUNCT
def read_det_map(self, attr):
det_map = self.model.getDetMap();
attr.set_value(det_map.buffer)
@Core.DEB_MEMBER_FUNCT
def read_jungfrau_gain_map(self, attr):
jungfrau = _SlsDetectorJungfrau
......@@ -688,6 +693,10 @@ class SlsDetectorClass(PyTango.DeviceClass):
[[PyTango.DevULong,
PyTango.SPECTRUM,
PyTango.READ, 64]],
'det_map':
[[PyTango.DevULong,
PyTango.IMAGE,
PyTango.READ, 8192, 8192]],
'jungfrau_gain_map':
[[PyTango.DevUChar,
PyTango.IMAGE,
......
Markdown is supported
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